I can get OWLClass and access this information. Classes and people along with the prefix.
Is there a way to get rid of the prefix?
For instance:
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>
I want just Mon Dad
UPDATE:
Thanks Ignazio.
I found that the key is a method getIRI().
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());
}
source
share