RDFLib / OWL-RL

A simple implementation of the OWL2 RL Profile on top of RDFLib: it expands the graph with all possible triples that OWL RL defines. It can be used together with RDFLib to expand an RDFLib Graph object, or as a stand alone service with its own serialization.
http://www.ivan-herman.net/Misc/2008/owlrl/
Other
139 stars 30 forks source link

Inferencing does not work on rdflib.Dataset #64

Open lu-pl opened 10 months ago

lu-pl commented 10 months ago

Inferencing does not work on rdflib.Dataset, yet rdflib.ConjunctiveGraph works just fine.

from rdflib.graph import Dataset, ConjunctiveGraph

from owlrl import DeductiveClosure
from owlrl.OWLRL import OWLRL_Semantics

# works
g1 = ConjunctiveGraph()
DeductiveClosure(OWLRL_Semantics).expand(g1)
print(len(g1))

# ValueError
g2 = Dataset()
DeductiveClosure(OWLRL_Semantics).expand(g2)
print(len(g2))

The exception is caused by the attempt to unpack with too many values in owlrl.OWLRL.py line 446.

Apparently this is due to how rdflib.Dataset and rdflib.ConjunctiveGraph handle triples/quads internally.