graph.transitiveClosure does not detect loops · Issue #206 · RDFLib/rdflib (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
Unlike transitive_objects and transitive_subjects, the graph.transitiveClosure method does not detect loops:
https://github.com/RDFLib/rdflib/blob/master/rdflib/graph.py#L682
g=rdflib.Graph() g.add((rdflib.RDF.Property, rdflib.RDFS.subClassOf, rdflib.RDFS.Class)) g.add((rdflib.RDFS.Class, rdflib.RDFS.subClassOf, rdflib.RDF.Property))
def _x(x,g):
for t in g.triples((x[2],rdflib.RDFS.subClassOf,None)): yield t
this will never return:
list(g.transitiveClosure(_x, (None,None,rdflib.RDF.Property)))