public boolean isLabel() { return property.isLabel(); }
@Deprecated public boolean isLabel() { return property.isLabel(); }
/** * @param label label to match * @param v annotation value * @param property property to check * @return true if property is a label, v is a literal and v matches label */ protected boolean isMatchingLabel(String label, OWLAnnotationValue v, OWLAnnotationProperty property) { return property.isLabel() && v instanceof OWLLiteral && label .equals(((OWLLiteral) v).getLiteral()); }
/** * @param label label to match * @param v annotation value * @param property property to check * @return true if property is a label, v is a literal and v matches label */ protected boolean isMatchingLabel(String label, OWLAnnotationValue v, OWLAnnotationProperty property) { return property.isLabel() && v instanceof OWLLiteral && label .equals(((OWLLiteral) v).getLiteral()); }
/** * @param label label to match * @param v annotation value * @param property property to check * @return true if property is a label, v is a literal and v matches label */ protected boolean isMatchingLabel(String label, OWLAnnotationValue v, OWLAnnotationProperty property) { return property.isLabel() && v instanceof OWLLiteral && label .equals(((OWLLiteral) v).getLiteral()); }
/** * @param label label to match * @param v annotation value * @param property property to check * @return true if property is a label, v is a literal and v matches label */ protected boolean isMatchingLabel(String label, OWLAnnotationValue v, OWLAnnotationProperty property) { return property.isLabel() && v instanceof OWLLiteral && label .equals(((OWLLiteral) v).getLiteral()); }
/** * Determines if the given annotation assertion axiom provides an rdfs:label */ private boolean isRdfsLabelAnnotation(@Nonnull OWLAnnotationAssertionAxiom ax) { return ax.getProperty().isLabel(); }
/** * Returns the terminology preferred name. * * @param ontology the ontology * @return the terminology preferred name * @throws Exception the exception */ private String getRootTerminologyPreferredName(OWLOntology ontology) throws Exception { // Get the rdfs:label property of the ontology itself for (OWLAnnotation annotation : ontology.getAnnotations()) { if (annotation.getProperty().isLabel()) { return getValue(annotation); } } // otherwise, just use the terminology name return terminology; }
@Nonnull public OBOXRef visit(@Nonnull org.semanticweb.owlapi.model.IRI iri) { String description = ""; for (OWLAnnotation anno : annoAnnos) { if (anno.getProperty().isLabel()) { description = anno.getValue().accept(new OWLAnnotationValueVisitorEx<String>() { @Nonnull public String visit(@Nonnull org.semanticweb.owlapi.model.IRI iri) { return iri.toString(); } @Nonnull public String visit(@Nonnull OWLAnonymousIndividual individual) { return individual.toString(); } @Nonnull public String visit(@Nonnull OWLLiteral literal) { return literal.getLiteral(); } }); break; } } return oboXRefConverter.toOBOXRef(iri.toString(), description); }
@Override @Nullable public String getPrefixIRI(IRI iri) { for (OWLAnnotationAssertionAxiom annotation : asList( ontology.annotationAssertionAxioms(iri))) { if (annotation.getProperty().isLabel()) { OWLAnnotationValue value = annotation.getValue(); if (value instanceof OWLLiteral) { return '<' + ((OWLLiteral) value).getLiteral() + '>'; } } } return delegate.getPrefixIRI(iri); }
@Override @Nullable public String getPrefixIRI(IRI iri) { for (OWLAnnotationAssertionAxiom annotation : asList( ontology.annotationAssertionAxioms(iri))) { if (annotation.getProperty().isLabel()) { OWLAnnotationValue value = annotation.getValue(); if (value instanceof OWLLiteral) { return '<' + ((OWLLiteral) value).getLiteral() + '>'; } } } return delegate.getPrefixIRI(iri); }
@Override @Nullable public String getPrefixIRI(IRI iri) { for (OWLAnnotationAssertionAxiom annotation : asList( ontology.annotationAssertionAxioms(iri))) { if (annotation.getProperty().isLabel()) { OWLAnnotationValue value = annotation.getValue(); if (value instanceof OWLLiteral) { return '<' + ((OWLLiteral) value).getLiteral() + '>'; } } } return delegate.getPrefixIRI(iri); }
@Override @Nullable public String getPrefixIRI(IRI iri) { for (OWLAnnotationAssertionAxiom annotation : asList( ontology.annotationAssertionAxioms(iri))) { if (annotation.getProperty().isLabel()) { OWLAnnotationValue value = annotation.getValue(); if (value instanceof OWLLiteral) { return '<' + ((OWLLiteral) value).getLiteral() + '>'; } } } return delegate.getPrefixIRI(iri); }
public String getPrefixIRI(IRI iri) { for (OWLAnnotationAssertionAxiom annotation : ontology.getAnnotationAssertionAxioms(iri)) { if (annotation.getProperty().isLabel()) { OWLAnnotationValue value = annotation.getValue(); if (value != null && value instanceof OWLLiteral) { return "<" + ((OWLLiteral) value).getLiteral() + ">"; } } } return super.getPrefixIRI(iri); } }
public static String getLabel(OWLOntology o, OWLEntity owlEntity) { String bestLabel = owlEntity.getIRI().toString(); for (OWLAnnotation annotation : EntitySearcher.getAnnotations(owlEntity, o)) { if (annotation.getProperty().isLabel()) { OWLLiteral value = (OWLLiteral) annotation.getValue(); bestLabel = value.getLiteral(); if (value.getLang().equals("") || value.getLang().equals("en")) { return bestLabel; } } } return bestLabel; }
/** * Retrieve an {@link IRI} by rdfs:label * * @param label * @return {@link IRI} or null */ IRI getIRIByLabel(String label) { IRI iri = null; for (OWLOntology o : ontologies) { Set<OWLAnnotationAssertionAxiom> aas = o.getAxioms(AxiomType.ANNOTATION_ASSERTION); for (OWLAnnotationAssertionAxiom aa : aas) { OWLAnnotationValue v = aa.getValue(); OWLAnnotationProperty property = aa.getProperty(); if (v instanceof OWLLiteral && property.isLabel()) { if (label.equals( ((OWLLiteral)v).getLiteral())) { OWLAnnotationSubject obj = aa.getSubject(); if (obj instanceof IRI) { return (IRI)obj; } } } } } return iri; }
@Override @Nullable public String getName(String id) { // convert OBO id to IRI OWLAPIObo2Owl obo2owl = new OWLAPIObo2Owl(ont.getOWLOntologyManager()); IRI iri = obo2owl.oboIdToIRI(id); // look for label of entity List<OWLAnnotationAssertionAxiom> axioms = asList(ont.axioms(OWLAnnotationAssertionAxiom.class, OWLAnnotationSubject.class, iri, Imports.INCLUDED, IN_SUB_POSITION)); for (OWLAnnotationAssertionAxiom axiom : axioms) { if (axiom.getProperty().isLabel()) { OWLAnnotationValue value = axiom.getValue(); if (value instanceof OWLLiteral) { return ((OWLLiteral) value).getLiteral(); } } } return null; }
@Override @Nullable public String getName(String id) { // convert OBO id to IRI OWLAPIObo2Owl obo2owl = new OWLAPIObo2Owl(ont.getOWLOntologyManager()); IRI iri = obo2owl.oboIdToIRI(id); // look for label of entity List<OWLAnnotationAssertionAxiom> axioms = asList(ont.axioms(OWLAnnotationAssertionAxiom.class, OWLAnnotationSubject.class, iri, Imports.INCLUDED, IN_SUB_POSITION)); for (OWLAnnotationAssertionAxiom axiom : axioms) { if (axiom.getProperty().isLabel()) { OWLAnnotationValue value = axiom.getValue(); if (value instanceof OWLLiteral) { return ((OWLLiteral) value).getLiteral(); } } } return null; }
@Override @Nullable public String getName(String id) { // convert OBO id to IRI OWLAPIObo2Owl obo2owl = new OWLAPIObo2Owl(ont.getOWLOntologyManager()); IRI iri = obo2owl.oboIdToIRI(id); // look for label of entity List<OWLAnnotationAssertionAxiom> axioms = asList(ont.axioms(OWLAnnotationAssertionAxiom.class, OWLAnnotationSubject.class, iri, Imports.INCLUDED, IN_SUB_POSITION)); for (OWLAnnotationAssertionAxiom axiom : axioms) { if (axiom.getProperty().isLabel()) { OWLAnnotationValue value = axiom.getValue(); if (value instanceof OWLLiteral) { return ((OWLLiteral) value).getLiteral(); } } } return null; }
@Override @Nullable public String getName(String id) { // convert OBO id to IRI OWLAPIObo2Owl obo2owl = new OWLAPIObo2Owl(ont.getOWLOntologyManager()); IRI iri = obo2owl.oboIdToIRI(id); // look for label of entity List<OWLAnnotationAssertionAxiom> axioms = asList(ont.axioms(OWLAnnotationAssertionAxiom.class, OWLAnnotationSubject.class, iri, Imports.INCLUDED, IN_SUB_POSITION)); for (OWLAnnotationAssertionAxiom axiom : axioms) { if (axiom.getProperty().isLabel()) { OWLAnnotationValue value = axiom.getValue(); if (value instanceof OWLLiteral) { return ((OWLLiteral) value).getLiteral(); } } } return null; }