Closed linako111 closed 7 years ago
getAnnotationObjects()
returns only annotation values that have been asserted with an annotation assertion axiom. Object properties are /never/ used for annotation assertion axioms, so that method won't help you.
OWLObjectProperty has_material_basis_in = ...
ontology.axioms(AxiomType.OBJECT_PROPERTY_ASSERTION)
.filter(ax->ax.getProperty().equals(has_material_basis_in))
.forEach(System.out::println);
This should be closer to what you need.
However, 'all properties for a class' is not a good way to cast the problem in OWL. Do you mean all properties whose domain is known to include a particular class?
In this case, the easiest way is to use an OWLReasoner
to call getObjectPropertyDomains()
and list all the classes that are included in the domain of a property, then check if the class you're interested in is part of the NodeSet
returned. This requires you iterating over all the object properties, which you can do with ontology.objectPropertiesInSignature()
.
I'm not sure... I have this class declaration in the file:
obo:DOID_0050012 a owl:Class ;
obo:IAO_0000115 "aaaaaaaaaaaaa."^^xsd:string ;
rdfs:label "bbbbbbb"^^xsd:string ;
oboInOwl:hasExactSynonym "ccccccccccc"^^xsd:string ;
oboInOwl:hasOBONamespace "disease_ontology"^^xsd:string ;
oboInOwl:id "DOID:0050012"^^xsd:string ;
oboInOwl:inSubset doid:zoonotic_infectious_disease ;
doid:has_material_basis_in `<http://www....#3502>` ;
doid:transmitted_by "mosquito" ;
rdfs:subClassOf obo:DOID_934 ;
there are 2 doid properties in here: "has_material_basis_in" and "transmitted_by" the only difference I can find between these 2 properties is if I go to http://purl.obolibrary.org/obo/doid.owl and see that there is an axiom for "transmitted_by"
getAnnotationObjects(clazz, ontology) - lists everything from the above class, except "doid:has_material_basis_in". And what I need is to check if a class has this "doid:has_material_basis_in" property and, if yes, find its subject - (<http://www....#3502>)
in the above case).
Sorry, I'm very new to this and not fully understand how everything is connected...
I can't see the axiom you're after in the ontology linked. The class only has these annotations:
<!-- http://purl.obolibrary.org/obo/DOID_0050012 -->
<owl:Class rdf:about="http://purl.obolibrary.org/obo/DOID_0050012">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/DOID_934"/>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A viral infectious disease...</obo:IAO_0000115>
<oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Chikungunya fever</oboInOwl:hasExactSynonym>
<oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">disease_ontology</oboInOwl:hasOBONamespace>
<oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">DOID:0050012</oboInOwl:id>
<oboInOwl:inSubset rdf:resource="http://purl.obolibrary.org/obo/doid#zoonotic_infectious_disease"/>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">chikungunya</rdfs:label>
</owl:Class>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/DOID_0050012"/>
<owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
<owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A viral infectious disease that results_in infection located_in joint, has_material_basis_in Chikungunya virus, which is transmitted_by Aedes mosquito bite. The infection has_symptom fever, has_symptom arthralgia, and has_symptom maculopapular rash.</owl:annotatedTarget>
<oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">url:http://en.wikipedia.org/wiki/Chikungunya_virus</oboInOwl:hasDbXref>
</owl:Axiom>
There are more than four thousands axioms using has_material_basis_in
but none of them has #3502
as object. Is the axiom you're after in a different ontology?
I was referring to the http://purl.obolibrary.org/obo/doid.owl:
<!-- http://purl.obolibrary.org/obo/doid#has_material_basis_in -->
<owl:ObjectProperty rdf:about="http://purl.obolibrary.org/obo/doid#has_material_basis_in">
<oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">disease_ontology</oboInOwl:hasOBONamespace>
<oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has_material_basis_in</oboInOwl:id>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">has_material_basis_in</rdfs:label>
</owl:ObjectProperty>
and for "transmitted_by":
<!-- http://purl.obolibrary.org/obo/doid#transmitted_by -->
<owl:ObjectProperty rdf:about="http://purl.obolibrary.org/obo/doid#transmitted_by">
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Pathogen is transmitted.</obo:IAO_0000115>
<oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">disease_ontology</oboInOwl:hasOBONamespace>
<oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">transmitted_by</oboInOwl:id>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">transmitted_by</rdfs:label>
</owl:ObjectProperty>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/doid#transmitted_by"/>
<owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
<owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Pathogen is transmitted.</owl:annotatedTarget>
<oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">DO:lh</oboInOwl:hasDbXref>
</owl:Axiom>
I can see in the
<!-- http://purl.obolibrary.org/obo/DOID_0050012 -->
<owl:Class rdf:about="http://purl.obolibrary.org/obo/DOID_0050012">
<rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/DOID_934"/>
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A viral infectious disease...</obo:IAO_0000115>
<oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Chikungunya fever</oboInOwl:hasExactSynonym>
<oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">disease_ontology</oboInOwl:hasOBONamespace>
<oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">DOID:0050012</oboInOwl:id>
<oboInOwl:inSubset rdf:resource="http://purl.obolibrary.org/obo/doid#zoonotic_infectious_disease"/>
<rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">chikungunya</rdfs:label>
</owl:Class>
<owl:Axiom>
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/DOID_0050012"/>
<owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
<owl:annotatedTarget rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A viral infectious disease that results_in infection located_in joint, has_material_basis_in Chikungunya virus, which is transmitted_by Aedes mosquito bite. The infection has_symptom fever, has_symptom arthralgia, and has_symptom maculopapular rash.</owl:annotatedTarget>
<oboInOwl:hasDbXref rdf:datatype="http://www.w3.org/2001/XMLSchema#string">url:http://en.wikipedia.org/wiki/Chikungunya_virus</oboInOwl:hasDbXref>
</owl:Axiom>
that property for this class has to be "declared" in the http://purl.obolibrary.org/obo/IAO_0000115 resource? transmitted_by is declared in IAO_0000115, but not "has_material_basis_in".
That's where the problem is coming from I think? Is there a way to go around this problem?
I still don't understand the problem.
The declaration of has_material_basis_in
is fine, but I don't see it used in the way you show.
Also, as shown in the declaration, has_material_basis_in
is not an annotation property, therefore it cannot annotate a class.
It is an object property, correct?
You are right - the problem seems to be coming from the subject, which comes from a different ontology:
doid:has_material_basis_in <http://www....#3525>
when I've changed <http://www....#3525>
to "http://www....#3525", I can see all the properties and subjects printed, including :has_material_basis... I use these lines of code to print:
if(clazz.toString().contains("0050012")) {
getAnnotations(clazz, ontology).forEach(a -> printAnno(a));
//getAnnotationObjects(clazz, ontology).forEach(a -> printAnno(a));
}
May be it is a wrong format - <>
?
I have a question: getAnnotationObjects(clazz, ontology); lists only properties that axioms from ontology allow it seems? I would like to get all the properties for a given class, without axiom consideration or any other considerations. Is it possible to do? The reason for this is - there is a property doid:has_material_basis from this ontology: http://purl.obolibrary.org/obo/doid.owl In my file it looks like this: doid:has_material_basis_in a owl:ObjectProperty ; and I don't see it listed in any axioms. then, this property in being used in some of the classes. but, when I use getAnnotationObjects(clazz, ontology) - this particular property is absent from all the classes. Thanks!