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


Java OWLAnnotationAssertionAxiom.getAnnotation方法代码示例

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


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

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

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

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

示例4: removeAnnotations

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

示例5: getPreferredName

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

示例6: getAtoms

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

示例7: mapLabels

import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入方法依赖的package包/类
/**
	 * Map entities to their respective rdfs:label, where applicable
	 * @param ont	Ontology
	 */
	private void mapLabels(OWLOntology ont) {
		Set<OWLEntity> ents = ont.getSignature();
		for(OWLEntity e : ents) {
			Set<OWLAnnotationAssertionAxiom> ann_axs = ont.getAnnotationAssertionAxioms(e.getIRI());
			if(!ann_axs.isEmpty()) {
				for(OWLAnnotationAssertionAxiom ax : ann_axs) {
					if(ax.getProperty().isLabel()) {
						OWLAnnotation a = ax.getAnnotation();
//						String entry = a.getValue().asLiteral().get().getLiteral();
						// TODO above for owl api 4
						String entry = a.getValue().toString();
						
						if(entry.startsWith("\"")) {
							entry = entry.substring(1);
							entry = entry.substring(0, entry.indexOf("\""));
						}
						if(!entry.equals(""))
							labelMap.put(e, entry);
						else
							labelMap.put(e, sf.getShortForm(e));
					}
				}
			}
			else labelMap.put(e, sf.getShortForm(e));
		}
	}
 
开发者ID:rsgoncalves,项目名称:ecco,代码行数:31,代码来源:XMLAxiomDiffReport.java


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