-
-
Notifications
You must be signed in to change notification settings - Fork 73
Description
Perhaps this is a Google Colab-only issue?
!pip install rdflib-sqlalchemy
import kglab
from rdflib import plugin, Graph, Literal, URIRef
from rdflib.store import Store
store = plugin.get("SQLAlchemy", Store)(identifier=URIRef("rdflib_test"))
graph = Graph(store)
graph.open(Literal("sqlite://"), create=True)
kg = kglab.KnowledgeGraph(
name = "...",
import_graph = graph
)
AttributeError Traceback (most recent call last)
in ()
---> 50 import_graph = graph
51 )3 frames
/content/gdrive/MyDrive/ONR/kglab/kglab/kglab.py in init(self, name, base_uri, language, use_gpus, import_graph, namespaces)
111
112 # import relations from another RDF graph, or start from blank
--> 113 if import_graph:
114 self._g = import_graph
115 else:/usr/local/lib/python3.7/dist-packages/rdflib/graph.py in len(self)
527 return 1
528
--> 529 def eq(self, other):
530 return isinstance(other, Graph) and self.identifier == other.identifier
531/usr/local/lib/python3.7/dist-packages/rdflib_sqlalchemy/store.py in len(self, context)
205 (literal, literalContext,
206 ASSERTED_LITERAL_PARTITION), ]
--> 207 q = union_select(selects, distinct=True, select_type=COUNT_SELECT)
208 else:
209 selects = [/usr/local/lib/python3.7/dist-packages/rdflib_sqlalchemy/sql.py in union_select(select_components, distinct, select_type)
54
55 if select_type == COUNT_SELECT:
---> 56 select_clause = table.count(whereClause)
57 elif select_type == CONTEXT_SELECT:
58 select_clause = expression.select([table.c.context], whereClause)AttributeError: 'Alias' object has no attribute 'count'
And oxrdflib:
!pip install oxrdflib
import kglab
import rdflib
kg = kglab.KnowledgeGraph(
name = "...",
import_graph = rdflib.Graph(store="OxMemory")
)
ModuleNotFoundError Traceback (most recent call last)
in ()
---> 49 import_graph = rdflib.Graph(store="OxMemory")
51 )3 frames
/content/gdrive/MyDrive/ONR/kglab/kglab/kglab.py in init(self, name, base_uri, language, use_gpus, import_graph, namespaces)
114 self._g = import_graph
115 else:
--> 116 self._g = rdflib.Graph()
117
118 # initialize the namespaces/usr/local/lib/python3.7/dist-packages/rdflib/graph.py in init(self, store, identifier, namespace_manager, base)
325 if self.__namespace_manager is None:
326 self.__namespace_manager = NamespaceManager(self)
--> 327 return self.__namespace_manager
328
329 def _set_namespace_manager(self, nm):/usr/local/lib/python3.7/dist-packages/rdflib/plugin.py in get(name, kind)
108
109
--> 110 try:
111 from pkg_resources import iter_entry_points
112 except ImportError:/usr/local/lib/python3.7/dist-packages/rdflib/plugin.py in getClass(self)
69 module = import(self.module_path, globals(), locals(), [""])
70 self._class = getattr(module, self.class_name)
---> 71 return self._class
72
73ModuleNotFoundError: No module named 'rdflib.plugins.stores.memory'