I can get OWLClass and access the information. The classes and individuals are along with prefix.
Is there any method to get rid of prefix?
For example:
OWLClass cls = factory.getOWLClass(":Person", pm);
for (OWLIndividual indiv : cls.getIndividuals(onto)) {
System.out.println(indiv.toString());
}
print:
<http://www.co-ode.org/ontologies/ont.owl#Mon>
<http://www.co-ode.org/ontologies/ont.owl#Dad>
What I want is just Mon
Dad
UPDATE:
Thank you Ignazio.
I found that the key is getIRI()
method.
for (OWLIndividual indiv : owlclass.getIndividuals(onto)) {
System.out.println(indiv.asOWLNamedIndividual().getIRI().getFragment());
}
for (OWLClassExpression expre : owlclass.getSubClasses(onto)) {
System.out.println(expre.asOWLClass().getIRI().getFragment());
}