【问题标题】:How to get annotations of object property assertions using OWL API如何使用 OWL API 获取对象属性断言的注释
【发布时间】:2014-10-06 02:10:38
【问题描述】:

假设以下示例(见下图):个体“bmw-x5”具有对象属性断言“has-type car”。此对象属性具有值为“4”的注释属性“wheels”。

使用 OWL API,我设法获得了单独的“bmw-x5”,对象属性断言“hastype car”。我现在被注释属性“轮子”困住了。如何从 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>

【问题讨论】:

    标签: java owl ontology owl-api


    【解决方案1】:

    如果你掌握了一个对象属性断言公理,那么注释可用如下:

    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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-05
      • 2021-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多