本文整理匯總了Java中org.semanticweb.owlapi.model.OWLDataFactory.getOWLAnnotation方法的典型用法代碼示例。如果您正苦於以下問題:Java OWLDataFactory.getOWLAnnotation方法的具體用法?Java OWLDataFactory.getOWLAnnotation怎麽用?Java OWLDataFactory.getOWLAnnotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.semanticweb.owlapi.model.OWLDataFactory
的用法示例。
在下文中一共展示了OWLDataFactory.getOWLAnnotation方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addBioentityCls
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的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;
}
示例2: addPTBoxConstraints
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected void addPTBoxConstraints(OWLOntology ontology, PTBox ptbox,
OWLOntologyManager manager, OWLDataFactory factory) {
ConceptConverter converter = new ConceptConverter(ptbox.getClassicalKnowledgeBase(), factory);
for (ConditionalConstraint cc : ptbox.getDefaultConstraints()) {
OWLAnnotationProperty annProp = factory.getOWLAnnotationProperty( IRI.create(Constants.CERTAINTY_ANNOTATION_URI ));
OWLAnnotationValue annValue = factory.getOWLStringLiteral( cc.getLowerBound() + ";" + cc.getUpperBound() );
OWLAnnotation annotation = factory.getOWLAnnotation( annProp, annValue );
OWLClassExpression clsEv = (OWLClassExpression)converter.convert( cc.getEvidence() );
OWLClassExpression clsCn = (OWLClassExpression)converter.convert( cc.getConclusion() );
OWLAxiom axiom = factory.getOWLSubClassOfAxiom( clsEv, clsCn, Collections.singleton( annotation ) );
try {
manager.applyChange( new AddAxiom(ontology, axiom) );
} catch( OWLOntologyChangeException e ) {
e.printStackTrace();
}
}
}
示例3: addElementLabels
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public static void addElementLabels(OWLOntology ont, File file) throws IOException {
OWLOntologyManager m = OWLManager.createOWLOntologyManager();
OWLDataFactory df = m.getOWLDataFactory();
List<String> lines = FileUtils.readLines(file);
for (String line : lines) {
if (line.startsWith("#"))
continue;
String[] colVals = line.split("\t");
if (colVals.length != 2) {
throw new IOException("Incorrect number of value: "+line);
}
IRI i = getIRIById(colVals[0]);
OWLAnnotation ann = df.getOWLAnnotation(df.getRDFSLabel(), df.getOWLLiteral(colVals[1]));
m.addAxiom(ont, df.getOWLAnnotationAssertionAxiom(i, ann));
}
}
示例4: 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;
}
示例5: addDefaultModelState
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private Set<OWLAnnotation> addDefaultModelState(Set<OWLAnnotation> existing, OWLDataFactory f) {
IRI iri = AnnotationShorthand.modelstate.getAnnotationProperty();
OWLAnnotationProperty property = f.getOWLAnnotationProperty(iri);
OWLAnnotation ann = f.getOWLAnnotation(property, f.getOWLLiteral(defaultModelState));
if (existing == null || existing.isEmpty()) {
return Collections.singleton(ann);
}
existing.add(ann);
return existing;
}
示例6: addPABoxConstraints
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected void addPABoxConstraints(OWLOntology ontology, PABox pabox, KnowledgeBase kb,
OWLOntologyManager manager, OWLDataFactory factory) {
ConceptConverter converter = new ConceptConverter(kb, factory);
for (Map.Entry<ATermAppl, Set<ConditionalConstraint>> entry : pabox.getConstraintsMap().entrySet()) {
for (ConditionalConstraint cc : entry.getValue()) {
OWLAnnotationProperty annProp = factory.getOWLAnnotationProperty( IRI.create( Constants.CERTAINTY_ANNOTATION_URI ));
OWLAnnotationValue annValue = factory.getOWLStringLiteral( cc.getLowerBound() + ";" + cc.getUpperBound() );
OWLAnnotation annotation = factory.getOWLAnnotation( annProp, annValue );
OWLIndividual indiv = factory.getOWLNamedIndividual( IRI.create( entry.getKey().getName()) );
OWLClassExpression clsCn = (OWLClassExpression)converter.convert( cc.getConclusion() );
OWLAxiom axiom = factory.getOWLClassAssertionAxiom( clsCn, indiv, Collections.singleton( annotation ) );
try {
manager.applyChange( new AddAxiom(ontology, axiom) );
} catch( OWLOntologyChangeException e ) {
e.printStackTrace();
}
}
}
}
示例7: getAnnotation
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public OWLAnnotation getAnnotation() {
OWLAnnotationProperty property = annotationPropertySelector.getSelectedObject();
if (property != null){
lastSelectedProperty = property;
OWLDataFactory dataFactory = owlEditorKit.getModelManager().getOWLDataFactory();
OWLAnnotationValue obj = getSelectedEditor().getEditedObject();
if (obj != null) {
return dataFactory.getOWLAnnotation(property, obj);
}
}
return null;
}
示例8: anns
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* make annotations to be placed on axiom
*
* @param df
* @param srcClass
* @param isXrefAnn if true use hasDbXref not source
* @return annotations
*/
private Set<? extends OWLAnnotation> anns(OWLDataFactory df, OWLClass srcClass, boolean isXrefAnn) {
String iri = srcClass.getIRI().toString();
iri = iri.replaceAll(".*/", "");
iri = iri.replaceAll("_", ":");
String pn = "source";
if (isXrefAnn) {
pn = "hasDbXref";
}
OWLAnnotationProperty p = df.getOWLAnnotationProperty(IRI.create("http://www.geneontology.org/formats/oboInOwl#"+pn));
OWLAnnotation ann = df.getOWLAnnotation(p, df.getOWLLiteral(iri));
return Collections.singleton(ann);
}
示例9: addCommentToOntology
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private void addCommentToOntology(OWLOntology ont, String cmt) {
OWLDataFactory df = getDataFactory();
OWLAnnotationProperty p =
df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_COMMENT.getIRI());
OWLLiteral v = df.getOWLLiteral(cmt);
OWLAnnotation ann = df.getOWLAnnotation(p, v);
AddOntologyAnnotation addAnn =
new AddOntologyAnnotation(ont, ann);
getManager().applyChange(addAnn);
}
示例10: annotate
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Convenience method for adding an annotation assertion to the
* ontology itself, taking a CURIE for the property and an Boolean literal.
*
* @param ontology the current ontology
* @param propertyCURIE will be expanded to the full annotation
* property IRI
* @param value the literal value of the annotation
* @return the annotation axiom
*/
protected static OWLAnnotation annotate(OWLOntology ontology,
String propertyCURIE, IRI value) {
OWLOntologyManager manager = ontology.getOWLOntologyManager();
OWLDataFactory dataFactory = manager.getOWLDataFactory();
IRI iri = format.getIRI(propertyCURIE);
OWLAnnotationProperty property =
dataFactory.getOWLAnnotationProperty(iri);
OWLAnnotation annotation = dataFactory.getOWLAnnotation(
property, value);
manager.applyChange(
new AddOntologyAnnotation(ontology, annotation));
return annotation;
}
示例11: translateAnnotation
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
OWLAnnotation translateAnnotation(IntegerAnnotation annotation) {
Objects.requireNonNull(annotation);
OWLDataFactory factory = ontology.getOWLOntologyManager().getOWLDataFactory();
OWLAnnotationProperty owlAnnotationProperty = translator.getTranslationRepository()
.getOWLAnnotationProperty(annotation.getAnnotationProperty());
OWLAnnotationValue owlAnnotationValue = translator.getTranslationRepository()
.getOWLAnnotationValue(annotation.getAnnotationProperty());
OWLAnnotation owlAnnotation = factory.getOWLAnnotation(owlAnnotationProperty, owlAnnotationValue);
return owlAnnotation;
}
示例12: create
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
static OWLAnnotation create(OWLDataFactory f, AnnotationShorthand s, OWLAnnotationValue v) {
final OWLAnnotationProperty p = f.getOWLAnnotationProperty(s.getAnnotationProperty());
return f.getOWLAnnotation(p, v);
}
示例13: createFuzzyAnnotation
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public static OWLAnnotation createFuzzyAnnotation(OWLDataFactory f, double value){
OWLAnnotationProperty fuzzyTag = f.getOWLAnnotationProperty(IRI.create("#fuzzyLabel"));
String fuzzyowl2 = "<fuzzyOwl2 fuzzyType=\"axiom\">\n\t<Degree value=\"" + value + "\"/></fuzzyOwl2>";
OWLLiteral fuzzyLiteral = f.getOWLLiteral(fuzzyowl2);
return f.getOWLAnnotation(fuzzyTag, fuzzyLiteral);
}
示例14: addComment
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private void addComment(String comment, OWLOntology ontology) {
final OWLOntologyManager manager = ontology.getOWLOntologyManager();
final OWLDataFactory factory = manager.getOWLDataFactory();
OWLAnnotation ontAnn = factory.getOWLAnnotation(factory.getRDFSComment(), factory.getOWLLiteral(comment));
manager.applyChange(new AddOntologyAnnotation(ontology, ontAnn));
}