Problem with sync_reasoner when anonymous instances are present

Posted by Xavier on
URL: http://owlready.306.s1.nabble.com/Problem-with-sync-reasoner-when-anonymous-instances-are-present-tp2825.html

Hello owlreaders,

When an ontology contains several anonymous individuals, first perform of sync_reasoner_pellet creates a "special" anonymous with a special name ".1 Anonymous Individual" !

version of used owlready2: 0.37

Extract of test code:
        # 2 anonymous created
        ano_adulte=test.Adulte(0)
       ano_enfant=test.Enfant(0)
       # in OWL file, Adulte and Enfant are disjoint
       
        print("before reasoner: ", list(test.Person.instances()))
        >>> before reasoner:  [_:12, _:11]  #normal
                * Owlready2 * Running Pellet...
       
        print("after reasoner, for Enfant class: ", list(test.Enfant.instances()))
        print("and for Adulte class: ", list(test.Adulte.instances()))
        >>> after reasoner, for Enfant class:  [_:12, .1 Anonymous Individual]
                and for Adulte class:  [_:11, .1 Anonymous Individual]
                * Owlready2 * Pellet took 1.3869986534118652 seconds
                * Owlready * Reparenting test.cond1: {test.Condition} => {test.EnfantCond}
       
It's problematic because this special anonymous is attributed on different classes ! If we launch a new reasoning, we get an inconsistent exception:
>>> OwlReadyInconsistentOntologyError => normal because Enfant and Adulte are disjoint but with a common anonymous ".1 Anonymous Individual" instance.

This behavior is not observed when I use directly Pellet inside Protégé (version 5.5.0) or when I don't use anonymous in the test program.
But in my real application, I cannot do without anonymous individuals and multiple reasoning.

Thanks for your help.

anonym.py
test.owl