Problem with sync_reasoner when anonymous instances are present

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with sync_reasoner when anonymous instances are present

Xavier
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
Reply | Threaded
Open this post in threaded view
|

Re: Problem with sync_reasoner when anonymous instances are present

Jiba
Administrator
Hello,

I've fixed the problem by ignoring these "special" anonymous (which corresponds to blank nodes). However, I am unable to obtain the classification of blank nodes : Jena (used by Pellet) renames all blank nodes, thus I cannot obtain their classification. I also tried to replace automatically all blank nodes by dynamically created entities, but it seems that there is a bug in Jena, and that it accepts only blank nodes at some places...

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Problem with sync_reasoner when anonymous instances are present

Xavier
Thank you Jiba for your quick fix.

No worries about the test program, I would test asap on my real application.

Xavier
Reply | Threaded
Open this post in threaded view
|

Re: Problem with sync_reasoner when anonymous instances are present

Xavier
Hello,

I tested on the real application and, without surprise, the fix is ok.

Owlready2 is great, good job Jiba ;-)

Xavier