@Override public Set<OWLDataPropertyExpression> getDataPropertyExpressions() { Set<OWLDataPropertyExpression> props = new TreeSet<>(); for (OWLPropertyExpression prop : propertyExpressions) { if (prop.isDataPropertyExpression()) { props.add((OWLDataPropertyExpression) prop); } } return props; }
public Set<OWLDataPropertyExpression> getDataPropertyExpressions() { Set<OWLDataPropertyExpression> props = new TreeSet<OWLDataPropertyExpression>(); for(OWLPropertyExpression prop : propertyExpressions) { if(prop.isDataPropertyExpression()) { props.add((OWLDataPropertyExpression) prop); } } return props; }
@Override @SuppressWarnings("rawtypes") // this is necessary to avoid java 6 issues public Set<OWLDataPropertyExpression> getDataPropertyExpressions() { Set<OWLDataPropertyExpression> props = new TreeSet<OWLDataPropertyExpression>(); for (OWLPropertyExpression prop : propertyExpressions) { if (prop.isDataPropertyExpression()) { props.add((OWLDataPropertyExpression) prop); } } return props; }
/** * @return this instance cast as an OWLDataPropertyExpression */ default OWLDataPropertyExpression asDataPropertyExpression() { if (isDataPropertyExpression()) { return (OWLDataPropertyExpression) this; } throw new ClassCastException(getClass().getName() + "is not an OWLDataPropertyExpression"); }
/** * @return this instance cast as an OWLDataPropertyExpression */ default OWLDataPropertyExpression asDataPropertyExpression() { if (isDataPropertyExpression()) { return (OWLDataPropertyExpression) this; } throw new ClassCastException(getClass().getName() + "is not an OWLDataPropertyExpression"); }
/** * @return this instance cast as an OWLDataPropertyExpression */ default OWLDataPropertyExpression asDataPropertyExpression() { if (isDataPropertyExpression()) { return (OWLDataPropertyExpression) this; } throw new ClassCastException(getClass().getName() + "is not an OWLDataPropertyExpression"); }
public boolean isSubProperty(OWLPropertyExpression normalizedSub, OWLPropertyExpression normalizedSup) { if (normalizedSub.isObjectPropertyExpression() ^ normalizedSup.isDataPropertyExpression()) { return false; } if (normalizedSub.isObjectPropertyExpression()) { return objPropTaxo.isSubsumedBy(normalizedSub, normalizedSup); } else { return dataPropTaxo.isSubsumedBy(normalizedSub, normalizedSup); } }
public Set<OWLPropertyExpression> getAllSubproperties( OWLPropertyExpression roleSup) { Set<OWLPropertyExpression> subs = new HashSet<OWLPropertyExpression>(); for (OWLPropertyExpression sub : roleSup.isDataPropertyExpression()? dataPropTaxo.getSubsumeesOrSelf(roleSup) : objPropTaxo.getSubsumeesOrSelf(roleSup)) { if (!sub.isAnonymous()) { subs.add(sub); } else { //OWLObjectProperty op = ((OWLObjectPropertyExpression) c).getNamedProperty(); //fac.getOWLObjectProperty(IRI.create(sub.getInverse().getName().getAFun().getName())); //if (oprops.contains(op)) { subs.add(sub); } //else { // do nothing: inverse of a create role R, where R is defined as equivalent to the inverse of an existing role //} } } subs.remove(dataPropTaxo.getBottom()); subs.remove(objPropTaxo.getBottom()); subs.remove(fac.getOWLObjectInverseOf((OWLObjectPropertyExpression) objPropTaxo.getBottom()).getSimplified()); return subs; }
public OWLProperty getNamedProperty(OWLPropertyExpression propexp) { OWLProperty ret; if (!propexp.isAnonymous()) { if (propexp.isDataPropertyExpression()) { ret = ((OWLDataPropertyExpression) propexp).asOWLDataProperty();; } else { ret = ((OWLObjectPropertyExpression) propexp).asOWLObjectProperty(); } } else { assert propexp.isObjectPropertyExpression(); ret = ((OWLObjectPropertyExpression) propexp).getNamedProperty(); } return ret; }
/** * Gets the properties which are asserted to be sub-properties of this property in the specified * ontology. * * @param e entity * @param ontology The ontology to be examined for SubProperty axioms. * @return A set of properties such that for each property {@code p} in the set, it is the case * that {@code ontology} contains an {@code SubPropertyOf(p, this)} axiom where * {@code this} refers to this property. * @since 3.2 */ public static <P extends OWLPropertyExpression> Stream<P> getSuperProperties(P e, OWLOntology ontology) { if (e.isObjectPropertyExpression()) { return Searcher.sup(ontology.axioms(subObjectPropertyWithSub, e, EXCLUDED)); } if (e.isDataPropertyExpression()) { return Searcher.sup(ontology.axioms(subDataPropertyWithSub, e, EXCLUDED)); } return Searcher.sup(ontology.axioms(subAnnotationWithSub, e, EXCLUDED)); }
/** * Gets the properties which are asserted to be sub-properties of this property in the specified * ontology. * * @param e entity * @param ontology The ontology to be examined for SubProperty axioms. * @return A set of properties such that for each property {@code p} in the set, it is the case * that {@code ontology} contains an {@code SubPropertyOf(p, this)} axiom where * {@code this} refers to this property. * @since 3.2 */ public static <P extends OWLPropertyExpression> Stream<P> getSubProperties(P e, OWLOntology ontology) { if (e.isObjectPropertyExpression()) { return Searcher.sub(ontology.axioms(subObjectPropertyWithSuper, e, EXCLUDED)); } if (e.isDataPropertyExpression()) { return Searcher.sub(ontology.axioms(subDataPropertyWithSuper, e, EXCLUDED)); } return Searcher.sub(ontology.axioms(subAnnotationWithSuper, e, EXCLUDED)); }
/** * Gets the properties which are asserted to be sub-properties of this property in the specified * ontology. * * @param e entity * @param ontology The ontology to be examined for SubProperty axioms. * @return A set of properties such that for each property {@code p} in the set, it is the case * that {@code ontology} contains an {@code SubPropertyOf(p, this)} axiom where * {@code this} refers to this property. * @since 3.2 */ public static <P extends OWLPropertyExpression> Stream<P> getSuperProperties(P e, OWLOntology ontology) { if (e.isObjectPropertyExpression()) { return Searcher.sup(ontology.axioms(subObjectPropertyWithSub, e, EXCLUDED)); } if (e.isDataPropertyExpression()) { return Searcher.sup(ontology.axioms(subDataPropertyWithSub, e, EXCLUDED)); } return Searcher.sup(ontology.axioms(subAnnotationWithSub, e, EXCLUDED)); }
/** * Gets the classes which have been asserted to be disjoint with this class by axioms in the * specified ontology. * * @param e entity * @param ontology The ontology to search for disjoint class axioms * @return A {@code Set} of {@code OWLClassExpression}s that represent the disjoint classes of * this class. */ public static <P extends OWLPropertyExpression> Stream<P> getDisjointProperties(P e, OWLOntology ontology) { if (e.isObjectPropertyExpression()) { return Searcher .different(ontology.disjointObjectPropertiesAxioms(e.asObjectPropertyExpression())); } if (e.isDataPropertyExpression()) { return Searcher.different(ontology.disjointDataPropertiesAxioms((OWLDataProperty) e)); } // else e must have been an annotation property. No disjoints on those return empty(); }
/** * Gets the classes which have been asserted to be disjoint with this class by axioms in the * specified ontology. * * @param e entity * @param ontology The ontology to search for disjoint class axioms * @return A {@code Set} of {@code OWLClassExpression}s that represent the disjoint classes of * this class. */ public static <P extends OWLPropertyExpression> Stream<P> getDisjointProperties(P e, OWLOntology ontology) { if (e.isObjectPropertyExpression()) { return Searcher .different(ontology.disjointObjectPropertiesAxioms(e.asObjectPropertyExpression())); } if (e.isDataPropertyExpression()) { return Searcher.different(ontology.disjointDataPropertiesAxioms((OWLDataProperty) e)); } // else e must have been an annotation property. No disjoints on those return empty(); }
/** * Gets the properties which are asserted to be sub-properties of this property in the specified * ontology. * * @param e entity * @param ontology The ontology to be examined for SubProperty axioms. * @return A set of properties such that for each property {@code p} in the set, it is the case * that {@code ontology} contains an {@code SubPropertyOf(p, this)} axiom where * {@code this} refers to this property. * @since 3.2 */ public static <P extends OWLPropertyExpression> Stream<P> getSuperProperties(P e, OWLOntology ontology) { if (e.isObjectPropertyExpression()) { return Searcher.sup(ontology.axioms(subObjectPropertyWithSub, e, EXCLUDED)); } if (e.isDataPropertyExpression()) { return Searcher.sup(ontology.axioms(subDataPropertyWithSub, e, EXCLUDED)); } return Searcher.sup(ontology.axioms(subAnnotationWithSub, e, EXCLUDED)); }
/** * Gets the properties which are asserted to be sub-properties of this property in the specified * ontology. * * @param e entity * @param ontology The ontology to be examined for SubProperty axioms. * @return A set of properties such that for each property {@code p} in the set, it is the case * that {@code ontology} contains an {@code SubPropertyOf(p, this)} axiom where * {@code this} refers to this property. * @since 3.2 */ public static <P extends OWLPropertyExpression> Stream<P> getSubProperties(P e, OWLOntology ontology) { if (e.isObjectPropertyExpression()) { return Searcher.sub(ontology.axioms(subObjectPropertyWithSuper, e, EXCLUDED)); } if (e.isDataPropertyExpression()) { return Searcher.sub(ontology.axioms(subDataPropertyWithSuper, e, EXCLUDED)); } return Searcher.sub(ontology.axioms(subAnnotationWithSuper, e, EXCLUDED)); }
/** * Gets the classes which have been asserted to be disjoint with this class by axioms in the * specified ontology. * * @param e entity * @param ontology The ontology to search for disjoint class axioms * @return A {@code Set} of {@code OWLClassExpression}s that represent the disjoint classes of * this class. */ public static <P extends OWLPropertyExpression> Stream<P> getDisjointProperties(P e, OWLOntology ontology) { if (e.isObjectPropertyExpression()) { return Searcher .different(ontology.disjointObjectPropertiesAxioms(e.asObjectPropertyExpression())); } if (e.isDataPropertyExpression()) { return Searcher.different(ontology.disjointDataPropertiesAxioms((OWLDataProperty) e)); } // else e must have been an annotation property. No disjoints on those return empty(); }
/** * Gets the properties which are asserted to be sub-properties of this property in the specified * ontology. * * @param e entity * @param ontology The ontology to be examined for SubProperty axioms. * @return A set of properties such that for each property {@code p} in the set, it is the case * that {@code ontology} contains an {@code SubPropertyOf(p, this)} axiom where * {@code this} refers to this property. * @since 3.2 */ public static <P extends OWLPropertyExpression> Stream<P> getSubProperties(P e, OWLOntology ontology) { if (e.isObjectPropertyExpression()) { return Searcher.sub(ontology.axioms(subObjectPropertyWithSuper, e, EXCLUDED)); } if (e.isDataPropertyExpression()) { return Searcher.sub(ontology.axioms(subDataPropertyWithSuper, e, EXCLUDED)); } return Searcher.sub(ontology.axioms(subAnnotationWithSuper, e, EXCLUDED)); }
public String getName(OWLPropertyExpression propexp) { String name; if (!propexp.isAnonymous()) { if (propexp.isDataPropertyExpression()) { name = ((OWLDataPropertyExpression) propexp).asOWLDataProperty().getIRI().toString(); } else { name = ((OWLObjectPropertyExpression) propexp).asOWLObjectProperty().getIRI().toString(); } } else { assert propexp.isObjectPropertyExpression(); name = ((OWLObjectPropertyExpression) propexp).getNamedProperty().getIRI().toString(); } return name; }
public String getName(OWLPropertyExpression propexp) { String name; if (!propexp.isAnonymous()) { if (propexp.isDataPropertyExpression()) { name = ((OWLDataPropertyExpression) propexp).asOWLDataProperty().getIRI().toString(); } else { name = ((OWLObjectPropertyExpression) propexp).asOWLObjectProperty().getIRI().toString(); } } else { assert propexp.isObjectPropertyExpression(); name = ((OWLObjectPropertyExpression) propexp).getNamedProperty().getIRI().toString(); } return name; } /**