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); }
/** * Returns the direct child properties of <code>prop</code> in all ontologies. * @param prop The <code>OWLAnnotationProperty</code> for which * we want the direct sub-properties. * @return A <code>Set</code> of <code>OWLAnnotationProperty</code>s * that are the direct sub-properties of <code>prop</code>. * * @see #getSubPropertyClosureOf(OWLObjectPropertyExpression) * @see #getSubPropertyReflexiveClosureOf(OWLObjectPropertyExpression) */ public Set<OWLAnnotationProperty> getSubAnnotationPropertiesOf( OWLAnnotationProperty prop) { Set<OWLAnnotationProperty> subProps = new HashSet<OWLAnnotationProperty>(); for (OWLOntology ont : this.getAllOntologies()) { //we need to iterate each annotation property, to get //its getSubAnnotationPropertyOfAxioms and see if prop is its parent //(there is no method "getSuperAnnotationPropertyOfAxioms"). for (OWLAnnotationProperty subProp : ont.getAnnotationPropertiesInSignature()) { for (OWLSubAnnotationPropertyOfAxiom ax: ont.getSubAnnotationPropertyOfAxioms(subProp)) { if (ax.getSuperProperty().equals(prop)) { subProps.add(subProp); } } } } return subProps; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } // superclass is responsible for null, identity, owlaxiom type and // annotations if (!(obj instanceof OWLSubAnnotationPropertyOfAxiom)) { return false; } OWLSubAnnotationPropertyOfAxiom other = (OWLSubAnnotationPropertyOfAxiom) obj; return subProperty.equals(other.getSubProperty()) && superProperty.equals(other.getSuperProperty()); }
@Override public OWLSubAnnotationPropertyOfAxiom visit( ElkSubAnnotationPropertyOfAxiom axiom) { return owlFactory_.getOWLSubAnnotationPropertyOfAxiom( convert(axiom.getSubAnnotationProperty()), convert(axiom.getSuperAnnotationProperty())); }
@Override public T visit(OWLSubAnnotationPropertyOfAxiom axiom) { throw new IllegalArgumentException( OWLSubAnnotationPropertyOfAxiom.class.getSimpleName() + " cannot be converted to " + getTargetClass().getSimpleName()); }
public static Set<OWLAnnotationProperty> getSubProperties(OWLAnnotationProperty superProp, Set<OWLOntology> ontologies) { Set<OWLAnnotationProperty> result = new HashSet<OWLAnnotationProperty>(); for (OWLOntology ont : ontologies) { for (OWLSubAnnotationPropertyOfAxiom ax : ont.getAxioms(AxiomType.SUB_ANNOTATION_PROPERTY_OF)) { if (ax.getSuperProperty().equals(superProp)) { result.add(ax.getSubProperty()); } } } return result; }
public static Set<OWLAnnotationProperty> getSuperProperties(OWLAnnotationProperty subProp, Set<OWLOntology> ontologies) { Set<OWLAnnotationProperty> result = new HashSet<OWLAnnotationProperty>(); for (OWLOntology ont : ontologies) { for (OWLSubAnnotationPropertyOfAxiom ax : ont.getAxioms(AxiomType.SUB_ANNOTATION_PROPERTY_OF)) { if (ax.getSubProperty().equals(subProp)) { result.add(ax.getSuperProperty()); } } } return result; }
/** * Convenience method for asserting a subAnnotationProperty relation * between a parent and child property in an ontology. * * @param ontology the current ontology * @param child the child property * @param parent the parent property * @return the axiom */ protected static OWLSubAnnotationPropertyOfAxiom assertSubAnnotationProperty( OWLOntology ontology, OWLAnnotationProperty child, OWLAnnotationProperty parent) { OWLOntologyManager manager = ontology.getOWLOntologyManager(); OWLDataFactory dataFactory = manager.getOWLDataFactory(); OWLSubAnnotationPropertyOfAxiom axiom = dataFactory.getOWLSubAnnotationPropertyOfAxiom( child, parent); manager.addAxiom(ontology, axiom); return axiom; }
@Override public Void visit(OWLSubAnnotationPropertyOfAxiom axiom) { long subProperty = getOrCreateNode(getIri(axiom.getSubProperty()), OwlLabels.OWL_ANNOTATION_PROPERTY); long superProperty = getOrCreateNode(getIri(axiom.getSuperProperty()), OwlLabels.OWL_ANNOTATION_PROPERTY); getOrCreateRelationship(subProperty, superProperty, OwlRelationships.RDFS_SUB_PROPERTY_OF); return null; }
@Override public OWLSubAnnotationPropertyOfAxiom getAxiomWithoutAnnotations() { if (!isAnnotated()) { return this; } return new OWLSubAnnotationPropertyOfAxiomImpl(getSubProperty(), getSuperProperty(), NO_ANNOTATIONS); }
@Override protected int compareObjectOfSameType(OWLObject object) { OWLSubAnnotationPropertyOfAxiom other = (OWLSubAnnotationPropertyOfAxiom) object; int diff = subProperty.compareTo(other.getSubProperty()); if (diff != 0) { return diff; } return superProperty.compareTo(other.getSuperProperty()); }
public void visit(OWLSubAnnotationPropertyOfAxiom axiom) { notSupported(axiom); }
public void visit(OWLSubAnnotationPropertyOfAxiom axiom) { }
public Boolean visit(OWLSubAnnotationPropertyOfAxiom axiom) { return Boolean.TRUE; }
@Override public ElkAnnotationAxiom visit(OWLSubAnnotationPropertyOfAxiom owlSubAnnotationPropertyOfAxiom) { return new ElkSubAnnotationPropertyOfAxiomWrap<OWLSubAnnotationPropertyOfAxiom>(owlSubAnnotationPropertyOfAxiom); }
@Override public ElkAxiom visit( OWLSubAnnotationPropertyOfAxiom owlSubAnnotationPropertyOfAxiom) { return CONVERTER.convert(owlSubAnnotationPropertyOfAxiom); }
@Override public void visit(OWLSubAnnotationPropertyOfAxiom axiom) { defaultVisit(axiom); }
@Override public OWLAxiom visit(OWLSubAnnotationPropertyOfAxiom axiom) { return factory.getOWLSubAnnotationPropertyOfAxiom(axiom.getSubProperty(), axiom.getSuperProperty(), annotations); }
@Override public void visit(OWLSubAnnotationPropertyOfAxiom axiom) { }
public void visit(OWLSubAnnotationPropertyOfAxiom arg0) { throw new NotImplementedException(); }
@Override public Boolean visit(OWLSubAnnotationPropertyOfAxiom axiom) { return true; }
@Override public Boolean visit(OWLSubAnnotationPropertyOfAxiom axiom) { return this.withAnnotations; }
@Override public Boolean visit(OWLSubAnnotationPropertyOfAxiom axiom) { Objects.requireNonNull(axiom); return add(this.df.getOWLSubAnnotationPropertyOfAxiom(axiom.getSubProperty(), axiom.getSuperProperty(), reg(axiom.getAnnotations()))); }
@Override public Boolean visit(OWLSubAnnotationPropertyOfAxiom axiom) { Objects.requireNonNull(axiom); return add( this.df.getOWLSubAnnotationPropertyOfAxiom(axiom.getSubProperty(), axiom.getSuperProperty(), empty())); }
@Override public Set<ComplexIntegerAxiom> visit(OWLSubAnnotationPropertyOfAxiom axiom) { Objects.requireNonNull(axiom); return Collections.emptySet(); }
@Override public void visit(OWLSubAnnotationPropertyOfAxiom axiom) { ignoreOwlAxiom("SubAnnotationPropertyOf", axiom); }
@Override public void visit(OWLSubAnnotationPropertyOfAxiom axiom) { annotationAxiomsNotSupportedWarning(axiom); }
@Override public O visit(OWLSubAnnotationPropertyOfAxiom axiom) { return doDefault(axiom); }
@Override public void visit(OWLSubAnnotationPropertyOfAxiom axiom) { handleDefault(axiom); }
@Override public void visit(OWLSubAnnotationPropertyOfAxiom axiom) { type = AXIOM_TYPE_INDEX_BASE + axiom.getAxiomType().getIndex(); }
@Override public OWLAxiom visit(OWLSubAnnotationPropertyOfAxiom axiom) { return axiom; }
@Override public void visit(OWLSubAnnotationPropertyOfAxiom axiom) { hashCode = primes[75]; hashCode = hashCode * MULT + axiom.getSubProperty().hashCode(); hashCode = hashCode * MULT + axiom.getSuperProperty().hashCode(); }
@Override public void visit(@Nonnull OWLSubAnnotationPropertyOfAxiom axiom) { axiom.getSubProperty().accept(this); axiom.getSuperProperty().accept(this); processAxiomAnnotations(axiom); }