本文整理汇总了Java中org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom类的典型用法代码示例。如果您正苦于以下问题:Java OWLAnnotationAssertionAxiom类的具体用法?Java OWLAnnotationAssertionAxiom怎么用?Java OWLAnnotationAssertionAxiom使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OWLAnnotationAssertionAxiom类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLAnnotationAssertionAxiom类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: synonym
import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入依赖的package包/类
/**
* Add an synonym annotation, plus an annotation on that annotation
* that specified the type of synonym. The second annotation has the
* property oio:hasSynonymType.
*
* @param ontology the current ontology
* @param subject the subject of the annotation
* @param type the IRI of the type of synonym
* @param property the IRI of the annotation property.
* @param value the literal value of the synonym
* @return the synonym annotation axiom
*/
protected static OWLAnnotationAssertionAxiom synonym(
OWLOntology ontology, OWLEntity subject,
OWLAnnotationValue type,
OWLAnnotationProperty property,
OWLAnnotationValue value) {
OWLOntologyManager manager = ontology.getOWLOntologyManager();
OWLDataFactory dataFactory = manager.getOWLDataFactory();
OWLAnnotationProperty hasSynonymType =
dataFactory.getOWLAnnotationProperty(
format.getIRI("oio:hasSynonymType"));
OWLAnnotation annotation =
dataFactory.getOWLAnnotation(hasSynonymType, type);
Set<OWLAnnotation> annotations = new HashSet<OWLAnnotation>();
annotations.add(annotation);
OWLAnnotationAssertionAxiom axiom =
dataFactory.getOWLAnnotationAssertionAxiom(
property, subject.getIRI(), value,
annotations);
manager.addAxiom(ontology, axiom);
return axiom;
}
开发者ID:owlcollab,项目名称:owltools,代码行数:34,代码来源:OWLConverter.java
示例17: testSpecies
import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入依赖的package包/类
private void testSpecies(OWLOntology ontology) {
IRI iri = IRI.create("http://purl.obolibrary.org/obo/NCBITaxon_species");
OWLDataFactory df = ontology.getOWLOntologyManager().
getOWLDataFactory();
OWLClass taxon = df.getOWLClass(iri);
assertTrue("Species class in signature",
ontology.containsClassInSignature(iri));
// Check axioms
Set<OWLClassAxiom> axioms = ontology.getAxioms(taxon, Imports.EXCLUDED);
assertEquals("Count class axioms", 1, axioms.size());
assertEquals("SubClassOf(<http://purl.obolibrary.org/obo/NCBITaxon_species> <http://purl.obolibrary.org/obo/NCBITaxon#_taxonomic_rank>)", axioms.toArray()[0].toString());
// Check annotations
List<String> values = new ArrayList<String>();
values.add("AnnotationAssertion(<http://www.geneontology.org/formats/oboInOwl#hasOBONamespace> <http://purl.obolibrary.org/obo/NCBITaxon_species> \"ncbi_taxonomy\"^^xsd:string)");
values.add("AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/NCBITaxon_species> \"species\"^^xsd:string)");
Set<OWLAnnotationAssertionAxiom> annotations =
ontology.getAnnotationAssertionAxioms(iri);
assertEquals("Count annotations for Species", 2, annotations.size());
checkAnnotations(annotations, values);
}
开发者ID:owlcollab,项目名称:owltools,代码行数:25,代码来源:NCBI2OWLTest.java
示例18: testExactSynonym
import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入依赖的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
示例19: getAnnotationValue
import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入依赖的package包/类
public Set<OWLAnnotationAssertionAxiom> getAnnotationValue(
String turambarOntologyAnnotation) {
OWLDataFactory factory = ontology.getOWLOntologyManager()
.getOWLDataFactory();
final OWLAnnotationProperty dcProperty = factory
.getOWLAnnotationProperty(IRI
.create(turambarOntologyAnnotation));
final Set<OWLAxiom> axioms = dcProperty.getReferencingAxioms(
getOntology(), true);
final Set<OWLAnnotationAssertionAxiom> values = new HashSet<OWLAnnotationAssertionAxiom>();
for (OWLAxiom a : axioms) {
if (a.getAxiomType().equals(AxiomType.ANNOTATION_ASSERTION)) {
final OWLAnnotationAssertionAxiom annotationAssertion = (OWLAnnotationAssertionAxiom) a;
values.add(annotationAssertion);
}
}
return values;
}
开发者ID:edlectrico,项目名称:Pellet4Android,代码行数:20,代码来源:OntologyManager.java
示例20: findAnnotationNames
import org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom; //导入依赖的package包/类
private Collection<String> findAnnotationNames(IRI iri, OWLAnnotationProperty annotationType) {
Collection<String> classNames = new HashSet<String>();
// get all literal annotations
for (OWLAnnotationAssertionAxiom axiom : ontology.getAnnotationAssertionAxioms(iri)) {
if (axiom.getAnnotation().getProperty().equals(annotationType)) {
OWLAnnotationValue value = axiom.getAnnotation().getValue();
Optional<String> name = getOWLAnnotationValueAsString(value);
if (name.isPresent()) {
classNames.add(name.get());
}
}
}
return classNames;
}
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:17,代码来源:OntologyHelper.java
注:本文中的org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论