On 19/02/13 19:44, Emanuel Santos wrote:
I noticed using
"PelletReasonerFactory.THE_SPEC" instead of "OntModelSpec.OWL_MEM_TRANS_INF"
the example above gives the right answer. Any idea why this happens ?

Without, as Ian said, a complete minimal example no one can tell.

Your example is not complete since it doesn't show the actual ontologies you are processing. It is certainly not minimal. In fact you seem to assert both subclass and superclass relations both ways round, twice.

Your code in effect says that the following pairs are equivalent class (subclass of each other):
     #MA_0001251  <>  #NCI_C49482
     #MA_0000011  <>  #NCI_C12374
     #MA_0000003  <>  #NCI_C12919

then you say that

  #NCI_C21599 doesnt have subclass #MA_0001755

Since neither of those are mentioned in your code then we've no reason to expect otherwise. Presumably you expect this because of something in our ontologies but it may be that your ontologies require more than just the transitive reasoner to reason over. Did you, for example, try OWL_MICRO?

Dave


Emanuel


On 19 February 2013 12:45, Emanuel Santos <[email protected]> wrote:

There is a missprint there: Instead of

dmb1.addAltEntry("bio2",mouse); should be dmb1.addAltEntry("bio2",human);


Thanks!


On 19 February 2013 12:08, Emanuel Santos <[email protected]> wrote:

Hi, thanks for the reply.

Try using hasSubclass(Resourse, true) and hasSubclass(Resourse, false)
and didnt get the right results.

Here is the example:

I'm using the mouse and human ontologies used in OAEI.


(...) files....bio1... bio2

   OntModel model1 = ModelFactory.createOntologyModel(OntModelSpec.
OWL_MEM_TRANS_INF);

   OntDocumentManager dmb1 = model1.getDocumentManager();

  dmb1.addAltEntry("bio1",mouse);

dmb1.addAltEntry("bio2",mouse);

     System.out.println("Loading Ontology (1) ...");

  model1.read("bio1");

  model1.read("bio2");


    OntClass cl1 = model1.getOntClass("http://mouse.owl#MA_0001251";);

  OntClass cl2 = model1.getOntClass("http://human.owl#NCI_C49482";);

   cl1.addSubClass(cl2);

  cl1.addSuperClass(cl2);

  cl2.addSubClass(cl1);

  cl2.addSuperClass(cl1);

   OntClass cl3 = model1.getOntClass("http://mouse.owl#MA_0000011";);

  OntClass cl4 = model1.getOntClass("http://human.owl#NCI_C12374";);

   cl3.addSubClass(cl4);

  cl3.addSuperClass(cl4);

  cl4.addSubClass(cl3);

  cl4.addSuperClass(cl3);

   OntClass cl5 = model1.getOntClass("http://mouse.owl#MA_0000003";);

  OntClass cl6 = model1.getOntClass("http://human.owl#NCI_C12919";);

   cl5.addSubClass(cl6);

  cl5.addSuperClass(cl6);

  cl6.addSubClass(cl5);

  cl6.addSuperClass(cl5);


     OntClass clss1 = model1.getOntClass("http://mouse.owl#MA_0000011";);


  OntClass clss2 = model1.getOntClass("http://human.owl#NCI_C12919";);

   if(clss2.hasSubClass(clss1)){

  System.out.println(clss2.toString() + " has subclasse " +
clss1.toString() );

  }

     OntClass clss3 = model1.getOntClass("http://human.owl#NCI_C21599";);

   if(clss3.hasSubClass(clss1)){

  System.out.println(clss3.toString() + " has subclasse " +
clss1.toString() );

  }

     OntClass clss4 = model1.getOntClass("http://mouse.owl#MA_0001755";);

   if(clss1.hasSubClass(clss4)){

  System.out.println(clss1.toString() + " has subclasse " +
clss4.toString() );

  }

     if(clss2.hasSubClass(clss4)){

  System.out.println(clss2.toString() + " has subclasse " +
clss4.toString() );

  }


  if(clss3.hasSubClass(clss4)){

  System.out.println(clss3.toString() + " has subclasse " +
clss4.toString() );

  }else{

  System.out.println(clss3.toString() + " doesnt have subclasse " +
clss4.toString() );

  }



Result:

http://human.owl#NCI_C12919 has subclasse http://mouse.owl#MA_0000011

http://human.owl#NCI_C21599 has subclasse http://mouse.owl#MA_0000011

http://mouse.owl#MA_0000011 has subclasse http://mouse.owl#MA_0001755

http://human.owl#NCI_C12919 has subclasse http://mouse.owl#MA_0001755

http://human.owl#NCI_C21599 doesnt have subclasse
http://mouse.owl#MA_0001755



Where is the bug ? It could be a easy one.. I didn't sleep.. :)


Thanks!





On 19 February 2013 09:33, Ian Dickinson <[email protected]> wrote:

Hi Emanuel,
These kinds of questions are *much* easier to answer if you supply a
complete minimal example - working code, including the data.  The short
answer is that the transitive reasoner should give you the answer you're
expecting, so there's something wrong in the way you're querying the model,
or something wrong in the data.

Ian


On 19/02/13 04:31, Emanuel Santos wrote:

Hi again,

I have a ontology model created with "OntModelSpec.OWL_MEM_TRANS_**
INF".

Given the original ontology I added some new "subclass" relations
between some classes (using addSubClass and addSuperClass methods).

Now I have a class A that is a subclass of B and C.
And another class D that is subclass of A.

(these results are given by hasSubClass method)


Given this model I should get the result that D is a subclass of B and
C. But for some reason I'm not getting that result (again using
hasSubClass method)
Does this mean that the model does not fully update the new inferred
relations between classes ? What should I do?

It is odd, because A is only a subclass (not direct one) of C after
the addition of the new relations, i.e. A subclass C is inferred.

Any ideas ?!

Thanks!



--
______________________________**______________________________
Ian Dickinson                   Epimorphics Ltd, Bristol, UK
mailto:[email protected]        http://www.epimorphics.com
cell: +44-7786-850536              landline: +44-1275-399069
------------------------------**------------------------------
Epimorphics Ltd.  is a limited company registered in England
(no. 7016688). Registered address: Court Lodge, 105 High St,
               Portishead, Bristol BS20 6PT, UK






Reply via email to