Dear Dave, thanks for your help! Using OWL_MEM works as expected, just takes longer to create the OntModel, but it is still acceptable timewise.
I was trying to use the least expensive OntModelSpec and started with RDFS_MEM,
just to see if it would return OntClasses. And since it did, I just got stuck
in the wrong path ...
I am still curious, why the OntClass instantiation works for "Neoplasm", but
not for "T1_Stage_Finding". Could you please ellaborate a bit more on what
exactly (might have) happened? Here are some things that I still find confusing:
So based on our email exchange: An OntClass does not necessarily need to be an
owl:Class. When using RDFS_MEM, rdfs:Class would be enough for an OntClass
instantiation? What I find confusing is that the exception I got when using
RDFS_MEM refers to "owl:Class or similar". This implies that OntClass always
knows about owl:Class and is checking for it even if I am using RDFS_MEM. So an
rdfs:Class should never be enough for an OntClass? Even if there was an
rdfs:Class statement for Neoplasm, it should not work since it is not
equivalent to owl:Class?
I take it that RDFS_MEM does not do any additional reasoning, so the statement
that makes the OntClass instantiation succeed for "Neoplasm" must be readily
visible. The Thesaurus.owl file does not contain any mention of rdfs:Class
anywhere. I also attached the result of the Sparql query "SELECT * WHERE {
nci:Neoplasm ?p ?s . }". The result shows that there are no rdfs:Class triples.
The only rdfs: triples are rdfs:label and rdfs:subClassOf. rdfs:subClassOf
leads to other owl:Classes. And the other triples describe properties. Is there
more to how OntClass determines if it can convert a resource?
Regards,
Wolfgang
-----Original Message-----
From: Dave Reynolds <[email protected]>
To: users <[email protected]>
Sent: Mon, Feb 25, 2013 6:21 pm
Subject: Re: OntModel.getOntClass does not return existing classes
On 25/02/13 17:04, [email protected] wrote:
> I am using
>
> _modelOnt = ModelFactory.createOntologyModel(OntModelSpec.RDFS_MEM,
> ds.getDefaultModel());
Ah, that explains it!
> So RDFS inferenceand not OWLbecause 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 hoursince that is not feasiblefor me.
I can see that you don't want OWL inference.
But what you specified is an *RDFS* profile, not an OWL profile, with no
inference at all.
So the OntAPI has been told that classes are of type rdfs:Class and
there's no inference specified to allow it to deduce that something
which is declared as a owl:Class is also an rdfs:Class.
Use OntModelSpec.OWL_MEM which is an *OWL* profile with no inference.
> 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.
My neither but now the mystery is why it doesn't complain about
#Neoplasm rather than why it does complain about #T1_Stage_Finding.
I wonder if there are other statements about #Neoplasm in your data
which assert it's an rdfs:Class.
> Ialso 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.
So that's consistent and reinforces the hypothesis that there's other
statements about #Neoplasm elsewhere in your data.
Dave
>
> -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
>
>
>
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| p | o
|
=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
| rdf:type | owl:Class
|
| nci:Preferred_Name | "Neoplasm"^^xsd:string
|
| nci:Has_NICHD_Parent | nci:Diseases_and_Disorders
|
| nci:Semantic_Type | "Neoplastic Process"^^xsd:string
|
| nci:ALT_DEFINITION | "<ncicp:ComplexDefinition
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><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>"^^rdf:XMLLiteral
|
| nci:ALT_DEFINITION | "<ncicp:ComplexDefinition
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><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>"^^rdf:XMLLiteral
|
| nci:ALT_DEFINITION | "<ncicp:ComplexDefinition
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><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>"^^rdf:XMLLiteral
|
| nci:DEFINITION | "<ncicp:ComplexDefinition
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><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>"^^rdf:XMLLiteral
|
| nci:Concept_In_Subset | nci:CDISC_SEND_Terminology
|
| nci:Concept_In_Subset | nci:Clinical_Data_Interchange_Standards_Consortium
|
| nci:Concept_In_Subset |
nci:National_Institute_of_Child_Health_and_Human_Development_Pediatric_Terminology
|
| nci:Concept_In_Subset | nci:CDISC_SDTM_Terminology
|
| nci:Concept_In_Subset | nci:CDISC_SEND_Tumor_Findings_Results_Terminology
|
| nci:Concept_In_Subset | nci:CDISC_SDTM_System_Organ_Class_Terminology
|
| nci:Contributing_Source | "CDISC"^^xsd:string
|
| nci:Contributing_Source | "NICHD"^^xsd:string
|
| nci:Neoplastic_Status | "Undetermined"^^xsd:string
|
| nci:Legacy_Concept_Name | "Neoplasm"^^xsd:string
|
| nci:UMLS_CUI | "C0375111"^^xsd:string
|
| nci:FULL_SYN | "<ncicp:ComplexTerm
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><ncicp:term-name>NEOPLASM,
UNDETERMINED</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>CDISC</ncicp:term-source></ncicp:ComplexTerm>"^^rdf:XMLLiteral
|
| nci:FULL_SYN | "<ncicp:ComplexTerm
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><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>"^^rdf:XMLLiteral
|
| nci:FULL_SYN | "<ncicp:ComplexTerm
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><ncicp:term-name>Neoplasia</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm>"^^rdf:XMLLiteral
|
| nci:FULL_SYN | "<ncicp:ComplexTerm
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><ncicp:term-name>Neoplasm</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm>"^^rdf:XMLLiteral
|
| nci:FULL_SYN | "<ncicp:ComplexTerm
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><ncicp:term-name>Neoplasm</ncicp:term-name><ncicp:term-group>PT</ncicp:term-group><ncicp:term-source>NICHD</ncicp:term-source></ncicp:ComplexTerm>"^^rdf:XMLLiteral
|
| nci:FULL_SYN | "<ncicp:ComplexTerm
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><ncicp:term-name>Neoplasms</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm>"^^rdf:XMLLiteral
|
| nci:FULL_SYN | "<ncicp:ComplexTerm
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><ncicp:term-name>Neoplastic
Growth</ncicp:term-name><ncicp:term-group>SY</ncicp:term-group><ncicp:term-source>NCI</ncicp:term-source></ncicp:ComplexTerm>"^^rdf:XMLLiteral
|
| nci:FULL_SYN | "<ncicp:ComplexTerm
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><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>"^^rdf:XMLLiteral
|
| nci:FULL_SYN | "<ncicp:ComplexTerm
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><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>"^^rdf:XMLLiteral
|
| nci:FULL_SYN | "<ncicp:ComplexTerm
xmlns:ncicp=\"http://ncicb.nci.nih.gov/xml/owl/EVS/ComplexProperties.xsd#\"><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>"^^rdf:XMLLiteral
|
| nci:code | "C3262"^^xsd:string
|
| rdfs:label | "Neoplasm"^^xsd:string
|
| rdfs:subClassOf | nci:Diseases_and_Disorders
|
| rdfs:subClassOf | _:b0
|
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
