我想将 rdfs:label
添加到 OWLIndividual
,我有以下内容:
OWLIndividual newIndividual = factory.getOWLNamedIndividual(IRI.create(name));
OWLLiteral lbl = factory.getOWLLiteral(name);
OWLAnnotation label =
factory.getOWLAnnotation(
factory.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()), lbl);
现在,我如何才能将标签与个人关联起来?
最佳答案
您可以通过以下方式关联标签:
OWLAxiom axiom = factory.getOWLAnnotationAssertionAxiom(newIndividual.asOWLNamedIndividual().getIRI(), label);
manager.applyChange(new AddAxiom(ontology, axiom));
在这种情况下,您需要使用 NamedIndividual
来检索 IRI 来断言注释。
关于semantic-web - 如何添加rdfs :label to OWLIndividual via OWLAPI?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17902623/