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

(RDFS) Closure is flushed to the graph #51

Open JanKalo opened 2 years ago

JanKalo commented 2 years ago
import owlrl

rdfs = owlrl.RDFSClosure.RDFS_Semantics(g, False, False, False)
rdfs.closure()

result = g.query("""
PREFIX s: <http://example.org/>
SELECT ?x
WHERE{
    ?x rdf:type s:Example .
} 
""")

print(g.serialize())

When I understood the documentation correctly, calling rdfs.closure() should only store the inferred triples in a temporary set. They should only be added to the graph when calling the flush_stored_triples() method. However, this method is already called at the end of the closure() method.

Is there a possibility to not add the triples directly to the graph? Is this behavior on purpose?