[英]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.