Hi everyone.
I am trying to save an ontology that has a TransitiveProperty relation. The 'problem' is that I want the saved ontology to contain even the INDIRECT_* facts.
I understand that this is not the default behavior since these facts could be 'recalculated'. But in my use case, I need all triples that could be infered from my relations to be exported.
!pip install owlready2
from owlready2 import *
onto = get_ontology("http://test.org/example.owl")
with onto:
class Instance(Thing): pass
class after(Instance >> Instance, TransitiveProperty): pass
i1 = Instance("i1")
i2 = Instance("i2", after=[i1])
i3 = Instance("i3", after=[i2])
onto.save('test.nt', format='ntriples')
By now, I am explicitly adding the indirect relations manually. But what I want is the code above to be enough to produce the following triples:
<http://test.org/example.owl#i2> <http://test.org/example.owl#after> <http://test.org/example.owl#i1> .
<http://test.org/example.owl#i3> <http://test.org/example.owl#after> <http://test.org/example.owl#i1> .
<http://test.org/example.owl#i3> <http://test.org/example.owl#after> <http://test.org/example.owl#i2> .