Java 类org.semanticweb.owlapi.model.OWLAnnotationValueVisitorEx 实例源码

项目:minerva    文件:LegoModelWalker.java   
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;
}
项目:minerva    文件:JsonTools.java   
private static JsonAnnotation create(final String key, OWLAnnotationValue value, final CurieHandler curieHandler) {
    return value.accept(new OWLAnnotationValueVisitorEx<JsonAnnotation>() {

        @Override
        public JsonAnnotation visit(IRI iri) {
            String iriString = curieHandler.getCuri(iri);
            return JsonAnnotation.create(key, iriString, VALUE_TYPE_IRI);
        }

        @Override
        public JsonAnnotation visit(OWLAnonymousIndividual individual) {
            return null; // do nothing
        }

        @Override
        public JsonAnnotation visit(OWLLiteral literal) {
            return JsonAnnotation.create(key, literal.getLiteral(), getType(literal));
        }
    });
}
项目:owltools    文件:ModelAnnotationSolrDocumentLoader.java   
private OWLNamedIndividual findEvidenceIndividual(OWLAnnotationValue value) {
    return value.accept(new OWLAnnotationValueVisitorEx<OWLNamedIndividual>() {

        @Override
        public OWLNamedIndividual visit(final IRI iri) {
            OWLNamedIndividual i = null;
            for(OWLNamedIndividual current : model.getIndividualsInSignature()) {
                if (current.getIRI().equals(iri)) {
                    i = current;
                    break;
                }
            }
            return i;
        }

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

        @Override
        public OWLNamedIndividual visit(OWLLiteral literal) {
            return null;
        }
    });
}
项目:minerva    文件:GroupingTranslator.java   
public static String getModelState(OWLOntology model, String defaultValue) {
    String modelState = defaultValue;
    Set<OWLAnnotation> modelAnnotations = model.getAnnotations();
    for (OWLAnnotation modelAnnotation : modelAnnotations) {
        IRI propIRI = modelAnnotation.getProperty().getIRI();
        if (AnnotationShorthand.modelstate.getAnnotationProperty().equals(propIRI)) {
            String value = modelAnnotation.getValue().accept(new OWLAnnotationValueVisitorEx<String>() {

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

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

                @Override
                public String visit(OWLLiteral literal) {
                    return literal.getLiteral();
                }
            });
            if (value != null) {
                modelState = value;
            }
        }
    }
    return modelState;
}
项目:minerva    文件:ModelReaderHelper.java   
static boolean isTagged(Set<OWLAnnotation> annotations, OWLAnnotationProperty p) {
    if (annotations != null && !annotations.isEmpty()) {
        for (OWLAnnotation annotation : annotations) {
            if (p.equals(annotation.getProperty())) {
                String value = annotation.getValue().accept(new OWLAnnotationValueVisitorEx<String>() {

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

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

                    @Override
                    public String visit(OWLLiteral literal) {
                        return literal.getLiteral();
                    }
                });
                if (value != null && ModelWriterHelper.DERIVED_VALUE.equalsIgnoreCase(value)) {
                    return true;
                }
            }
    }
    }
    return false;
}
项目:minerva    文件:AbstractLegoTranslator.java   
static void fillAspects(OWLOntology model, OWLReasoner reasoner, CurieHandler curieHandler, Set<OWLClass> bpSet, Set<OWLClass> mfSet, Set<OWLClass> ccSet, 
        OWLClass bp, OWLClass mf, OWLClass cc) {
    final IRI namespaceIRI = Obo2Owl.trTagToIRI(OboFormatTag.TAG_NAMESPACE.getTag());
    final OWLDataFactory df = model.getOWLOntologyManager().getOWLDataFactory();
    final OWLAnnotationProperty namespaceProperty = df.getOWLAnnotationProperty(namespaceIRI);
    final Set<OWLOntology> ontologies = model.getImportsClosure();
    for(OWLClass cls : model.getClassesInSignature(Imports.INCLUDED)) {
        if (cls.isBuiltIn()) {
            continue;
        }
        String id = curieHandler.getCuri(cls);
        if (id.startsWith("GO:") == false) {
            continue;
        }

        // if a reasoner object is passed, use inference to populate
        // the 3 subset
        if (reasoner != null) {
            if (reasoner.getSuperClasses(cls, false).containsEntity(mf) ||
                    reasoner.getEquivalentClasses(cls).contains(mf)) {
                mfSet.add(cls);
            }
            if (reasoner.getSuperClasses(cls, false).containsEntity(bp) ||
                    reasoner.getEquivalentClasses(cls).contains(bp)) {
                bpSet.add(cls);
            }
            if (reasoner.getSuperClasses(cls, false).containsEntity(cc) ||
                    reasoner.getEquivalentClasses(cls).contains(cc)) {
                ccSet.add(cls);
            }
        }


        for (OWLAnnotation annotation : OwlHelper.getAnnotations(cls, ontologies)) {
            if (annotation.getProperty().equals(namespaceProperty)) {
                String value = annotation.getValue().accept(new OWLAnnotationValueVisitorEx<String>() {

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

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

                    @Override
                    public String visit(OWLLiteral literal) {
                        return literal.getLiteral();
                    }
                });
                if (value != null) {
                    if ("molecular_function".equals(value)) {
                        mfSet.add(cls);
                    }
                    else if ("biological_process".equals(value)) {
                        bpSet.add(cls);
                    }
                    else if ("cellular_component".equals(value)) {
                        ccSet.add(cls);
                    }
                }
            }
        }
    }
}
项目:owlapi-gwt    文件:OWLLiteralImpl.java   
@Override
public <O> O accept(OWLAnnotationValueVisitorEx<O> visitor) {
    return visitor.visit(this);
}
项目:owlapi-gwt    文件:OWLLiteralImplPlain.java   
@Override
public <O> O accept(OWLAnnotationValueVisitorEx<O> visitor) {
    return visitor.visit(this);
}
项目:owlapi-gwt    文件:OWLLiteralImplString.java   
@Override
public <O> O accept(OWLAnnotationValueVisitorEx<O> visitor) {
    return visitor.visit(this);
}