I have the following owl file and want to retrieve the related data to a given class.
<owl:Class rdf:about="http://purl.obolibrary.org/obo/DOID_0001">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/DOID_11"/>
<obo:IAO_11 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A def def def def.</obo:IAO_0000115>
<oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">AA:006394</oboInOwl:hasDbXref>
<oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">abcde</oboInOwl:hasExactSynonym>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">ABCDEFG</rdfs:label>
</owl:Class>
For example I wanted to retrieve the subClassOf which should be DOID_11 without success using the following code:
//create the reasoning model using the base
OntModel inf = ModelFactory.createOntologyModel();
// use the FileManager to find the input file
InputStream in = FileManager.get().open(inputFileName);
if ( in == null) {
throw new IllegalArgumentException("File: " + inputFileName + " not found");
}
inf.read( in , "");
ExtendedIterator <? > classes = inf.listClasses();
while (classes.hasNext()) {
OntClass essaClasse = (OntClass) classes.next();
System.out.println("Classe: " + essaClasse.getLocalName());
for (Iterator <? > i = essaClasse.listSubClasses(); i.hasNext();) {
OntClass c = (OntClass) i.next();
System.out.print(" " + c.getLocalName() + "\n");
} // end for
}
I get just "DOID_0001" instead of "DOID_0001" and "DOID_11". I need also to get all of the other information such as "" and "
DOID_0001 rdfs:subClassOf DOID_11
. That means,DOID_11
is the superclass of ` DOID_0001` not vice versa. And if you ask for all subclasses ofDOID_0001
it's indeed only the class itself as trivial inference. – UninformedUser