[英]OWLAPI: Get the IRI in a AnnotationAssertion
我有一个像这样的 .owl 文件:
...
<ClassAssertion>
<Class IRI="http://timbus.teco.edu/ontologies/DIO.owl#BusinessProcess"/>
<NamedIndividual IRI="#bf1badca"/>
</ClassAssertion>
...
<AnnotationAssertion>
<AnnotationProperty abbreviatedIRI="rdfs:label"/>
<IRI>#bf1badca</IRI>
<Literal datatypeIRI="http://www.w3.org/2001/XMLSchema#string">Remove_old_books</Literal>
</AnnotationAssertion>
我想得到的是在注释断言 (#bf1badca) 中声明的命名个人 IRI 的类名 (BusinessProcess)
我有以下代码可以访问注释中的文字值:
OWLOntologyWalker walker = new OWLOntologyWalker(Collections.singleton(ontology));
OWLOntologyWalkerVisitor visitor = new OWLOntologyWalkerVisitor(walker) {
@Override
public void visit(OWLAnnotationAssertionAxiom axiom) {
OWLLiteral val = (OWLLiteral)axiom.getValue();
System.out.println(val.getLiteral());
// Prints 'Remove_old_books'
}
};
如何访问注释断言的IRI 字段,即#bf1badca 值?
IRI 字段是注释公理的主题,可以使用getSubject()
方法检索。
您可以使用OWLDataFactory
并调用getOWLNamedIndividual()
来获取匹配的OWLIndividual
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.