如何通过OWLAPI将rdfs:label添加到OWLIndividual?

时间:2013-07-27 21:29:40

标签: semantic-web owl owl-api

我想向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);

现在,我如何将标签与个人联系起来?

1 个答案:

答案 0 :(得分:2)

您可以通过以下方式关联标签:

OWLAxiom axiom = factory.getOWLAnnotationAssertionAxiom(newIndividual.asOWLNamedIndividual().getIRI(), label);
manager.applyChange(new AddAxiom(ontology, axiom));

在这种情况下,您需要使用NamedIndividual来检索IRI以断言注释。