本文整理匯總了Java中org.semanticweb.owlapi.model.OWLDataFactory.getOWLAnnotationAssertionAxiom方法的典型用法代碼示例。如果您正苦於以下問題:Java OWLDataFactory.getOWLAnnotationAssertionAxiom方法的具體用法?Java OWLDataFactory.getOWLAnnotationAssertionAxiom怎麽用?Java OWLDataFactory.getOWLAnnotationAssertionAxiom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.semanticweb.owlapi.model.OWLDataFactory
的用法示例。
在下文中一共展示了OWLDataFactory.getOWLAnnotationAssertionAxiom方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseRow
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private void parseRow(String[] row) {
OWLDataFactory df = graph.getDataFactory();
OWLOntologyManager mgr = graph.getManager();
String geneSetId = row[0];
IRI geneSetIRI = IRI.create(prefix + geneSetId);
String desc = row[1];
OWLClass geneSetCls = df.getOWLClass(geneSetIRI);
OWLAxiom ax = df.getOWLAnnotationAssertionAxiom(df.getRDFSLabel(),geneSetIRI, literal(desc));
mgr.addAxiom(graph.getSourceOntology(), ax);
// assume each value is an entity, e.g. gene
for (int i=2; i < row.length; i++) {
OWLNamedIndividual individual = df.getOWLNamedIndividual(IRI.create(prefix + row[i]));
mgr.addAxiom(graph.getSourceOntology(), df.getOWLClassAssertionAxiom(geneSetCls, individual));
}
}
示例2: synonym
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Add an synonym annotation, plus an annotation on that annotation
* that specified the type of synonym. The second annotation has the
* property oio:hasSynonymType.
*
* @param ontology the current ontology
* @param subject the subject of the annotation
* @param type the IRI of the type of synonym
* @param property the IRI of the annotation property.
* @param value the literal value of the synonym
* @return the synonym annotation axiom
*/
protected static OWLAnnotationAssertionAxiom synonym(
OWLOntology ontology, OWLEntity subject,
OWLAnnotationValue type,
OWLAnnotationProperty property,
OWLAnnotationValue value) {
OWLOntologyManager manager = ontology.getOWLOntologyManager();
OWLDataFactory dataFactory = manager.getOWLDataFactory();
OWLAnnotationProperty hasSynonymType =
dataFactory.getOWLAnnotationProperty(
format.getIRI("oio:hasSynonymType"));
OWLAnnotation annotation =
dataFactory.getOWLAnnotation(hasSynonymType, type);
Set<OWLAnnotation> annotations = new HashSet<OWLAnnotation>();
annotations.add(annotation);
OWLAnnotationAssertionAxiom axiom =
dataFactory.getOWLAnnotationAssertionAxiom(
property, subject.getIRI(), value,
annotations);
manager.addAxiom(ontology, axiom);
return axiom;
}
示例3: labelAxiom
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private OWLAxiom labelAxiom(OWLDataFactory f, OWLNamedIndividual individual, String annLabel) {
return
f.getOWLAnnotationAssertionAxiom(
f.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
individual.getIRI(),
f.getOWLLiteral(annLabel));
}
示例4: addLabel
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public static void addLabel(OWLNamedIndividual i, OWLGraphWrapper g, OWLReasoner reasoner) {
OWLOntology ontology = g.getSourceOntology();
Set<OWLClass> types = new HashSet<>();
if (reasoner == null) {
for (OWLClassExpression x : OwlHelper.getTypes(i, ontology)) {
if (!x.isAnonymous()) {
types.add((OWLClass) x);
}
}
}
else {
types = reasoner.getTypes(i, true).getFlattened();
}
StringBuffer iLabel = null;
for (OWLClass type : types) {
String label = g.getLabel(type);
if (iLabel == null)
iLabel = new StringBuffer("a");
else
iLabel.append(" & ");
iLabel.append(" "+label);
}
OWLDataFactory df = g.getDataFactory();
OWLAxiom ax =
df.getOWLAnnotationAssertionAxiom(df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
i.getIRI(),
df.getOWLLiteral(iLabel.toString()));
g.getManager().addAxiom(ontology,
ax);
}
示例5: annotate
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Convenience method for adding an annotation assertion to the
* ontology.
*
* @param ontology the current ontology
* @param subject the subject of the annotation
* @param property the annotation property
* @param value the annotation value
* @return the annotation axiom
*/
protected static OWLAnnotationAssertionAxiom annotate(
OWLOntology ontology,
OWLEntity subject,
OWLAnnotationProperty property,
OWLAnnotationValue value) {
OWLOntologyManager manager = ontology.getOWLOntologyManager();
OWLDataFactory dataFactory = manager.getOWLDataFactory();
OWLAnnotationAssertionAxiom axiom =
dataFactory.getOWLAnnotationAssertionAxiom(
property, subject.getIRI(), value);
manager.addAxiom(ontology, axiom);
return axiom;
}