On 25/02/13 12:03, [email protected] wrote:

  Hi Dave,

I am still having issues coming to terms with what is going on in my project. I am using 
this source code to get a resource by its "code":

             AnnotationProperty codeProp = _modelOnt.getAnnotationProperty(NS_NCI_HASH + 
"code");
             Literal codeLiteral = _modelOnt.createTypedLiteral(code);
             StmtIterator iter = _modelOnt.listStatements(new 
SimpleSelector(null, codeProp, codeLiteral));
             OntClass diseaseClass = null;

             while(iter.hasNext()){
                 Statement stmt = iter.next();
                 PrintStatementIterator(stmt.getSubject().listProperties());
                 diseaseClass = stmt.getSubject().as(OntClass.class);
                 break;
             }
             return diseaseClass;


  The call to my print method outputs this:

[http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#T1_Stage_Finding, 
http://www.w3.org/1999/02/22-rdf-syntax-ns#type, 
http://www.w3.org/2002/07/owl#Class]
[http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#T1_Stage_Finding, 
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#Preferred_Name, "T1 Stage 
Finding"^^http://www.w3.org/2001/XMLSchema#string]
[http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#T1_Stage_Finding, 
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#Semantic_Type, 
"Finding"^^http://www.w3.org/2001/XMLSchema#string]
[http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#T1_Stage_Finding, http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#DEFINITION, 
"<ncicp:ComplexDefinition 
xmlns:ncicp="http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#";><ncicp:def-definition>A clinical and/or 
pathologic primary tumor TNM finding indicating that the cancer is limited to the site of 
growth.</ncicp:def-definition><ncicp:def-source>NCI</ncicp:def-source></ncicp:ComplexDefinition>"^^http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral]

The stmt.getSubject().as(OntClass.class) call throws this exception:

http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#T1_Stage_Finding to 
OntClass: it does not have rdf:type owl:Class or equivalent


The first line from listProperties() states that the resource is an owl:Class. But the 
exception begs to differ. I am not using any manually created URIs in this example and 
the selector finds a hit for the supplied code (e.g. "C48720").

What am I missing?

Does look very odd.

Is there any inference involved or is this a plain model?

What OnModelSpec are you using? Clearly if you specified RDFS and had no inference then the call would fail, though I assume you are using an OWL spec.

Dave

Reply via email to