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


Java OWLAnnotationAssertionAxiom类代码示例

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


OWLAnnotationAssertionAxiom类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLAnnotationAssertionAxiom类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initializeLegacyRelationIndex

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

示例3: getDefinitions

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

示例4: getAttributes

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

示例5: isObsolete

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

示例6: asDirectValue

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入依赖的package包/类
private String asDirectValue(OWLAnnotationAssertionAxiom entityAnnAx){
	try	{
		//LogOutput.print(((OWLLiteral)annAx.getAnnotation().getValue()).getLiteral());
		
		String label = ((OWLLiteral)entityAnnAx.getAnnotation().getValue()).getLiteral().toLowerCase();
		
		//System.err.println(entityAnnAx + " " + label);
		
		if (label==null || label.equals("null") || label.equals("")){
			//System.err.println("NULL LABEL: " + entityAnnAx);
			return "";
		}
		
				
		return label;
		
		
	}
	catch (Exception e){
		//In case of error. Accessing an object in an expected way				
		return "";
	}
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:24,代码来源:ExtractStringFromAnnotationAssertionAxiom.java

示例7: asAnonymousIndividual

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

示例8: asNamedIndividual

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入依赖的package包/类
/**
 * In some OBO like ontologies
 * @param entityAnnAx
 * @return
 */
private String asNamedIndividual(OWLAnnotationAssertionAxiom entityAnnAx, OWLOntology onto, OWLDataFactory datafactory){
	try {
		//It is an individual
		namedIndivIRI=(IRI)entityAnnAx.getAnnotation().getValue();				
		namedIndiv=datafactory.getOWLNamedIndividual(namedIndivIRI);
		
		
		for (OWLAnnotationAssertionAxiom annIdiv : namedIndiv.getAnnotationAssertionAxioms(onto)){
			
			
			if (annIdiv.getAnnotation().getProperty().getIRI().toString().equals(rdf_label_uri)){
				
				return ((OWLLiteral)annIdiv.getAnnotation().getValue()).getLiteral().toLowerCase();
			}
		}
		return "";
		
		
	}
	catch (Exception e){
		//In case of error. Accessing an object in an expected way
		return "";
	}
	
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:31,代码来源:ExtractStringFromAnnotationAssertionAxiom.java

示例9: asNamedIndividualFMA

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入依赖的package包/类
/**
 * FMA originalannotations annotations appear as datatype assertions
 * @param entityAnnAx
 * @return
 */
private String asNamedIndividualFMA(OWLAnnotationAssertionAxiom entityAnnAx, OWLOntology onto, OWLDataFactory datafactory){
	
	try{
		//It is an individual
		namedIndivIRI=(IRI)entityAnnAx.getAnnotation().getValue();
		
		namedIndiv=datafactory.getOWLNamedIndividual(namedIndivIRI);
		
		//for (OWLAnnotation indivAnn : namedIndiv.getAnnotations(onto)){
		for (OWLLiteral literal_syn : namedIndiv.getDataPropertyValues(datafactory.getOWLDataProperty(IRI.create(fma_name_uri)), onto)){
		
			return literal_syn.getLiteral().toLowerCase();
		}
		
		return "";
		
	}
	catch (Exception e){
		//In case of error. Accessing an object in an expected way
		return "";
	}
	
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:29,代码来源:ExtractStringFromAnnotationAssertionAxiom.java

示例10: renderAnnotationAxioms

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入依赖的package包/类
private Map<String, Object> renderAnnotationAxioms(Set<OWLAnnotationAssertionAxiom> annotations) {
	Map<String, Object> result = null;
	if (annotations != null && !annotations.isEmpty()) {
		for (OWLAnnotationAssertionAxiom ax : annotations) {
			OWLAnnotationProperty prop = ax.getProperty();
			String literal = getLiteralValue(ax.getValue());
			if (literal != null) {
				if (result == null) {
					result = new HashMap<String, Object>();
				}
				result.put(prop.toStringID(), literal);
			}
		}
	}
	return result;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:ModelAnnotationSolrDocumentLoader.java

示例11: addSubAnnotationProperties

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

示例12: 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

示例13: 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

示例14: 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

示例15: renderAnnotationAxioms

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入依赖的package包/类
private void renderAnnotationAxioms(String tag, IRI piri,
		Set<OWLAnnotationAssertionAxiom> annotationAxioms) {

	List<String> vs = new ArrayList<String>();
	Set<OWLAnnotationAssertionAxiom> consumed = new HashSet<OWLAnnotationAssertionAxiom>();
	for (OWLAnnotationAssertionAxiom aaa : annotationAxioms) {
		if (aaa.getProperty().getIRI().equals(piri)) {
			StringBuffer v = 
					new StringBuffer(generateText(aaa.getValue()));
			if (aaa.getAnnotations().size() > 0) {
				List<String> avs = new ArrayList<String>();
				for (OWLAnnotation ann : aaa.getAnnotations()) {
					avs.add(generateText(ann));
				}
				Collections.sort(avs);
				v.append(" [ "+StringUtils.join(avs, ", ")+" ]");
			}
			vs.add(v.toString());
			consumed.add(aaa);
		}
	}
	annotationAxioms.removeAll(consumed);
	renderTagValues(tag, vs);

}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:26,代码来源:MarkdownRenderer.java


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