Java 类org.semanticweb.owlapi.model.OWLAnnotation 实例源码

项目:OntoBench    文件:RdfsCommentFeature.java   
@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);
}
项目:OntoBench    文件:RdfsLabelMultiLanguageFeature.java   
@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);
}
项目:OntoBench    文件:RdfsCommentMultiLanguageFeature.java   
@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);
}
项目:onagui    文件:DOEOWLContainer.java   
@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;
}
项目:onagui    文件:DOEOWLContainer.java   
@Override
public Set<String> getPrefLabels(OWLEntity cpt, String lang) {
    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();
                if((literal.hasLang() && literal.getLang().toLowerCase().equals(lang.toLowerCase()))
                        // ou si il n'y en a pas et que c'est voulu
                        || (!literal.hasLang() && lang.equals(""))) { 

                    finalLabels.add(literal.getLiteral());
                }
            }
        }
    }
    return finalLabels;
}
项目:onagui    文件:DOEOWLContainer.java   
@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;
}
项目:onagui    文件:DOEOWLContainer.java   
@Override
public Set<String> getAltLabels(OWLEntity cpt, String lang) {
    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();
                if((literal.hasLang() && literal.getLang().toLowerCase().equals(lang.toLowerCase()))
                        // ou si il n'y en a pas et que c'est voulu
                        || (!literal.hasLang() && lang.equals(""))) { 

                    finalLabels.add(literal.getLiteral());
                }
            }
        }
    }
    return finalLabels;
}
项目:onagui    文件:OWLAPIContainer.java   
@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;
}
项目:onagui    文件:OWLAPIContainer.java   
@Override
public Set<String> getAltLabels(OWLEntity cpt, String lang) {
    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) {
            OWLLiteral literal = (OWLLiteral)annot.getValue();
            // Si il y a une langue et que c'est celle en parametre
            if((literal.hasLang() && literal.getLang().toLowerCase().equals(lang.toLowerCase()))
                    // ou si il n'y en a pas et que c'est voulu
                    || (!literal.hasLang() && lang.equals(""))) { 

                String label = literal.getLiteral();
                finalLabels.add(label);
            }
        }
    }
    return finalLabels;
}
项目:minerva    文件:GafToLegoIndividualTranslator.java   
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;
}
项目:born    文件:AnnotationProcessor.java   
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() + "'.");

    }
}
项目:owltools    文件:Mooncat.java   
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));
        }
    }
}
项目:owltools    文件:OntologyMetadataMarkdownWriter.java   
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;
}
项目:owltools    文件:GetLabelsTest.java   
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;
}
项目:minerva    文件:CoreMolecularModelManager.java   
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);
}
项目:minerva    文件:CoreMolecularModelManager.java   
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);
                }
            });
        }
    }
}
项目:owltools    文件:OntologyMetadata.java   
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));
    }
}
项目:owltools    文件:ModelAnnotationSolrDocumentLoader.java   
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;
}
项目:minerva    文件:CoreMolecularModelManager.java   
OWLObjectPropertyAssertionAxiom updateAnnotation(ModelContainer model, 
        OWLObjectPropertyAssertionAxiom toModify, OWLAnnotation update,
        METADATA metadata) {
    OWLObjectPropertyAssertionAxiom newAxiom = null;
    if (toModify != null) {
        Set<OWLAnnotation> combindedAnnotations = new HashSet<OWLAnnotation>();
        OWLAnnotationProperty target = update.getProperty();
        for(OWLAnnotation existing : toModify.getAnnotations()) {
            if (target.equals(existing.getProperty()) == false) {
                combindedAnnotations.add(existing);
            }
        }
        combindedAnnotations.add(update);
        newAxiom = modifyAnnotations(toModify, combindedAnnotations, model, metadata);
    }
    return newAxiom;
}
项目:minerva    文件:MolecularModelManager.java   
/**
 * Convenience wrapper for {@link CoreMolecularModelManager#addFact}
 * 
 * @param modelId
 * @param vocabElement
 * @param iid
 * @param jid
 * @param annotations
 * @param metadata
 * @return relevant individuals
 * @throws UnknownIdentifierException
 */
public List<OWLNamedIndividual> addFact(IRI modelId, OBOUpperVocabulary vocabElement,
        String iid, String jid, Set<OWLAnnotation> annotations, METADATA metadata) throws UnknownIdentifierException {
    ModelContainer model = checkModelId(modelId);
    OWLObjectPropertyExpression property = getObjectProperty(vocabElement, model);
    if (property == null) {
        throw new UnknownIdentifierException("Could not find a individual for id: "+vocabElement);
    }
    OWLNamedIndividual individual1 = getIndividual(iid, model);
    if (individual1 == null) {
        throw new UnknownIdentifierException("Could not find a individual for id: "+iid);
    }
    OWLNamedIndividual individual2 = getIndividual(jid, model);
    if (individual2 == null) {
        throw new UnknownIdentifierException("Could not find a individual for id: "+jid);
    }
    addFact(model, property, individual1, individual2, annotations, metadata);
    return Arrays.asList(individual1, individual2);
}
项目:minerva    文件:BlazegraphMolecularModelManagerTest.java   
/**
 * Test the process that adds some individuals, saves them and then loads them back into the model. 
 * @param m3
 * @param model
 * @throws Exception
 */
private void testModelSaveLoad(BlazegraphMolecularModelManager<Void> m3, ModelContainer model) throws Exception {   
    IRI modelID = model.getModelId();
    final OWLObjectProperty partOf = m3.getOntology().getOWLOntologyManager().
            getOWLDataFactory().getOWLObjectProperty(curieHandler.getIRI("BFO:0000050"));
    OWLNamedIndividual i1 = m3.createIndividualWithIRI(model, curieHandler.getIRI("GO:0000001"), null, null);
    OWLNamedIndividual i2 = m3.createIndividualWithIRI(model, curieHandler.getIRI("GO:0000002"), null, null);

    m3.addFact(model, partOf, i1, i2, Collections.<OWLAnnotation>emptySet(), null);
    m3.saveModel(model, null, null);
    m3.unlinkModel(modelID);

    /* getModel internally calls the loadModel method */
    model = m3.getModel(modelID);
    Collection<OWLNamedIndividual> loaded = m3.getIndividuals(model.getModelId());
    assertTrue(loaded.contains(i1));
    assertTrue(loaded.contains(i2));
}
项目:owltools    文件:TemplatedTransformer.java   
public Set<Mapping> getMappings() {
    Set<Mapping> ms = new HashSet<Mapping>();
    OWLAnnotationProperty vap = getVariableAnnotationProperty();
    for (OWLSubClassOfAxiom sca : ontology.getAxioms(AxiomType.SUBCLASS_OF, Imports.INCLUDED)) {
        Mapping m = new Mapping();
        Set<OWLAnnotation> anns = sca.getAnnotations(vap);
        for (OWLAnnotation ann : anns) {
            IRI v = (IRI) ann.getValue();
            m.vars.add(v);
        }
        if (m.vars.size() > 0) {
            m.src = sca.getSubClass();
            m.tgt = sca.getSuperClass();
            ms.add(m);
            LOG.info("MAPPING: "+m);
        }
    }
    return ms;

}
项目:UMLS-Terminology-Server    文件:OwlLoaderAlgorithm.java   
/**
 * Returns the attributes.
 *
 * @param owlClass the owl class
 * @param ontology the ontology
 * @return the attributes
 * @throws Exception the exception
 */
private Set<Attribute> getAttributes(OWLClass owlClass, OWLOntology ontology)
  throws Exception {
  Set<Attribute> attributes = new HashSet<>();
  for (final OWLAnnotationAssertionAxiom axiom : ontology
      .getAnnotationAssertionAxioms(owlClass.getIRI())) {

    final OWLAnnotation annotation = axiom.getAnnotation();
    if (isAtomAnnotation(annotation)) {
      continue;
    }
    final Attribute attribute = new AttributeJpa();
    setCommonFields(attribute);
    attribute.setName(atnMap.get(getName(annotation)).getAbbreviation());
    attribute.setValue(getValue(annotation));
    generalEntryValues.add(attribute.getName());
    attributes.add(attribute);
  }
  return attributes;
}
项目:UMLS-Terminology-Server    文件:OwlLoaderAlgorithm.java   
/**
 * Indicates whether or not atom annotation is the case.
 *
 * @param annotation the annotation
 * @return <code>true</code> if so, <code>false</code> otherwise
 * @throws Exception the exception
 */
private boolean isAtomAnnotation(OWLAnnotation annotation) throws Exception {
  String name = getName(annotation);
  if (name.equals(label)) {
    return true;
  }

  String atomAnnotations =
      getConfigurableValue(getTerminology(), "atomAnnotations");
  if (atomAnnotations != null) {
    for (final String field : FieldedStringTokenizer.split(atomAnnotations,
        ",")) {
      if (name.equals(field)) {
        return true;
      }
    }
  } else {
    logWarn("  NO atom annotations are specifically declared, "
        + "just using rdfs:label and rdfs:comment");
  }

  return false;
}
项目:UMLS-Terminology-Server    文件:OwlLoaderAlgorithm.java   
/**
 * Indicates whether or not definition annotation is the case.
 *
 * @param annotation the annotation
 * @return <code>true</code> if so, <code>false</code> otherwise
 * @throws Exception the exception
 */
private boolean isDefinitionAnnotation(OWLAnnotation annotation)
  throws Exception {
  String name = getName(annotation);
  String atomAnnotations =
      getConfigurableValue(getTerminology(), "definitionAnnotations");
  if (atomAnnotations != null) {
    for (final String field : FieldedStringTokenizer.split(atomAnnotations,
        ",")) {
      if (name.equals(field)) {
        return true;
      }
    }
  }
  return false;
}
项目:owltools    文件:ModelAnnotationSolrDocumentLoader.java   
private Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> findLocations(OWLNamedIndividual mf) {
    Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> result = new HashMap<OWLClass, Pair<OWLNamedIndividual,Set<OWLAnnotation>>>();
    Set<OWLObjectPropertyAssertionAxiom> axioms = model.getObjectPropertyAssertionAxioms(mf);
    for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
        if (occursIn.equals(axiom.getProperty()) && mf.equals(axiom.getSubject())) {
            // relevant axiom
            OWLIndividual locationCandidate = axiom.getObject();
            if (locationCandidate.isNamed()) {
                OWLNamedIndividual named = locationCandidate.asOWLNamedIndividual();
                Set<OWLClass> locationTypes = getTypes(named);
                for (OWLClass locationType : locationTypes) {
                    result.put(locationType, Pair.of(named, getAnnotations(axiom, named)));
                }
            }
        }
    }
    return result;
}
项目:pronto    文件:PKBXMLSerializer.java   
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();
        }
    }
}
项目:logmap-matcher    文件:OWLAlignmentReader.java   
private void treatAnnotation(OWLAnnotation ann){

    String property = ann.getProperty().getIRI().toString().toLowerCase();

    if (property.contains(MappingsReader.ENTITY1)){
        ann.getValue().accept(valueVisitor);
        iri1 = valueVisitor.getStringLiteral();
    }
    else if (property.contains(MappingsReader.ENTITY2)){
        ann.getValue().accept(valueVisitor);
        iri2 = valueVisitor.getStringLiteral();
    }
    else if (property.contains(MappingsReader.MEASURE)){
        ann.getValue().accept(valueVisitor); //It also sets value
    }
    else if (property.contains(MappingsReader.RELATION)){
        ann.getValue().accept(valueVisitor); //It also sets value
    }


}
项目:OntoBench    文件:OwlDeprecatedClassFeature.java   
@Override
public void addToOntology() {
  OWLClass owlClass = featurePool.getExclusiveClass(":DeprecatedClass");
  OWLAxiom axiom = factory.getOWLDeclarationAxiom(owlClass);
  addAxiomToOntology(axiom);

  OWLAnnotation annotation = factory.getOWLAnnotation(factory.getOWLDeprecated(), factory.getOWLLiteral(true));
  OWLAxiom annotationAxiom = factory.getOWLAnnotationAssertionAxiom(owlClass.getIRI(), annotation);
  addAxiomToOntology(annotationAxiom);
}
项目:OntoBench    文件:OwlDeprecatedPropertyFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":DeprecatedProperty");
  addToGenericDomainAndNewRange(property, featurePool.getExclusiveClass(":DeprecatedPropertyRange"));

  OWLAnnotation annotation = factory.getOWLAnnotation(factory.getOWLDeprecated(), factory.getOWLLiteral(true));
  OWLAxiom deprecatedAxiom = factory.getOWLAnnotationAssertionAxiom(property.getIRI(), annotation);
  addAxiomToOntology(deprecatedAxiom);
}
项目:OntoBench    文件:DcIdentifierFeature.java   
@Override
public void addToOntology() {
  OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "identifier"));

  Optional<IRI> optionalIri = ontology.getOntologyID().getOntologyIRI();
  if (optionalIri.isPresent()) {
    String iri = optionalIri.get().toString();
    OWLAnnotation identifier = factory.getOWLAnnotation(property, factory.getOWLLiteral(iri));

    addChangeToOntology(new AddOntologyAnnotation(ontology, identifier));
  }
}
项目:OntoBench    文件:DcContributorFeature.java   
@Override
public void addToOntology() {
  OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "contributor"));
  OWLAnnotation contributor = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getContributor()));

  addChangeToOntology(new AddOntologyAnnotation(ontology, contributor));
}
项目:OntoBench    文件:DcDescriptionFeature.java   
@Override
public void addToOntology() {
  OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "description"));
  OWLAnnotation description = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getDescription()));

  addChangeToOntology(new AddOntologyAnnotation(ontology, description));
}
项目:OntoBench    文件:DcDateFeature.java   
@Override
public void addToOntology() {
  OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "date"));
  OWLAnnotation date = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getGenerationDate()));

  addChangeToOntology(new AddOntologyAnnotation(ontology, date));
}
项目:OntoBench    文件:DcTitleFeature.java   
@Override
public void addToOntology() {
  OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "title"));
  OWLAnnotation title = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getTitle()));

  addChangeToOntology(new AddOntologyAnnotation(ontology, title));
}
项目:OntoBench    文件:DcPublisherFeature.java   
@Override
public void addToOntology() {
  OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "publisher"));
  OWLAnnotation publisher = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getCreator()));

  addChangeToOntology(new AddOntologyAnnotation(ontology, publisher));
}
项目:OntoBench    文件:DcCreatorFeature.java   
@Override
public void addToOntology() {
  OWLAnnotationProperty property = factory.getOWLAnnotationProperty(IRI.create(Namespaces.DC + "creator"));
  OWLAnnotation creator = factory.getOWLAnnotation(property, factory.getOWLLiteral(ontologyConstants.getCreator()));

  addChangeToOntology(new AddOntologyAnnotation(ontology, creator));
}
项目:OntoBench    文件:RdfsLabelFeature.java   
@Override
public void addToOntology() {
  OWLObjectProperty property = featurePool.getExclusiveProperty(":propertyWithInfos");
  OWLClass range = featurePool.getExclusiveClass(":ClassWithInfos");
  OWLAnnotationProperty label = factory.getRDFSLabel();

  OWLAnnotation pA = factory.getOWLAnnotation(label, factory.getOWLLiteral("Label of a property (undefined language)"));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(property.getIRI(), pA));

  OWLAnnotation cA = factory.getOWLAnnotation(label, factory.getOWLLiteral("Label of a class (undefined language)"));
  addAxiomToOntology(factory.getOWLAnnotationAssertionAxiom(range.getIRI(), cA));

  addToGenericDomainAndNewRange(property, range);
}
项目:OntoBench    文件:RdfsSeeAlsoFeature.java   
@Override
public void addToOntology() {
  OWLAnnotationProperty annotationProperty = factory.getOWLAnnotationProperty(RDFS_SEE_ALSO, pm);
  OWLAnnotation annotation = factory.getOWLAnnotation(annotationProperty, IRI.create(requestInformation.getGeneratorIri()));

  addChangeToOntology(new AddOntologyAnnotation(ontology, annotation));
}
项目:OntoBench    文件:RdfsLabelOnOntologyFeature.java   
@Override
public void addToOntology() {
  OWLLiteral titleLiteral = factory.getOWLLiteral(ontologyConstants.getTitle());
  OWLAnnotation title = factory.getOWLAnnotation(factory.getRDFSLabel(), titleLiteral);

  addChangeToOntology(new AddOntologyAnnotation(ontology, title));
}