當前位置: 首頁>>代碼示例>>Java>>正文


Java OWLOntology.getAnnotationAssertionAxioms方法代碼示例

本文整理匯總了Java中org.semanticweb.owlapi.model.OWLOntology.getAnnotationAssertionAxioms方法的典型用法代碼示例。如果您正苦於以下問題:Java OWLOntology.getAnnotationAssertionAxioms方法的具體用法?Java OWLOntology.getAnnotationAssertionAxioms怎麽用?Java OWLOntology.getAnnotationAssertionAxioms使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.semanticweb.owlapi.model.OWLOntology的用法示例。


在下文中一共展示了OWLOntology.getAnnotationAssertionAxioms方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeLegacyRelationIndex

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
private void initializeLegacyRelationIndex() {
	synchronized(legacyRelationIndex) {
		OWLAnnotationProperty rdfsLabel = OWLManager.getOWLDataFactory().getRDFSLabel();
		for (OWLOntology ont : this.getOntology().getImportsClosure()) {
			for (OWLObjectProperty prop : ont.getObjectPropertiesInSignature()) {
				for (OWLAnnotationAssertionAxiom axiom : ont.getAnnotationAssertionAxioms(prop.getIRI())) {
					if (axiom.getProperty().equals(rdfsLabel)) {
						Optional<OWLLiteral> literalOpt = axiom.getValue().asLiteral();
						if (literalOpt.isPresent()) {
							String label = literalOpt.get().getLiteral();
							legacyRelationIndex.put(prop.getIRI(), label.replaceAll(" ", "_"));
						}
					}
				}
			}
		}
	}
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:19,代碼來源:CoreMolecularModelManager.java

示例2: getDefinitions

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
 * Returns the definitions.
 *
 * @param owlClass the owl class
 * @param ontology the ontology
 * @return the definitions
 * @throws Exception the exception
 */
private Set<Definition> getDefinitions(OWLClass owlClass,
  OWLOntology ontology) throws Exception {
  Set<Definition> defs = new HashSet<>();
  for (final OWLAnnotationAssertionAxiom axiom : ontology
      .getAnnotationAssertionAxioms(owlClass.getIRI())) {
    final OWLAnnotation annotation = axiom.getAnnotation();
    if (!isDefinitionAnnotation(annotation)) {
      continue;
    }
    final Definition def = new DefinitionJpa();
    setCommonFields(def);
    // this is based on xml-lang attribute on the annotation
    def.setValue(getValue(annotation));
    defs.add(def);
  }
  return defs;
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:26,代碼來源:OwlLoaderAlgorithm.java

示例3: getAttributes

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:28,代碼來源:OwlLoaderAlgorithm.java

示例4: isObsolete

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
 * Indicates whether or not obsolete is the case.
 *
 * @param owlClass the owl class
 * @param ontology the ontology
 * @return <code>true</code> if so, <code>false</code> otherwise
 * @throws Exception the exception
 */
private boolean isObsolete(OWLClass owlClass, OWLOntology ontology)
  throws Exception {
  String obsoletePattern =
      getConfigurableValue(getTerminology(), "obsoletePattern");
  String obsoleteAnnotation =
      getConfigurableValue(getTerminology(), "obsoleteAnnotation");
  if (obsoletePattern == null || obsoleteAnnotation == null) {
    return false;
  }

  for (final OWLAnnotationAssertionAxiom axiom : ontology
      .getAnnotationAssertionAxioms(owlClass.getIRI())) {
    OWLAnnotation annotation = axiom.getAnnotation();
    if (!isAtomAnnotation(annotation)) {
      continue;
    }
    // Look for a label matching the pattern
    if (getName(annotation).equals(label)
        && getValue(annotation).matches(obsoletePattern)) {
      return true;
    }
  }
  return false;
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:33,代碼來源:OwlLoaderAlgorithm.java

示例5: asAnonymousIndividual

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
 * As in Mouse and NCI anatomy. Annotations al rdf:labels in anonymous individuals
 * It seems also GO ontology (to be checked)
 * @param entityAnnAx
 * @return
 */
private String asAnonymousIndividual(OWLAnnotationAssertionAxiom entityAnnAx, OWLOntology onto){
	try {
		geneid_value=((OWLAnonymousIndividual)entityAnnAx.getAnnotation().getValue()).asOWLAnonymousIndividual();//.getID()
		for (OWLAnnotationAssertionAxiom annGeneidAx : onto.getAnnotationAssertionAxioms(geneid_value)){
			
			if (annGeneidAx.getAnnotation().getProperty().getIRI().toString().equals(rdf_label_uri)){
				
				return ((OWLLiteral)annGeneidAx.getAnnotation().getValue()).getLiteral().toLowerCase();
			}
		}
		return "";
	}
	catch (Exception e){
		//In case of error. Accessing an object in an expected way
		return "";
	}
}
 
開發者ID:ernestojimenezruiz,項目名稱:logmap-matcher,代碼行數:24,代碼來源:ExtractStringFromAnnotationAssertionAxiom.java

示例6: addSubAnnotationProperties

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
void addSubAnnotationProperties(Set<OWLAxiom> axioms) {
	// add ALL subannotprop axioms
	// - this is quite geared towards obo ontologies, where
	//   we want to preserve obo headers.
	// TODO: make this configurable
	LOG.info("adding SubAnnotationProperties");
	Set<OWLAxiom> sapAxioms = new HashSet<OWLAxiom>();
	for (OWLOntology refOnt : this.getReferencedOntologies()) {
		for (OWLSubAnnotationPropertyOfAxiom a : refOnt.getAxioms(AxiomType.SUB_ANNOTATION_PROPERTY_OF)) {
			sapAxioms.add(a);
			Set<OWLAnnotationAssertionAxiom> s = refOnt.getAnnotationAssertionAxioms(a.getSubProperty().getIRI());
			if (s != null && !s.isEmpty()) {
				for (OWLAnnotationAssertionAxiom owlAnnotationAssertionAxiom : s) {
					sapAxioms.add(owlAnnotationAssertionAxiom);
				}
			}
		}
	}
	axioms.addAll(sapAxioms);
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:21,代碼來源:Mooncat.java

示例7: buildClassMap

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
public void buildClassMap(OWLGraphWrapper g) {
	IRI x = Obo2OWLVocabulary.IRI_OIO_hasDbXref.getIRI();
	for (OWLOntology ont : g.getAllOntologies()) {
		for (OWLClass c : ont.getClassesInSignature()) {
			for (OWLAnnotationAssertionAxiom aa : ont.getAnnotationAssertionAxioms(c.getIRI())) {
				if (aa.getProperty().getIRI().equals(x)) {
					OWLAnnotationValue v = aa.getValue();
					if (v instanceof OWLLiteral) {
						String xid =((OWLLiteral)v).getLiteral();
						OWLClass xc = (OWLClass) g.getOWLObjectByIdentifier(xid);
						if (xc == null) {
							LOG.error("Cannot get class for: "+xid);
						}
						else {
							config.classMap.put(xc, c);
						}
						//LOG.info(c + " ===> "+xid);
					}
				}					
			}
		}
	}
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:24,代碼來源:TableToAxiomConverter.java

示例8: testExactSynonym

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
private void testExactSynonym(OWLOntology ontology) {
	IRI iri = IRI.create("http://www.geneontology.org/formats/oboInOwl#hasExactSynonym");
	OWLDataFactory df = ontology.getOWLOntologyManager().
		getOWLDataFactory();
	OWLAnnotationProperty property = df.getOWLAnnotationProperty(iri);
	assertTrue("Exact Synonym property in signature",
		ontology.containsAnnotationPropertyInSignature(iri));
	
	// Check axioms
	Set<OWLAnnotationAxiom> axioms = ontology.getAxioms(property, Imports.EXCLUDED);
	assertEquals("Count class axioms", 0, axioms.size());

	// Check annotations
	List<String> values = new ArrayList<String>();
	values.add("AnnotationAssertion(rdfs:label <http://www.geneontology.org/formats/oboInOwl#hasExactSynonym> \"has_exact_synonym\"^^xsd:string)");

	Set<OWLAnnotationAssertionAxiom> annotations = 
		ontology.getAnnotationAssertionAxioms(iri);
	assertEquals("Count annotations for Exact", 1, annotations.size());

	checkAnnotations(annotations, values);
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:23,代碼來源:NCBI2OWLTest.java

示例9: removeAnnotations

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
void removeAnnotations(ModelContainer model, IRI subject, Collection<OWLAnnotation> annotations, METADATA metadata) {
	OWLOntology ont = model.getAboxOntology();
	Set<OWLAxiom> toRemove = new HashSet<OWLAxiom>();
	Set<OWLAnnotationAssertionAxiom> candidates = ont.getAnnotationAssertionAxioms(subject);
	for (OWLAnnotationAssertionAxiom axiom : candidates) {
		OWLAnnotation annotation = axiom.getAnnotation();
		if (annotations.contains(annotation)) {
			toRemove.add(axiom);
		}
	}
	removeAxioms(model, toRemove, metadata);
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:13,代碼來源:CoreMolecularModelManager.java

示例10: getPreferredName

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
 * Returns the preferred name.
 *
 * @param iri the iri
 * @param ontology the ontology
 * @return the preferred name
 * @throws Exception the exception
 */
private String getPreferredName(IRI iri, OWLOntology ontology)
  throws Exception {
  for (final OWLAnnotationAssertionAxiom axiom : ontology
      .getAnnotationAssertionAxioms(iri)) {
    final OWLAnnotation annotation = axiom.getAnnotation();
    if (!isAtomAnnotation(annotation)) {
      continue;
    }
    if (isPreferredType(getName(annotation))) {
      return getValue(annotation);
    }
  }
  return getTerminologyId(iri);
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:23,代碼來源:OwlLoaderAlgorithm.java

示例11: getAtoms

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
 * Helper method to extract annotation properties attached to a class.
 *
 * @param owlClass the owl class
 * @param ontology the ontology
 * @return the annotation types
 * @throws Exception the exception
 */
private Set<Atom> getAtoms(OWLClass owlClass, OWLOntology ontology)
  throws Exception {
  Set<Atom> atoms = new HashSet<>();
  for (final OWLAnnotationAssertionAxiom axiom : ontology
      .getAnnotationAssertionAxioms(owlClass.getIRI())) {
    final OWLAnnotation annotation = axiom.getAnnotation();
    if (!isAtomAnnotation(annotation)) {
      continue;
    }
    final Atom atom = new AtomJpa();
    setCommonFields(atom);
    atom.setWorkflowStatus(WorkflowStatus.PUBLISHED);
    // everything after the #
    atom.setConceptId(getTerminologyId(owlClass.getIRI()));
    atom.setDescriptorId("");
    atom.setCodeId("");
    atom.setLexicalClassId("");
    atom.setStringClassId("");
    // this is based on xml-lang attribute on the annotation
    atom.setLanguage(getLanguage(annotation));
    languages.add(atom.getLanguage());
    atom.setTermType(atnMap.get(getName(annotation)).getAbbreviation());
    generalEntryValues.add(atom.getTermType());
    termTypes.add(atom.getTermType());
    atom.setName(getValue(annotation));
    atom.setWorkflowStatus(WorkflowStatus.PUBLISHED);
    atoms.add(atom);

  }
  return atoms;
}
 
開發者ID:WestCoastInformatics,項目名稱:UMLS-Terminology-Server,代碼行數:40,代碼來源:OwlLoaderAlgorithm.java

示例12: getClosureOfExternalReferencedEntities

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
 * finds the full closure of all external referenced entities.
 * TODO: include object properties
 * 
 * calls {@link #getExternalReferencedEntities()} and then finds all reflexive ancestors of this set.
 * 
 * to configure the traversal, see {@link OWLGraphWrapper}
 * 
 * @return closure of all external referenced entities
 */
public Set<OWLObject> getClosureOfExternalReferencedEntities() {
	// the closure set, to be returned
	Set<OWLObject> objs = new HashSet<OWLObject>();

	// set of entities in external ontologies referenced in source ontology
	Set<OWLEntity> refs = getExternalReferencedEntities();
	LOG.info("direct external referenced entities: "+refs.size());

	// build the closure
	for (OWLEntity ref : refs) {
		// todo - allow per-relation control
		// todo - make more efficient, allow passing of set of entities
		// todo - include object properties
		Set<OWLObject> ancs = graph.getAncestorsReflexive(ref);
		objs.addAll(ancs);
	}
	LOG.info("closure of direct external referenced entities: "+objs.size());

	// extraObjs is the set of properties (annotation and object)
	// that are in the signatures of all referencing axioms
	Set<OWLObject> extraObjs = new HashSet<OWLObject>();
	for (OWLObject obj : objs) {
		if (obj instanceof OWLEntity) {
			for (OWLOntology refOnt : this.getReferencedOntologies()) {
				for (OWLAnnotationAssertionAxiom aaa : refOnt.getAnnotationAssertionAxioms(((OWLEntity)obj).getIRI())) {
					extraObjs.add(aaa.getProperty());
					extraObjs.add(aaa.getValue());
				}
				
				for (OWLAxiom ax : refOnt.getReferencingAxioms((OWLEntity)obj)) {
					extraObjs.addAll(ax.getObjectPropertiesInSignature());
				}
			}
		}
	}
	objs.addAll(extraObjs);
	return objs;
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:49,代碼來源:Mooncat.java

示例13: isImportMarkedEntity

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
 * Check, if the named object has the annotation property IAO:0000412, 
 * declaring the object as imported.
 * 
 * @param named
 * @param ontology
 * @return true if the item has the annotation property IAO:0000412
 */
public static boolean isImportMarkedEntity(OWLNamedObject named, OWLOntology ontology) {
	for (OWLAnnotationAssertionAxiom axiom : ontology.getAnnotationAssertionAxioms(named.getIRI())) {
		OWLAnnotationProperty property = axiom.getProperty();
		if (importedMarkerIRI.equals(property.getIRI())) {
			return true;
		}
	}
	return false;
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:18,代碼來源:Mooncat.java

示例14: getAnnotations

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
public static Set<OWLAnnotation> getAnnotations(OWLEntity e, OWLAnnotationProperty property, OWLOntology ont) {
	Set<OWLAnnotation> annotations;
	if (e != null && property != null && ont != null) {
		annotations = new HashSet<>();
		for (OWLAnnotationAssertionAxiom ax : ont.getAnnotationAssertionAxioms(e.getIRI())) {
			if (property.equals(ax.getProperty())) {
				annotations.add(ax.getAnnotation());
			}
		}
	}
	else {
		annotations = Collections.emptySet();
	}
	return annotations;
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:16,代碼來源:OwlHelper.java

示例15: getDefXref

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
 * Get the definition xrefs (IAO_0000115)
 * 
 * @param c
 * @return list of definition xrefs
 */
public List<String> getDefXref(OWLObject c){
	OWLAnnotationProperty lap = getDataFactory().getOWLAnnotationProperty(Obo2OWLVocabulary.IRI_IAO_0000115.getIRI()); 
	OWLAnnotationProperty xap = getAnnotationProperty(OboFormatTag.TAG_XREF.getTag());

	if (c instanceof OWLEntity) {
		List<String> list = new ArrayList<String>();
		for (OWLOntology ont : getAllOntologies()) {
			Set<OWLAnnotationAssertionAxiom> axioms = ont.getAnnotationAssertionAxioms(((OWLEntity) c).getIRI());
			for (OWLAnnotationAssertionAxiom axiom :axioms){
				if(lap.equals(axiom.getProperty())){
					for(OWLAnnotation annotation: axiom.getAnnotations(xap)){
						OWLAnnotationValue value = annotation.getValue();
						if(value instanceof OWLLiteral){
							list.add(((OWLLiteral)value).getLiteral());
						}
					}
				}

			}
		}
		return list;
	}
	else {
		return null;
	}
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:33,代碼來源:OWLGraphWrapperExtended.java


注:本文中的org.semanticweb.owlapi.model.OWLOntology.getAnnotationAssertionAxioms方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。