From: Todd D. <det@u.washington.edu> - 2012-01-18 16:45:47
|
To further elaborate, here is a snippet from our ontology which has annotations on annotations: <owl:Class rdf:about="&OCRe2;OCRe.owl#OCRE400076"> <rdfs:label rdf:datatype="&xsd;string">Person</rdfs:label> <rdfs:subClassOf rdf:resource="&OCRe2;OCRe.owl#OCRE400064"/> <rdfs:subClassOf rdf:resource="&OCRe2;OCRe_ext.owl#OCRE546280"/> <owl:disjointWith rdf:resource="&OCRe2;OCRe.owl#OCRE449000"/> <owl:disjointWith rdf:resource="&OCRe2;OCRe.owl#OCRE584000"/> <owl:disjointWith rdf:resource="&OCRe2;OCRe.owl#OCRE740000"/> <owl:disjointWith rdf:resource="&OCRe2;OCRe.owl#OCRE831288"/> <owl:disjointWith rdf:resource="&OCRe2;OCRe.owl#OCRE832477"/> <owl:disjointWith rdf:resource="&OCRe2;OCRe.owl#OCRE992000"/> <owl:disjointWith rdf:resource="&owl;Nothing"/> <obo:IAO_0000115 rdf:datatype="&xsd;string">A human being</obo:IAO_0000115> <export_annotations_def:OCRE520413 rdf:resource="&OCRe2;OCRe.owl#OCRE900064"/> <export_annotations_def:OCRE520413 rdf:resource="&OCRe2;OCRe.owl#OCRE900225"/> <export_annotations_def:OCRE520413 rdf:resource="&OCRe2;OCRe.owl#OCRE900226"/> <export_annotations_def:OCRE520413 rdf:resource="&OCRe2;OCRe.owl#OCRE901003"/> <export_annotations_def:OCRE520413 rdf:resource="&OCRe2;OCRe.owl#OCRE901005"/> </owl:Class> <owl:Axiom> <export_annotations_def:OCRE863610 rdf:datatype="&xsd;int">3</export_annotations_def:OCRE863610> <owl:annotatedSource rdf:resource="&OCRe2;OCRe.owl#OCRE400076"/> <owl:annotatedTarget rdf:resource="&OCRe2;OCRe.owl#OCRE901003"/> <owl:annotatedProperty rdf:resource="&OCRe2;export_annotations_def.owl#OCRE520413"/> </owl:Axiom> ... My code gets those annotations on the Person class (export_annotations_def:OCRE520413). But the code that I posted fails to get the annotations on those annotations (as per the axiom at the bottom of the above snippet). Cheers, Todd On 1/17/12 5:53 PM, Todd Detwiler wrote: > OWL2 added support for annotations on other annotations. I have an > ontology which incorporates such constructs, but I am having trouble > accessing the values through the API. Here is a snippet of my code > which is not working: > > private int getElementOrder(OWLAnnotation dataElemAnnot) > { > int order = -1; > Set<OWLAnnotation> annotAxiomAnnots = > dataElemAnnot.getAnnotations(); > for(OWLAnnotation annotAxiomAnnot : annotAxiomAnnots) > { > OWLAnnotationProperty annotProp = > annotAxiomAnnot.getProperty(); > if(annotProp.equals(elemOrderProp)) > { > // this is the element order property, return its value. > OWLAnnotationValue value = annotAxiomAnnot.getValue(); > > ... > > But in spite of the fact that I have annotated annotations, the above > code never enters the body of the for loop. Can anyone spot any > obvious issues? > > Thanks, > Todd |