如何使用OWLAPI从猫头鹰个人那里获取注释 [英] How to get annotations from owl individual using OWLAPI

查看:202
本文介绍了如何使用OWLAPI从猫头鹰个人那里获取注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经知道如何从OWL类中获取注释(请参见下面的Java代码).但是我无法从OWL个人那里获得注释.有人可以告诉我如何为OWLIndividual而不是OWLClass编码相同的功能吗?谢谢!

I already know how to get annotations from OWL classes (see the java code below). But I'm not able to get annotations from OWL individuals. Could anybody please tell me how to code the same functionality for an OWLIndividual instead of an OWLClass? Thankyou!

IRI iri = IRI.create("http://www.example.com/ontology/108024893-n"); //class IRI
OWLClass clazz = manager.getOWLDataFactory().getOWLClass(iri);

for (OWLAnnotation annotation : clazz.getAnnotations(ontology)) 
{
  System.out.println("\nannotation value: "+annotation.getValue());
}

推荐答案

一般的解决方案是使用OWLOntology.getAnnotationAssertionAxioms(OWLAnnotationSubject)

A general solution is to use OWLOntology.getAnnotationAssertionAxioms(OWLAnnotationSubject)

它适用于实体和匿名个人.

It works with entities and anonymous individuals.

这篇关于如何使用OWLAPI从猫头鹰个人那里获取注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆