Posted by
Fla on
URL: http://owlready.306.s1.nabble.com/http-inferrences-content-tp1821p1840.html
Hello Jiba,
A new question about 'inferrences'
Here the code :
----------------------------------8<-------------------------------------------------
import sys
from owlready2 import *
onto = get_ontology("
http://test.inferences/onto.owl#")
with onto:
class Man(Thing):pass
class hasFather(ObjectProperty, FunctionalProperty):
domain = [Man]
range = [Man]
class hasSon(ObjectProperty,FunctionalProperty):
domain = [Man]
range = [Man]
class isHappy(Man >> bool, FunctionalProperty): pass
pierre = Man("Pierre")
paul = Man("Paul",hasFather= pierre)
with onto:
imp = Imp()
imp.set_as_rule("Man(?x), hasFather(?x,?y) -> hasSon(?y,?x)")
imp = Imp()
imp.set_as_rule("Man(?x), hasSon(?x,?y) -> isHappy(?x,true)")
onto_infer = get_ontology("
http://inferrences/")
sync_reasoner_pellet(infer_data_property_values=True, infer_property_values=True,keep_tmp_file = 0,debug=1)
onto.save('./my_onto_tests_after_reasonning.owl')
onto_infer.save('./my_onto_inferrences_after_reasoning.owl',format='rdfxml')
----------------------------------8<-------------------------------------------------
1) The reasoner output logs says :
[...]
* Owlready * Adding relation onto.Pierre hasSon onto.Paul
* Owlready * Adding relation onto.Pierre isHappy true
[...]
==> So i am expecting to found those two inferences in 'onto' with other atoms and in 'into_infer'
In fact there is nothing in 'my_onto_inferrences_after_reasoning.owl' :-( and nothing about inferred axioms in 'my_onto_tests_after_reasonning.owl'
Could you tell me where i am wrong ?
Thank you very much,