当前位置: 首页>>代码示例>>Java>>正文


Java OWLAnnotationAssertionAxiom.getValue方法代码示例

本文整理汇总了Java中org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java OWLAnnotationAssertionAxiom.getValue方法的具体用法?Java OWLAnnotationAssertionAxiom.getValue怎么用?Java OWLAnnotationAssertionAxiom.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom的用法示例。


在下文中一共展示了OWLAnnotationAssertionAxiom.getValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStringValue

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
private String getStringValue(OWLAnnotationAssertionAxiom ax) {
	OWLAnnotationValue value = ax.getValue();
	String stringValue = value.accept(new OWLAnnotationValueVisitorEx<String>() {

		@Override
		public String visit(IRI iri) {
			return iri.toString();
		}

		@Override
		public String visit(OWLAnonymousIndividual individual) {
			return null;
		}

		@Override
		public String visit(OWLLiteral literal) {
			return literal.getLiteral();
		}
	});
	return stringValue;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:22,代码来源:LegoModelWalker.java

示例2: tr

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
private OWLAxiom tr(OWLClass c, OWLAnnotationAssertionAxiom ax) {
	OWLAnnotationProperty p = ax.getProperty();
	if (!ecmap.containsKey(c)) {
		// preserve as-is, exception for labels
		if (p.isLabel()) {
			OWLLiteral lit = (OWLLiteral) ax.getValue();
			String newVal = lit.getLiteral() + " (" + suffix + ")";
			return fac.getOWLAnnotationAssertionAxiom(ax.getProperty(),
					ax.getSubject(), fac.getOWLLiteral(newVal));
		}
		return ax;

	} else {
		// the class is merged - ditch its axioms
		// (in future some may be preserved - syns?)
		// fac.getOWLAnnotationAssertionAxiom(ax.getProperty(), ecmap,
		// ax.getValue());
		return null;
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:21,代码来源:SpeciesMergeUtil.java

示例3: getAllOWLObjectsByAltId

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
/**
 * Find all corresponding {@link OWLObject}s with an OBO-style alternate identifier.
 * <p>
 * WARNING: This methods scans all object annotations in all ontologies. 
 * This is an expensive method.
 * 
 * @return map of altId to OWLObject (never null)
 */
public Map<String, OWLObject> getAllOWLObjectsByAltId() {
	final Map<String, OWLObject> results = new HashMap<String, OWLObject>();
	final OWLAnnotationProperty altIdProperty = getAnnotationProperty(OboFormatTag.TAG_ALT_ID.getTag());
	if (altIdProperty == null) {
		return Collections.emptyMap();
	}
	for (OWLOntology o : getAllOntologies()) {
		Set<OWLAnnotationAssertionAxiom> aas = o.getAxioms(AxiomType.ANNOTATION_ASSERTION);
		for (OWLAnnotationAssertionAxiom aa : aas) {
			OWLAnnotationValue v = aa.getValue();
			OWLAnnotationProperty property = aa.getProperty();
			if (altIdProperty.equals(property) && v instanceof OWLLiteral) {
				String altId = ((OWLLiteral)v).getLiteral();
				OWLAnnotationSubject subject = aa.getSubject();
				if (subject instanceof IRI) {
					OWLObject obj = getOWLObject((IRI) subject);
					if (obj != null) {
						results.put(altId, obj);
					}
				}
			}
		}
	}
	return results;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:34,代码来源:OWLGraphWrapperExtended.java

示例4: buildClassMap

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的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

示例5: extractMetadata

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
private Metadata extractMetadata(OWLNamedIndividual individual, OWLGraphWrapper modelGraph, String modelId) {
	Metadata metadata = new Metadata();
	metadata.modelId = modelId;
	metadata.individualIds = new HashSet<IRI>();
	metadata.individualIds.add(individual.getIRI());
	Set<OWLAnnotationAssertionAxiom> assertionAxioms = modelGraph.getSourceOntology().getAnnotationAssertionAxioms(individual.getIRI());
	for (OWLAnnotationAssertionAxiom axiom : assertionAxioms) {
		OWLAnnotationProperty currentProperty = axiom.getProperty();
		OWLAnnotationValue value = axiom.getValue();
		extractMetadata(currentProperty, value, metadata);
	}
	return metadata;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:14,代码来源:LegoModelWalker.java

示例6: getExcludedLabels

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
/**
 * any class whose label matches any of the strings returned
 * here will be excluded from any analysis.
 *
 * the set of excluded labels is controlled by loading an
 * ontology with an entity PhenoSim_0000001 where all
 * the literals associated with this are excluded.
 * (note that this method may change in future)
 * 
 * @return excluded labels 
 */
public Set<String> getExcludedLabels() {
	if (excludedLabels != null)
		return excludedLabels;
	excludedLabels = new HashSet<String>();
	for (OWLAnnotationAssertionAxiom aa :
		getGraph().getSourceOntology().getAnnotationAssertionAxioms(IRI.create("http://purl.obolibrary.org/obo/PhenoSim_0000001"))) {
		OWLAnnotationValue v = aa.getValue();
		if (v instanceof OWLLiteral) {
			excludedLabels.add(((OWLLiteral)v).getLiteral());
		}
	}
	return excludedLabels;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:25,代码来源:SimEngine.java

示例7: setInformationContentFromOntology

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
@Override
public void setInformationContentFromOntology(OWLOntology o) {
	OWLOntologyManager mgr = getSourceOntology().getOWLOntologyManager();
	OWLDataFactory df = mgr.getOWLDataFactory();
	clearInformationContentCache();
	for (OWLAnnotationAssertionAxiom ax : o.getAxioms(AxiomType.ANNOTATION_ASSERTION)) {
		if (ax.getProperty().getIRI().toString().equals(icIRIString)) {
			OWLLiteral lit = (OWLLiteral) ax.getValue();
			OWLClass c = df.getOWLClass((IRI) ax.getSubject());
			Double v = lit.parseDouble();
			setInformtionContectForAttribute(c, v);
		}
	}
	assignDefaultInformationContentForAllClasses();
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:16,代码来源:AbstractOwlSim.java

示例8: getAnnTuple

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
private AnnTuple getAnnTuple(OWLAnnotationAssertionAxiom aax) {
    String v;
    OWLAnnotationValue av = aax.getValue();
    if (av instanceof OWLLiteral) {
        v = ((OWLLiteral)av).getLiteral();
    }
    else {
        v = av.toString();
    }
    v = v.toLowerCase();
    return new AnnTuple((IRI)aax.getSubject(), v);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:13,代码来源:AxiomCopier.java

示例9: getOWLObjectsByAltId

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
/**
 * Find the corresponding {@link OWLObject}s for a given set of OBO-style alternate identifiers.
 * <p>
 * WARNING: This methods scans all object annotations in all ontologies. 
 * This is an expensive method.
 * <p>
 * Consider loading all altId-mappings using {@link #getAllOWLObjectsByAltId()}.
 * 
 * @param altIds
 * @return map of altId to OWLObject (never null)
 * @see #getAllOWLObjectsByAltId()
 */
public Map<String, OWLObject> getOWLObjectsByAltId(Set<String> altIds) {
	final Map<String, OWLObject> results = new HashMap<String, OWLObject>();
	final OWLAnnotationProperty altIdProperty = getAnnotationProperty(OboFormatTag.TAG_ALT_ID.getTag());
	if (altIdProperty == null) {
		return Collections.emptyMap();
	}
	for (OWLOntology o : getAllOntologies()) {
		Set<OWLAnnotationAssertionAxiom> aas = o.getAxioms(AxiomType.ANNOTATION_ASSERTION);
		for (OWLAnnotationAssertionAxiom aa : aas) {
			OWLAnnotationValue v = aa.getValue();
			OWLAnnotationProperty property = aa.getProperty();
			if (altIdProperty.equals(property) && v instanceof OWLLiteral) {
				String altId = ((OWLLiteral)v).getLiteral();
				if (altIds.contains(altId)) {
					OWLAnnotationSubject subject = aa.getSubject();
					if (subject instanceof IRI) {
						OWLObject obj = getOWLObject((IRI) subject);
						if (obj != null) {
							results.put(altId, obj);
						}
					}
				}
			}
		}
	}
	return results;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:40,代码来源:OWLGraphWrapperExtended.java

示例10: getFirstLiteral

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
/**
 * Convenience method to get the first string literal of an
 * annotation property.
 *
 * @param ontology the current ontology
 * @param taxon the subject
 * @param property the property
 * @return null or the label content
 */
protected static String getFirstLiteral(OWLOntology ontology,
		OWLEntity taxon, OWLAnnotationProperty property) {
	Set<OWLAnnotationAssertionAxiom> axioms = ontology.getAnnotationAssertionAxioms(taxon.getIRI());
	for (OWLAnnotationAssertionAxiom axiom : axioms) {
		if (property.equals(axiom.getProperty())) {
			OWLAnnotationValue value = axiom.getValue();
			if (value instanceof OWLLiteral) {
				OWLLiteral literal = (OWLLiteral)value;
				return literal.getLiteral();
			}
		}
	}
	return null;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:24,代码来源:OWLConverter.java

示例11: getVerbotenClasses

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
private Set<OWLClass> getVerbotenClasses() {
	if (verbotenClasses == null) {
		verbotenClasses = new HashSet<OWLClass>();
		for (OWLClass c : sourceOntology.getClassesInSignature(Imports.INCLUDED)) {
			// TODO - don't hardcode this!
			if (c.getIRI().toString().startsWith("http://purl.obolibrary.org/obo/FMA_")) {
				// eliminate FMA classes that have no uberon equiv
				if (OwlHelper.getEquivalentClasses(c, sourceOntology).isEmpty()) {
					LOG.info("removing FMA class: "+c);
					verbotenClasses.add(c);
					continue;
				}
			}
			Set<OWLAnnotationAssertionAxiom> aaas = 
				sourceOntology.getAnnotationAssertionAxioms(c.getIRI());
			for (OWLAnnotationAssertionAxiom aaa : aaas) {
				String ap = aaa.getProperty().getIRI().toString();
				OWLAnnotationValue v = aaa.getValue();
				if (v instanceof OWLLiteral) {
					OWLLiteral lv = (OWLLiteral)v;

				}
				if (v instanceof IRI) {
					IRI iv = (IRI)v;
					if (ap.endsWith("inSubset")) {
						if (iv.toString().endsWith("upper_level")) {
							LOG.info("removing upper level class: "+c);
							verbotenClasses.add(c);
						}
					}

				}
			}
		}
		Set<OWLClass> veqs = new HashSet<OWLClass>();
		for (OWLClass vc : verbotenClasses) {
			for (OWLClassExpression eqc : OwlHelper.getEquivalentClasses(vc, sourceOntology)) {
				if (eqc instanceof OWLClass) {
					LOG.info("removing equiv "+eqc+" "+vc);
					veqs.add((OWLClass) eqc);
				}
			}
		}
		verbotenClasses.addAll(veqs);
	}

	return verbotenClasses;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:49,代码来源:OldSimpleOwlSim.java

示例12: visit

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
@Override
public Void visit(OWLAnnotationAssertionAxiom axiom) {
  if ((axiom.getSubject() instanceof IRI)
      || (axiom.getSubject() instanceof OWLAnonymousIndividual)) {
    long subject = 0L;
    if (axiom.getSubject() instanceof IRI) {
      subject = getOrCreateNode(((IRI) axiom.getSubject()).toString());
    } else if (axiom.getSubject() instanceof OWLAnonymousIndividual) {
      subject = getOrCreateNode(OwlApiUtils.getIri((OWLAnonymousIndividual) axiom.getSubject()));
    }

    String property = getIri(axiom.getProperty()).toString();
    if (axiom.getValue() instanceof OWLLiteral) {
      Optional<Object> literal =
          OwlApiUtils.getTypedLiteralValue((OWLLiteral) (axiom.getValue()));
      if (literal.isPresent()) {
        graph.addNodeProperty(subject, property, literal.get());
        if (mappedProperties.containsKey(property)) {
          graph.addNodeProperty(subject, mappedProperties.get(property), literal.get());
        }
      }
    } else if ((axiom.getValue() instanceof IRI)
        || (axiom.getValue() instanceof OWLAnonymousIndividual)) {
      long object = 0L;
      if (axiom.getValue() instanceof IRI) {
        object = getOrCreateNode(((IRI) axiom.getValue()).toString());
      } else if (axiom.getValue() instanceof OWLAnonymousIndividual) {
        object = getOrCreateNode(OwlApiUtils.getIri((OWLAnonymousIndividual) axiom.getValue()));
      }
      long assertion =
          getOrCreateRelationship(subject, object, RelationshipType.withName(property));
      graph.setRelationshipProperty(assertion, CommonProperties.IRI, property);
      graph.setRelationshipProperty(assertion, CommonProperties.OWL_TYPE,
          OwlRelationships.OWL_ANNOTATION.name());
    } else {
      logger.info("Ignoring assertion axiom: " + axiom);
    }
  } else {
    logger.info("Ignoring assertion axiom: " + axiom);
  }
  return null;
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:43,代码来源:GraphOwlVisitor.java


注:本文中的org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。