我有一个像这样的.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>
我想得到的是在注释断言中声明的命名个体IRI的类名(BusinessProcess)(#bf1badca)
我有以下代码可以访问注释中文字的值:
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?
答案 0 :(得分:1)
IRI字段是注释公理的主题,可以使用getSubject()
方法检索。
您可以使用OWLIndividual
并致电OWLDataFactory
来获取匹配的getOWLNamedIndividual()
。