Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(RDFS) Closure is flushed to the graph #51

Open
JanKalo opened this issue Nov 23, 2021 · 1 comment
Open

(RDFS) Closure is flushed to the graph #51

JanKalo opened this issue Nov 23, 2021 · 1 comment

Comments

@JanKalo
Copy link

JanKalo commented Nov 23, 2021

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?

@ashleysommer
Copy link
Collaborator

@JanKalo
I believe this is a documentation error. Due to the cyclic nature of the way the RDFSClosure (and OWLRLClosure) patterns work in this library, it is necessary for the tool to flush all triples to the graph at the end of each cycle, so they can be available in the graph for the subsequent cycle.

I do plan to add a new feature in OWL-RL in the coming weeks, that will allow you to specify a separate named graph within an rdflib Dataset where all new triples will be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants