__init__.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. """
  2. Root of the ModelVerse State package
  3. """
  4. # Copyright 2023 Modelling, Simulation and Design Lab (MSDL)
  5. # at the University of Antwerp (http://msdl.uantwerpen.be/).
  6. #
  7. # Licensed under the GNU Public License v3 (the "License");
  8. # you may not use this file except in compliance with the
  9. # License. You may obtain a copy of the License at
  10. # https://www.gnu.org/licenses/gpl-3.0.en.html
  11. #
  12. # Unless required by applicable law or agreed to in writing,
  13. # software distributed under the License is distributed on an
  14. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  15. # either express or implied. See the License for the specific
  16. # language governing permissions and limitations under the
  17. # License.
  18. from enum import Enum
  19. class MvSKernel(Enum):
  20. PYTHON = 0
  21. RDF = 1
  22. NEO4J = 2
  23. IGRAPH = 3
  24. def getMvSBackend(type, *args, **kwargs):
  25. """
  26. Obtains a state implementation for the ModelVerse State.
  27. Args:
  28. type (MvSKernel): The type of backend to use.
  29. All other arguments are implementation-specific.
  30. """
  31. if type == MvSKernel.PYTHON:
  32. from .pystate import PyState
  33. return PyState()
  34. elif type == MvSKernel.RDF:
  35. from .rdfstate import RDFState
  36. return RDFState(*args, **kwargs)
  37. elif type == MvSKernel.NEO4J:
  38. from .neo4jstate import Neo4jState
  39. return Neo4jState(*args, **kwargs)
  40. elif type == MvSKernel.IGRAPH:
  41. from .igraphstate import iGraphState
  42. return iGraphState()