[英]How to get annotations of object property assertions using OWL API
假定以下示例(請參見下圖):單個“ bmw-x5”具有對象屬性聲明“ has-type car”。 該對象屬性的注釋屬性“ wheels”的值為“ 4”。
使用OWL API,我設法獲得了單獨的“ bmw-x5”,即對象屬性斷言“ hastype car”。 我現在停留在注釋屬性“ wheels”上。 如何從OWL API獲得其價值?
<ObjectPropertyAssertion>
<Annotation>
<AnnotationProperty IRI="#wheels"/>
<Literal datatypeIRI="&rdf;PlainLiteral">4</Literal>
</Annotation>
<ObjectProperty IRI="#has-type"/>
<NamedIndividual IRI="#bmw-x5"/>
<NamedIndividual IRI="#car"/>
</ObjectPropertyAssertion>
如果掌握了對象屬性斷言公理,則可以使用以下注釋:
OWLObjectAssertionAxiom axiom = ...
for(OWLAnnotation a: axiom.getAnnotations()) {
// this cycle will go over all annotations, with annotation property and annotation value
}
為了訪問特定個體的所有對象屬性聲明公理,可以使用:
Set<OWLObjectAssertionAxiom> set = ontology.getObjectPropertyAssertionAxioms(individual);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.