如何使用OWLAPI获取概念的注释(类IRI上的注释)?

时间:2015-08-24 12:49:58

标签: java annotations ontology owl-api

在网站http://www.obofoundry.org/的pato.owl本体中,一些概念有多个注释。例如,概念PATO_0001051具有标签“锐角”和定义:“小于90度的角度”。我如何通过owlapi这个定义?非常感谢。

    <owl:Class rdf:about="http://purl.obolibrary.org/obo/PATO_0001051">
       <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">acute angle to</rdfs:label>
       <rdfs:subClassOf rdf:resource="http://purl.obolibrary.org/obo/PATO_0002326"/>
       <obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">An angle which is less than 90 degrees.</obo:IAO_0000115>
       <oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">PATO:0001051</oboInOwl:id>
       <oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">quality</oboInOwl:hasOBONamespace>
       <oboInOwl:inSubset rdf:resource="http://purl.obolibrary.org/obo/pato#relational_slim"/>
       <oboInOwl:inSubset rdf:resource="http://purl.obolibrary.org/obo/pato#value_slim"/>
   </owl:Class>

1 个答案:

答案 0 :(得分:0)

亲爱的Artemis和Ignazio,非常感谢您的回答。这是答案:

    for(OWLClass owl_class : localOntology.getClassesInSignature(true)){
         for(OWLAnnotationAssertionAxiom annotations:owl_class.getAnnotationAssertionAxioms(localOntology))
             if(annotations.getProperty().getIRI().getFragment()==null) {
                            System.out.println("definition: "+annotations.getValue());
                                                                        }
                                                         }