From 1cbccbecdef0270fd338502c9a30d4ca27f95851 Mon Sep 17 00:00:00 2001 From: Sarath Menon Date: Tue, 7 Nov 2023 22:44:14 +0100 Subject: [PATCH 1/3] update dependencies --- environment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index a962f71..e917761 100644 --- a/environment.yml +++ b/environment.yml @@ -13,7 +13,7 @@ dependencies: - ase - ipycytoscape - networkx - - sqlalchemy <2.0.0 - - rdflib-sqlalchemy + - pyoxigraph + - oxrdflib - pandas - owlready2 From 986044f0aeea626cb87042e488220f93e5793705 Mon Sep 17 00:00:00 2001 From: Sarath Menon Date: Tue, 7 Nov 2023 22:53:33 +0100 Subject: [PATCH 2/3] add oxigraph store --- pyscal_rdf/graph.py | 14 ++++++-------- pyscal_rdf/structure.py | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pyscal_rdf/graph.py b/pyscal_rdf/graph.py index 8b324fa..7a1d535 100644 --- a/pyscal_rdf/graph.py +++ b/pyscal_rdf/graph.py @@ -54,20 +54,18 @@ class RDFGraph: def __init__(self, graph_file=None, store="Memory", store_file=None, - identifier="default_graph"): + identifier="http://default_graph"): #owlfile = os.path.join(os.path.dirname(__file__), "data/cmso.owl") #self.graph.parse(owlfile, format='xml') if store == "Memory": self.graph = Graph(store="Memory", identifier=identifier) - elif store=="SQLAlchemy": - if store_file is None: - raise ValueError("store file is needed if store is not memory") - self.graph = Graph(store="SQLAlchemy", identifier=identifier) - uri = Literal(f"sqlite:///{store_file}") - self.graph.open(uri, create=True) - + elif store=="Oxigraph": + self.graph = Graph(store="Oxigraph", identifier=identifier) + if store_file is not None: + self.graph.open(store_file) + elif inspect.isclass(type(store)): try: prpath = store.path diff --git a/pyscal_rdf/structure.py b/pyscal_rdf/structure.py index 95be98d..567a27d 100644 --- a/pyscal_rdf/structure.py +++ b/pyscal_rdf/structure.py @@ -98,7 +98,7 @@ class StructureGraph(RDFGraph): def __init__(self, graph_file=None, store="Memory", store_file=None, - identifier="default_graph"): + identifier="http://default_graph"): super().__init__(graph_file=graph_file, store=store, store_file=store_file, identifier=identifier) self._element_dict = element_dict From eb4b693effb07cf2a737d6397a8c5a516d904480 Mon Sep 17 00:00:00 2001 From: Sarath Menon Date: Tue, 7 Nov 2023 22:57:28 +0100 Subject: [PATCH 3/3] change store for python --- pyscal_rdf/graph.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pyscal_rdf/graph.py b/pyscal_rdf/graph.py index 7a1d535..19ee925 100644 --- a/pyscal_rdf/graph.py +++ b/pyscal_rdf/graph.py @@ -69,16 +69,14 @@ def __init__(self, graph_file=None, elif inspect.isclass(type(store)): try: prpath = store.path - dbfile = os.path.join(prpath, 'project.db') #now start sqlalchemy instance - self.graph = Graph(store="SQLAlchemy", identifier=identifier) - uri = Literal(f"sqlite:///{dbfile}") - self.graph.open(uri, create=True) + self.graph = Graph(store="Oxigraph", identifier=identifier) + self.graph.open(prpath) except: - raise ValueError("store should be pyiron_project, SQLAlchemy, or Memory") + raise ValueError("store should be pyiron_project, Oxigraph, or Memory") else: - raise ValueError("store should be pyiron_project, SQLAlchemy, or Memory") + raise ValueError("store should be pyiron_project, Oxigraph, or Memory") self.graph.bind("cmso", CMSO) self.graph.bind("pldo", PLDO)