Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def reason_rdfs(g):
"""
Applies RDFS reasoning. Takes a few seconds.
Lets us use:
- class hierarchy (rdf:type, not rdf:type/rdfs:subClassOf*)
"""
start_time = time.time()
owlrl.DeductiveClosure(owlrl.RDFS_Semantics).expand(g)
end_time = time.time()
print('owlrl reasoning took {0} seconds.'.format(int(end_time - start_time)))
def expand(self, graph):
for triple in graph:
self.g.add(triple)
owlrl.DeductiveClosure(owlrl.RDFS_Semantics).expand(self.g.g)
return self.g