Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from rdflib import Graph
- g = Graph()
- g.parse("example.ttl", format="turtle")
- qres = g.query(
- """CONSTRUCT {?s rdfs:subClassOf ?o}
- {
- ?s rdfs:subClassOf* ?o.
- FILTER (?s != ?o)
- } """)
- for s, p, o in qres:
- g.add((s,p,o))
- g.serialize(destination='example.ttl', format='turtle')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement