semantic web - how to find the most specific class for an individual with pellet+owlapi -


i want perform classification ontology , pellet reasoner. pellet has function(namely realization()) find specific individual. have tried doesn't work, provide or give me examples.

<class rdf:about="http://webmind.dico.unimi.it/care/locont.owl#havingdrink">     <equivalentclass>         <class>             <intersectionof rdf:parsetype="collection">                 <rdf:description rdf:about="http://webmind.dico.unimi.it/care/locont.owl#personalactivity"/>                 <restriction>                     <onproperty rdf:resource="http://webmind.dico.unimi.it/care/locont.owl#hasactor"/>                     <allvaluesfrom>                         <class>                             <intersectionof rdf:parsetype="collection">                                 <rdf:description rdf:about="http://webmind.dico.unimi.it/care/locont.owl#person"/>                                 <restriction>                                     <onproperty rdf:resource="http://webmind.dico.unimi.it/care/locont.owl#hascurrentsymboliclocation"/>                                     <somevaluesfrom rdf:resource="http://webmind.dico.unimi.it/care/locont.owl#kitchen"/>                                 </restriction>                                 <restriction>                                     <onproperty rdf:resource="http://webmind.dico.unimi.it/care/locont.owl#usingartifact"/>                                     <somevaluesfrom>                                         <class>                                             <unionof rdf:parsetype="collection">                                                 <rdf:description rdf:about="http://webmind.dico.unimi.it/care/locont.owl#cupscupboard"/>                                                 <rdf:description rdf:about="http://webmind.dico.unimi.it/care/locont.owl#fridge"/>                                             </unionof>                                         </class>                                     </somevaluesfrom>                                 </restriction>                             </intersectionof>                         </class>                     </allvaluesfrom>                 </restriction>             </intersectionof>         </class>     </equivalentclass>     <rdfs:subclassof rdf:resource="http://webmind.dico.unimi.it/care/locont.owl#personalactivity"/> </class> 

for example, havingdrink 1 of activity classes. create individual , objectproperty:

    string file = "file:///home/uqjwen/workspace/owlapi/snapshot.owl#";     owlontologymanager manager = owlmanager.createowlontologymanager();     owlontology ont = manager.loadontology(iri.create(file));     owldatafactory fac = manager.getowldatafactory();      prefixmanager pm = new defaultprefixmanager(iri.create("http://webmind.dico.unimi.it/care/locont.owl").tostring());       //////////create hasactor property///////////////////////////////////////     owlnamedindividual currentactivity = fac.getowlnamedindividual("#alice_activity", pm);     owlnamedindividual alice = fac.getowlnamedindividual("#alice", pm);     owlobjectproperty hasactor = fac.getowlobjectproperty("#hasactor", pm);     owlobjectpropertyassertionaxiom propertyassertion = fac             .getowlobjectpropertyassertionaxiom(hasactor,currentactivity,alice);     manager.addaxiom(ont, propertyassertion);      ////////////create hascurrentsymboliclocation ////////     owlnamedindividual kitchen = fac.getowlnamedindividual("#kitchen", pm);      owlobjectproperty haslocation = fac             .getowlobjectproperty("#hascurrentsymboliclocation", pm);     owlobjectpropertyassertionaxiom locationassertion = fac             .getowlobjectpropertyassertionaxiom(haslocation,alice,kitchen);     manager.addaxiom(ont, locationassertion);      /////////////create using actifact  //////////////     owlnamedindividual cc = fac.getowlnamedindividual("#cups_cupboard", pm);     owlobjectproperty usingartifact = fac             .getowlobjectproperty("#usingartifact", pm);     owlobjectpropertyassertionaxiom artifactassertion =fac             .getowlobjectpropertyassertionaxiom(usingartifact, alice, cc);     manager.addaxiom(ont, artifactassertion);      owlnamedindividual fridge = fac.getowlnamedindividual("#fridge", pm);     artifactassertion =fac             .getowlobjectpropertyassertionaxiom(usingartifact, alice, fridge);     manager.addaxiom(ont, artifactassertion);       //////////////reason      pelletreasoner reasoner = pelletreasonerfactory.getinstance().createreasoner( ont );     system.out.println(reasoner.isconsistent());     reasoner.getkb().classify();     reasoner.getkb().realize();     nodeset<owlclass> types = reasoner.gettypes(currentactivity, true); 

it supposed return havingdrink class, not.

the first thing check ontology contains classes , individuals expect contain—you can saving ontology system.out in code, you're sure of loaded:

manager.saveontology(ont, new systemoutdocumenttarget()); 

then make sure iris being resolved prefix manager match iris in ontology:

owlnamedindividual currentactivity = fac.getowlnamedindividual("#alice_activity", pm); system.put.println("expected individual "+currentactivity.getiri()); 

once these possible sources of error out of way, need verify type expect inferrable ontology—we cannot see rest of ontology, , there might important information there might change expected result.

edit: ontology, definition havingdrink (in functional syntax) is:

equivalentclasses(:havingdrink objectintersectionof( objectallvaluesfrom(:hasactor objectintersectionof(:person objectsomevaluesfrom(:hascurrentsymboliclocation :kitchen) objectsomevaluesfrom(:usingartifact objectunionof(:fridge :cupscupboard))) ) :personalactivity))

in order havingdrink activity, must have value usingartifact of type fridge or cupscupboard, cannot see assertions in ontology. it's quite complex definition, start checking whether alice_activity instance of separate parts of intersection, , ensure each of them satisfied. middle term not satisfied, far can tell.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -