本文整理汇总了Java中org.semanticweb.owlapi.model.OWLAnnotation类的典型用法代码示例。如果您正苦于以下问题:Java OWLAnnotation类的具体用法?Java OWLAnnotation怎么用?Java OWLAnnotation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OWLAnnotation类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLAnnotation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addToOntology
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
@Override
public void addToOntology() {
OWLObjectProperty property = featurePool.getExclusiveProperty(":propertyWithInfos");
OWLClass range = featurePool.getExclusiveClass(":ClassWithInfos");
OWLLiteral label = factory.getOWLLiteral("Comment of a property (undefined language)");
OWLAnnotationProperty comment = factory.getRDFSComment();
OWLAnnotation pA = factory.getOWLAnnotation(comment, label);
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), pA));
OWLAnnotation cA = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Comment of a class (undefined language)"));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), cA));
addToGenericDomainAndNewRange(property, range);
}
示例2: createIndividualInternal
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
private static Pair<OWLNamedIndividual, Set<OWLAxiom>> createIndividualInternal(IRI iri, OWLOntology abox, OWLClassExpression ce, Set<OWLAnnotation> annotations) {
LOG.info("Generating individual for IRI: "+iri);
OWLDataFactory f = abox.getOWLOntologyManager().getOWLDataFactory();
OWLNamedIndividual i = f.getOWLNamedIndividual(iri);
// create axioms
Set<OWLAxiom> axioms = new HashSet<OWLAxiom>();
// declaration
axioms.add(f.getOWLDeclarationAxiom(i));
// annotation assertions
if(annotations != null) {
for(OWLAnnotation annotation : annotations) {
axioms.add(f.getOWLAnnotationAssertionAxiom(iri, annotation));
}
}
if (ce != null) {
OWLClassAssertionAxiom typeAxiom = createType(f, i, ce);
if (typeAxiom != null) {
axioms.add(typeAxiom);
}
}
return Pair.of(i, axioms);
}
示例3: addToOntology
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
@Override
public void addToOntology() {
OWLObjectProperty property = featurePool.getExclusiveProperty(":propertyWithInfos");
OWLClass range = featurePool.getExclusiveClass(":ClassWithInfos");
OWLAnnotationProperty label = factory.getRDFSLabel();
OWLAnnotation enAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Label of a property", Locale.ENGLISH.getLanguage()));
OWLAnnotation deAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Bezeichnung einer Property", Locale.GERMAN.getLanguage()));
OWLAnnotation jpAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("プロパティの指定", Locale.JAPANESE.getLanguage()));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), deAnnotation));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), enAnnotation));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), jpAnnotation));
OWLAnnotation enClassAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Label of a class", Locale.ENGLISH.getLanguage()));
OWLAnnotation deClassAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("Bezeichnung einer Klasse", Locale.GERMAN.getLanguage()));
OWLAnnotation jpClassAnnotation = factory.getOWLAnnotation(label, factory.getOWLLiteral("どうもありがとうミスターロボット", Locale.JAPANESE.getLanguage()));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), enClassAnnotation));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), deClassAnnotation));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), jpClassAnnotation));
addToGenericDomainAndNewRange(property, range);
}
示例4: addToOntology
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
@Override
public void addToOntology() {
OWLObjectProperty property = featurePool.getExclusiveProperty(":propertyWithInfos");
OWLClass range = featurePool.getExclusiveClass(":ClassWithInfos");
OWLAnnotationProperty comment = factory.getRDFSComment();
OWLAnnotation enAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Comment of a property", Locale.ENGLISH.getLanguage()));
OWLAnnotation deAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Kommentar einer Property", Locale.GERMAN.getLanguage()));
OWLAnnotation jpAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("プロパティのコメント", Locale.JAPANESE.getLanguage()));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), deAnnotation));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), enAnnotation));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), jpAnnotation));
OWLAnnotation enClassAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Comment of a class", Locale.ENGLISH.getLanguage()));
OWLAnnotation deClassAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("Kommentar einer Klasse", Locale.GERMAN.getLanguage()));
OWLAnnotation jpClassAnnotation = factory.getOWLAnnotation(comment, factory.getOWLLiteral("どうもありがとうミスターロボット", Locale.JAPANESE.getLanguage()));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), enClassAnnotation));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), deClassAnnotation));
addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), jpClassAnnotation));
addToGenericDomainAndNewRange(property, range);
}
示例5: getPrefLabels
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
@Override
public Set<String> getPrefLabels(OWLEntity cpt) {
Set<String> finalLabels = new HashSet<String>();
Set<OWLAnnotation> annotations = cpt.getAnnotations(ontology);
for(OWLAnnotation annot : annotations) {
if(annot.getValue() instanceof OWLLiteral) {
OWLAnnotationProperty prop = annot.getProperty();
// The DOE prefLabel, if they exist
if(prop.getIRI().equals(prefLabelIRI) ||
prop.getIRI().equals(SKOSVocabulary.PREFLABEL.getIRI()) ||
prop.getIRI().equals(OWLRDFVocabulary.RDFS_LABEL.getIRI())) {
OWLLiteral literal = (OWLLiteral)annot.getValue();
finalLabels.add(literal.getLiteral());
}
}
}
return finalLabels;
}
示例6: getAltLabels
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
@Override
public Set<String> getAltLabels(OWLEntity cpt) {
Set<String> finalLabels = new HashSet<String>();
Set<OWLAnnotation> annotations = cpt.getAnnotations(ontology);
for(OWLAnnotation annot : annotations) {
if(annot.getValue() instanceof OWLLiteral) {
OWLAnnotationProperty prop = annot.getProperty();
// The DOE prefLabel, if they exist
if(prop.getIRI().equals(altLabelIRI) ||
prop.getIRI().equals(hiddenLabelIRI) ||
prop.getIRI().equals(SKOSVocabulary.ALTLABEL.getIRI()) ||
prop.getIRI().equals(SKOSVocabulary.HIDDENLABEL.getIRI())) {
OWLLiteral literal = (OWLLiteral)annot.getValue();
finalLabels.add(literal.getLiteral());
}
}
}
return finalLabels;
}
示例7: getAltLabels
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
@Override
public Set<String> getAltLabels(OWLEntity cpt) {
if(cpt == null)
throw new IllegalArgumentException("cpt cannot be null");
// The rdfs:label, if it exists
Set<String> finalLabels = new HashSet<String>();
Set<OWLAnnotation> annotations = cpt.getAnnotations(
ontology,
df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()));
for(OWLAnnotation annot : annotations) {
if(annot.getValue() instanceof OWLLiteral) {
finalLabels.add(((OWLLiteral)annot.getValue()).getLiteral());
}
}
return finalLabels;
}
示例8: addBioentityCls
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
private OWLClass addBioentityCls(String id, String lbl, String taxon, Set<OWLAxiom> axioms, OWLDataFactory f) throws UnknownIdentifierException {
IRI iri = curieHandler.getIRI(id);
OWLClass cls = f.getOWLClass(iri);
boolean add = axioms.add(f.getOWLDeclarationAxiom(cls));
if (add) {
OWLAnnotation annotation = f.getOWLAnnotation(f.getRDFSLabel(), f.getOWLLiteral(lbl));
axioms.add(f.getOWLAnnotationAssertionAxiom(iri, annotation));
if (taxon != null) {
OWLClass taxonClass = f.getOWLClass(curieHandler.getIRI(taxon));
axioms.add(f.getOWLDeclarationAxiom(taxonClass));
axioms.add(f.getOWLSubClassOfAxiom(cls,
f.getOWLObjectSomeValuesFrom(inTaxon, taxonClass)));
}
}
return cls;
}
示例9: reg
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
Set<OWLAnnotation> reg(Set<OWLAnnotation> annotations) {
Objects.requireNonNull(annotations);
if (annotations.isEmpty()) {
return Collections.emptySet();
} else if (annotations.size() == 1) {
OWLAnnotation annotation = annotations.iterator().next();
String varName = VARIABLE_PREFIX + this.network.keySet().size();
this.variableOrder.add(varName);
String annotStr = asString(annotation.getValue());
this.network.put(varName, annotStr);
OWLAnnotationValue value = this.df.getOWLLiteral(varName);
OWLAnnotation newAnnotation = this.df.getOWLAnnotation(annotation.getProperty(), value);
return Collections.singleton(newAnnotation);
} else {
throw new IllegalArgumentException(
"Unexpected number of annotations. The OWL axiom can have at most 1 annotation. Annotations: '"
+ annotations.toString() + "'.");
}
}
示例10: removeDirectives
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
private void removeDirectives() {
// TODO decide: move the set of directives into a constant/static collection?
Set<IRI> directivesIRIs = new HashSet<IRI>();
directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_LogicalDefinitionViewRelation.getIRI());
directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsEquivalent.getIRI());
directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsGenusDifferentia.getIRI());
directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsHasSubClass.getIRI());
directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsIsA.getIRI());
directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsRelationship.getIRI());
directivesIRIs.add(Obo2OWLVocabulary.IRI_OIO_treatXrefsAsReverseGenusDifferentia.getIRI());
OWLOntology o = graph.getSourceOntology();
for(OWLAnnotation ann : o.getAnnotations()) {
final OWLAnnotationProperty property = ann.getProperty();
if (directivesIRIs.contains(property.getIRI())) {
manager.applyChange(new RemoveOntologyAnnotation(o, ann));
}
}
}
示例11: getVals
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
private static Set<String> getVals(String p, Set<OWLAnnotation> oAnns) {
Set<OWLAnnotation> rmAnns = new HashSet<OWLAnnotation>();
Set<String> vs = new HashSet<String>();
System.err.println(" L: "+p);
for (OWLAnnotation ann : oAnns) {
String ps = ann.getProperty().getIRI().toString();
ps = ps.replaceAll(".*/", "");
if (ps.equals(p)) {
String v = (ann.getValue() instanceof OWLLiteral) ? ((OWLLiteral)ann.getValue()).getLiteral() : ann.getValue().toString();
//String v = ann.getValue().toString();
vs.add(v);
System.err.println(" P: "+ps+"="+v);
rmAnns.add(ann);
}
}
oAnns.removeAll(rmAnns);
return vs;
}
示例12: getLabel
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
private String getLabel(OWLEntity obj) throws MultiLabelException {
String label = null;
OWLAnnotationProperty labelProperty = ont.getOWLOntologyManager().getOWLDataFactory().getRDFSLabel();
for (OWLAnnotation ann : OwlHelper.getAnnotations(obj, labelProperty, ont)) {
if (ann.getProperty().isLabel()) {
OWLAnnotationValue v = ann.getValue();
if (v instanceof OWLLiteral) {
if (label != null) {
throw new MultiLabelException(obj);
}
label = ((OWLLiteral)v).getLiteral();
}
}
}
return label;
}
示例13: extractEvidenceIRIValues
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
private static void extractEvidenceIRIValues(OWLAnnotation annotation, final Set<IRI> iriSet) {
if (annotation != null) {
OWLAnnotationProperty property = annotation.getProperty();
if (HAS_EVIDENCE_IRI.equals(property.getIRI()) || HAS_EVIDENCE_IRI_OLD.equals(property.getIRI())){
annotation.getValue().accept(new OWLAnnotationValueVisitor() {
@Override
public void visit(OWLLiteral literal) {
// ignore
}
@Override
public void visit(OWLAnonymousIndividual individual) {
// ignore
}
@Override
public void visit(IRI iri) {
iriSet.add(iri);
}
});
}
}
}
示例14: OntologyMetadata
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
public OntologyMetadata(OWLOntology ont) {
super();
OWLOntologyID id = ont.getOntologyID();
if (id.getOntologyIRI().isPresent())
ontologyIRI = id.getOntologyIRI().get().toString();
if (id.getVersionIRI().isPresent())
versionIRI = id.getVersionIRI().get().toString();
importDirectives = new HashSet<String>();
for (OWLImportsDeclaration oid : ont.getImportsDeclarations()) {
importDirectives.add(oid.getIRI().toString());
}
classCount = ont.getClassesInSignature().size();
namedIndividualCount = ont.getIndividualsInSignature().size();
axiomCount = ont.getAxiomCount();
annotations = new HashSet<OntologyAnnotation>();
for (OWLAnnotation ann : ont.getAnnotations()) {
annotations.add(new OntologyAnnotation(ann));
}
}
示例15: renderAnnotations
import org.semanticweb.owlapi.model.OWLAnnotation; //导入依赖的package包/类
private Map<String,String> renderAnnotations(Set<OWLAnnotation> annotations) {
Map<String,String> result = null;
if (annotations != null && !annotations.isEmpty()) {
for (OWLAnnotation annotation : annotations) {
OWLAnnotationProperty prop = annotation.getProperty();
String literal = getLiteralValue(annotation.getValue());
if (literal != null) {
if (result == null) {
result = new HashMap<String, String>();
}
result.put(prop.toStringID(), literal);
}
}
}
return result;
}