I am using _modelOnt = ModelFactory.createOntologyModel(OntModelSpec.RDFS_MEM, ds.getDefaultModel()); So RDFS inference and not OWL because I want to keep the loading time to a minimum. I tried OWL_MICRO_MEM but that a long time to load. I canceled it after 1 hour since that is not feasible for me.
I can get an OntClass from this model for certain concepts using RDFS inference, e.g. "Neoplasm", but cannot for others, e.g. "T1_Stage_Finding". I attached both definitions, directly copied from the thesaurus.owl file. There must be something different in there that I don't see. I also created a smaller test ontology with just those concepts and properties from the thesaurus that are required to mirror this scenario (including parent concepts) and strangely enough, neither of the two concepts can be retrieved as OntClass. -Wolfgang -----Original Message----- From: Dave Reynolds <[email protected]> To: users <[email protected]> Sent: Mon, Feb 25, 2013 2:00 pm Subject: Re: OntModel.getOntClass does not return existing classes 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
<!-- http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#T1_Stage_Finding --> <owl:Class rdf:about="#T1_Stage_Finding"> <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string" >T1 Stage Finding</rdfs:label> <rdfs:subClassOf rdf:resource="#Generic_Primary_Tumor_TNM_Finding"/> <DEFINITION rdf:parseType="Literal" ><ncicp:ComplexDefinition><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></DEFINITION> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>T1 Cancer Stage Finding</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>T1 Primary Tumor Finding</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>T1 Primary Tumor Stage Finding</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>T1 Stage Finding</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>T1 Stage</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>T1 TNM Finding</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>T1 Tumor Finding</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>T1 Tumor Stage</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>T1</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>Tumor Stage T1</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <UMLS_CUI rdf:datatype="http://www.w3.org/2001/XMLSchema#string">C0475372</UMLS_CUI> <code rdf:datatype="http://www.w3.org/2001/XMLSchema#string">C48720</code> <Semantic_Type rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Finding</Semantic_Type> <Preferred_Name rdf:datatype="http://www.w3.org/2001/XMLSchema#string" >T1 Stage Finding</Preferred_Name> <Legacy_Concept_Name rdf:datatype="http://www.w3.org/2001/XMLSchema#string" >T1_Stage_Finding</Legacy_Concept_Name> </owl:Class>
<!-- http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#Neoplasm --> <owl:Class rdf:about="#Neoplasm"> <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Neoplasm</rdfs:label> <rdfs:subClassOf rdf:resource="#Diseases_and_Disorders"/> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="#Disease_Has_Abnormal_Cell"/> <owl:someValuesFrom rdf:resource="#Neoplastic_Cell"/> </owl:Restriction> </rdfs:subClassOf> <DEFINITION rdf:parseType="Literal" ><ncicp:ComplexDefinition><ncicp:def-definition>A benign or malignant tissue growth resulting from uncontrolled cell proliferation. Benign neoplastic cells resemble normal cells without exhibiting significant cytologic atypia, while malignant cells exhibit overt signs such as dysplastic features, atypical mitotic figures, necrosis, nuclear pleomorphism, and anaplasia. Representative examples of benign neoplasms include papillomas, cystadenomas, and lipomas; malignant neoplasms include carcinomas, sarcomas, lymphomas, and leukemias.</ncicp:def-definition><ncicp:def-source>NCI</ncicp:def-source></ncicp:ComplexDefinition></DEFINITION> <ALT_DEFINITION rdf:parseType="Literal" ><ncicp:ComplexDefinition><ncicp:def-definition>A general term for autonomous tissue growth in which the malignancy status has not been established and for which the transformed cell type has not been specifically identified.</ncicp:def-definition><ncicp:def-source>CDISC</ncicp:def-source></ncicp:ComplexDefinition></ALT_DEFINITION> <ALT_DEFINITION rdf:parseType="Literal" ><ncicp:ComplexDefinition><ncicp:def-definition>An abnormal mass of tissue that results when cells divide more than they should or do not die when they should. Neoplasms may be benign (not cancer), or malignant (cancer).</ncicp:def-definition><ncicp:def-source>NCI-GLOSS</ncicp:def-source></ncicp:ComplexDefinition></ALT_DEFINITION> <ALT_DEFINITION rdf:parseType="Literal" ><ncicp:ComplexDefinition><ncicp:def-definition>An abnormal tissue growth resulted from uncontrolled cell proliferation. Benign neoplastic cells resemble normal cells without exhibiting significant cytologic atypia, while malignant ones exhibit overt signs such as dysplastic features, atypical mitotic figures, necrosis, nuclear pleomorphism, and anaplasia. Representative examples of benign neoplasms include papillomas, cystadenomas, and lipomas; malignant neoplasms include carcinomas, sarcomas, lymphomas, and leukemias. -- 2004 (NCI)</ncicp:def-definition><ncicp:def-source>CDISC</ncicp:def-source></ncicp:ComplexDefinition></ALT_DEFINITION> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>NEOPLASM, UNDETERMINED</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>CDISC</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>NEOPLASMS BENIGN, MALIGNANT AND UNSPECIFIED (INCL CYSTS AND POLYPS)</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>CDISC</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>Neoplasia</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>Neoplasm</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>Neoplasm</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>NICHD</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>Neoplasms</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>Neoplastic Growth</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>neoplasia</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>NCI-GLOSS</ncicp:term-source><ncicp:source-code>CDR0000045801</ncicp:source-code></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>neoplasm</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>NCI-GLOSS</ncicp:term-source><ncicp:source-code>CDR0000046264</ncicp:source-code></ncicp:ComplexTerm></FULL_SYN> <FULL_SYN rdf:parseType="Literal" ><ncicp:ComplexTerm><ncicp:term-name>tumor</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>NCI-GLOSS</ncicp:term-source><ncicp:source-code>CDR0000046634</ncicp:source-code></ncicp:ComplexTerm></FULL_SYN> <UMLS_CUI rdf:datatype="http://www.w3.org/2001/XMLSchema#string">C0375111</UMLS_CUI> <code rdf:datatype="http://www.w3.org/2001/XMLSchema#string">C3262</code> <Contributing_Source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">CDISC</Contributing_Source> <Contributing_Source rdf:datatype="http://www.w3.org/2001/XMLSchema#string">NICHD</Contributing_Source> <Legacy_Concept_Name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Neoplasm</Legacy_Concept_Name> <Preferred_Name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Neoplasm</Preferred_Name> <Semantic_Type rdf:datatype="http://www.w3.org/2001/XMLSchema#string" >Neoplastic Process</Semantic_Type> <Neoplastic_Status rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Undetermined</Neoplastic_Status> <Concept_In_Subset rdf:resource="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#CDISC_SDTM_System_Organ_Class_Terminology"/> <Concept_In_Subset rdf:resource="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#CDISC_SDTM_Terminology"/> <Concept_In_Subset rdf:resource="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#CDISC_SEND_Terminology"/> <Concept_In_Subset rdf:resource="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#CDISC_SEND_Tumor_Findings_Results_Terminology"/> <Concept_In_Subset rdf:resource="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#Clinical_Data_Interchange_Standards_Consortium"/> <Has_NICHD_Parent rdf:resource="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#Diseases_and_Disorders"/> <Concept_In_Subset rdf:resource="http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#National_Institute_of_Child_Health_and_Human_Development_Pediatric_Terminology"/> </owl:Class>
