I am using owl api 4.0 and the following code will give me all the property of individuals belonging to class Animal.
OWLClass animalCl = df.getOWLClass(IRI.create(ontologyIRI + "Animal"));
NodeSet<OWLNamedIndividual> animalIndl = reasoner.getInstances(animalCl, false);
for (OWLNamedIndividual animalNamedIndl : animalIndl.getFlattened())
{
Set<OWLDataPropertyAssertionAxiom> propAll= myontology.getDataPropertyAssertionAxioms(animalNamedIndl);
for (OWLDataPropertyAssertionAxiom ax: propAll)
{
for (OWLLiteral propertyLit : EntitySearcher.getDataPropertyValues(animalNamedIndl, ax.getProperty(), myontolgoy))
System.out.println("The property " + ax.getProperty() + "has value" + propertyLit);
}
}
I have a subproperty "propWt" for every data property. I have used following code:-
NodeSet<OWLDataProperty> properties = reasoner.getSubDataProperties((OWLDataProperty) ax.getProperty(), false);
for (OWLDataProperty mysubproperty : properties.getFlattened())
{
System.out.println("the sub property is " + mysubproperty);
}
instead of
the sub property is <http://localhost:3030/BiOnt.owl#propWt>
i get
the sub property is owl:bottomDataProperty
What is the problem here?
Since you are using a reasoner for the ontology, I assume you want all subproperties, either asserted or inferred. The reasoner can do the job:
NodeSet<OWLDataProperty> properties = reasoner.getSubDataProperties(property, false);