本文整理汇总了Java中org.semanticweb.owlapi.model.OWLAnnotationProperty.equals方法的典型用法代码示例。如果您正苦于以下问题:Java OWLAnnotationProperty.equals方法的具体用法?Java OWLAnnotationProperty.equals怎么用?Java OWLAnnotationProperty.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.semanticweb.owlapi.model.OWLAnnotationProperty
的用法示例。
在下文中一共展示了OWLAnnotationProperty.equals方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAnnotation
import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入方法依赖的package包/类
OWLObjectPropertyAssertionAxiom updateAnnotation(ModelContainer model,
OWLObjectPropertyAssertionAxiom toModify, OWLAnnotation update,
METADATA metadata) {
OWLObjectPropertyAssertionAxiom newAxiom = null;
if (toModify != null) {
Set<OWLAnnotation> combindedAnnotations = new HashSet<OWLAnnotation>();
OWLAnnotationProperty target = update.getProperty();
for(OWLAnnotation existing : toModify.getAnnotations()) {
if (target.equals(existing.getProperty()) == false) {
combindedAnnotations.add(existing);
}
}
combindedAnnotations.add(update);
newAxiom = modifyAnnotations(toModify, combindedAnnotations, model, metadata);
}
return newAxiom;
}
示例2: getAllOWLObjectsByAltId
import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入方法依赖的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;
}
示例3: isTagged
import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入方法依赖的package包/类
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;
}
示例4: findTaggedEntities
import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入方法依赖的package包/类
public static Set<OWLObject> findTaggedEntities(OWLAnnotationProperty p, Set<OWLAnnotationValue> values, final OWLGraphWrapper graph) {
if (p == null || values == null || values.isEmpty()) {
return Collections.emptySet();
}
final Set<OWLObject> entities = new HashSet<OWLObject>();
Set<OWLOntology> allOntologies = graph.getAllOntologies();
for (OWLOntology ontology : allOntologies) {
Set<OWLAnnotationAssertionAxiom> axioms = ontology.getAxioms(AxiomType.ANNOTATION_ASSERTION);
for (OWLAnnotationAssertionAxiom axiom : axioms) {
if (p.equals(axiom.getProperty()) && values.contains(axiom.getValue())) {
axiom.getSubject().accept(new OWLAnnotationSubjectVisitor(){
@Override
public void visit(IRI iri) {
OWLObject owlObject = graph.getOWLObject(iri);
if (owlObject != null) {
entities.add(owlObject);
}
}
@Override
public void visit(OWLAnonymousIndividual individual) {
// do nothing
}
});
}
}
}
return entities;
}
示例5: getAnnotations
import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入方法依赖的package包/类
public static Set<OWLAnnotation> getAnnotations(OWLEntity e, OWLAnnotationProperty property, OWLOntology ont) {
Set<OWLAnnotation> annotations;
if (e != null && property != null && ont != null) {
annotations = new HashSet<>();
for (OWLAnnotationAssertionAxiom ax : ont.getAnnotationAssertionAxioms(e.getIRI())) {
if (property.equals(ax.getProperty())) {
annotations.add(ax.getAnnotation());
}
}
}
else {
annotations = Collections.emptySet();
}
return annotations;
}
示例6: getDefXref
import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入方法依赖的package包/类
/**
* Get the definition xrefs (IAO_0000115)
*
* @param c
* @return list of definition xrefs
*/
public List<String> getDefXref(OWLObject c){
OWLAnnotationProperty lap = getDataFactory().getOWLAnnotationProperty(Obo2OWLVocabulary.IRI_IAO_0000115.getIRI());
OWLAnnotationProperty xap = getAnnotationProperty(OboFormatTag.TAG_XREF.getTag());
if (c instanceof OWLEntity) {
List<String> list = new ArrayList<String>();
for (OWLOntology ont : getAllOntologies()) {
Set<OWLAnnotationAssertionAxiom> axioms = ont.getAnnotationAssertionAxioms(((OWLEntity) c).getIRI());
for (OWLAnnotationAssertionAxiom axiom :axioms){
if(lap.equals(axiom.getProperty())){
for(OWLAnnotation annotation: axiom.getAnnotations(xap)){
OWLAnnotationValue value = annotation.getValue();
if(value instanceof OWLLiteral){
list.add(((OWLLiteral)value).getLiteral());
}
}
}
}
}
return list;
}
else {
return null;
}
}
示例7: getOWLObjectsByAltId
import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入方法依赖的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;
}
示例8: getFirstLiteral
import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入方法依赖的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;
}
示例9: getIRIByIdentifier
import org.semanticweb.owlapi.model.OWLAnnotationProperty; //导入方法依赖的package包/类
public IRI getIRIByIdentifier(String id, boolean isAutoResolve) {
if (isAutoResolve) {
OWLObject obj = this.getObjectByAltId(id);
if (obj != null) {
return ((OWLNamedObject) obj).getIRI();
}
}
// special magic for finding IRIs from a non-standard identifier
// This is the case for relations (OWLObject properties) with a short hand
// or for relations with a non identifiers with-out a colon, e.g. negative_regulation
if (!id.contains(":")) {
final OWLAnnotationProperty shortHand = getDataFactory().getOWLAnnotationProperty(Obo2OWLVocabulary.IRI_OIO_shorthand.getIRI());
final OWLAnnotationProperty oboIdInOwl = getDataFactory().getOWLAnnotationProperty(Obo2Owl.trTagToIRI(OboFormatTag.TAG_ID.getTag()));
for (OWLOntology o : getAllOntologies()) {
for(OWLObjectProperty p : o.getObjectPropertiesInSignature()) {
// check for short hand or obo ID in owl
Set<OWLAnnotation> annotations = OwlHelper.getAnnotations(p, o);
if (annotations != null) {
for (OWLAnnotation owlAnnotation : annotations) {
OWLAnnotationProperty property = owlAnnotation.getProperty();
if ((shortHand != null && shortHand.equals(property))
|| (oboIdInOwl != null && oboIdInOwl.equals(property)))
{
OWLAnnotationValue value = owlAnnotation.getValue();
if (value != null && value instanceof OWLLiteral) {
OWLLiteral literal = (OWLLiteral) value;
String shortHandLabel = literal.getLiteral();
if (id.equals(shortHandLabel)) {
return p.getIRI();
}
}
}
}
}
}
}
}
// otherwise use the obo2owl method
Obo2Owl b = new Obo2Owl(getManager()); // re-use manager, creating a new one can be expensive as this is a highly used code path
b.setObodoc(new OBODoc());
return b.oboIdToIRI(id);
}