I want to perform classification with ontology and pellet reasoner. Pellet has a function(namely realization()) to find the most specific for an individual. I have tried but it doesn't work, could anybody provide some help or give me some 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, the HavingDrink is one of the activity classes. now I create an individual and its 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 is supposed to return HavingDrink class, but it does not.