/** * <p>Answer a property that is attached to the given model, which will either * be this property or a new property object with the same URI in the given * model. If the given model is an ontology model, make the new property object * an ontproperty.</p> * @param m A model * @return A property equal to this property that is attached to m. */ @Override public Property inModel( Model m ) { return (getModel() == m) ? this : m.createProperty( getURI() ); }
/** * <p>Answer a property that is attached to the given model, which will either * be this property or a new property object with the same URI in the given * model. If the given model is an ontology model, make the new property object * an ontproperty.</p> * @param m A model * @return A property equal to this property that is attached to m. */ @Override public Property inModel( Model m ) { return (getModel() == m) ? this : m.createProperty( getURI() ); }
/** * <p>Answer an iterator over the properties that are defined to be inverses of this property.</p> * @return An iterator over the properties that declare themselves the <code>inverseOf</code> this property. */ @Override public ExtendedIterator<OntProperty> listInverse() { return getModel().listStatements( null, getProfile().INVERSE_OF(), this ).mapWith( s -> s.getSubject().as( OntProperty.class ) ); }
/** * <p>Answer an iterator over the properties that are defined to be inverses of this property.</p> * @return An iterator over the properties that declare themselves the <code>inverseOf</code> this property. */ @Override public ExtendedIterator<OntProperty> listInverse() { return getModel().listStatements( null, getProfile().INVERSE_OF(), this ).mapWith( s -> s.getSubject().as( OntProperty.class ) ); }
/** * <p>Answer an iterator over any restrictions that mention this property as * the property that the restriction is adding some constraint to. For example:</p> * <code><pre><owl:Restriction> * <owl:onProperty rdf:resource="#childOf" /> * <owl:hasValue rdf:resource="#ian" /> * </owl:Restriction></pre></code> * <p><strong>Note</strong> that any such restrictions do not affect the global * semantics of this property itself. Restrictions define new class expressions, * and the property constraints are local to that class expression. This method * is provided as a convenience to assist callers to navigate the relationships * in the model.</p> * @return An iterator whose values are the restrictions from the local * model that reference this property. */ @Override public ExtendedIterator<Restriction> listReferringRestrictions() { return getModel().listStatements( null, getProfile().ON_PROPERTY(), this ) .mapWith( s -> s.getSubject().as( Restriction.class ) ); }
/** * <p>Answer an iterator over any restrictions that mention this property as * the property that the restriction is adding some constraint to. For example:</p> * <code><pre><owl:Restriction> * <owl:onProperty rdf:resource="#childOf" /> * <owl:hasValue rdf:resource="#ian" /> * </owl:Restriction></pre></code> * <p><strong>Note</strong> that any such restrictions do not affect the global * semantics of this property itself. Restrictions define new class expressions, * and the property constraints are local to that class expression. This method * is provided as a convenience to assist callers to navigate the relationships * in the model.</p> * @return An iterator whose values are the restrictions from the local * model that reference this property. */ @Override public ExtendedIterator<Restriction> listReferringRestrictions() { return getModel().listStatements( null, getProfile().ON_PROPERTY(), this ) .mapWith( s -> s.getSubject().as( Restriction.class ) ); }
/** * <p>Answer a property that is the sub-property of this property. If there is * more than one such property, an arbitrary selection is made.</p> * @return A sub-property of this property * @exception ProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public OntProperty getSubProperty() { checkProfile( getProfile().SUB_PROPERTY_OF(), "SUB_PROPERTY_OF" ); return getModel().listStatements( null, getProfile().SUB_PROPERTY_OF(), this ) .nextStatement() .getSubject() .as( OntProperty.class ); }
/** * <p>Answer a property that is the sub-property of this property. If there is * more than one such property, an arbitrary selection is made.</p> * @return A sub-property of this property * @exception ProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public OntProperty getSubProperty() { checkProfile( getProfile().SUB_PROPERTY_OF(), "SUB_PROPERTY_OF" ); return getModel().listStatements( null, getProfile().SUB_PROPERTY_OF(), this ) .nextStatement() .getSubject() .as( OntProperty.class ); }
/** * <p>Assert that this property is super-property of the given property. Any existing * statements for <code>subPropertyOf</code> on <code>prop</code> will be removed.</p> * @param prop The property that is a sub-property of this property * @exception ProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public void setSubProperty( Property prop ) { // first we have to remove all of the inverse sub-prop links checkProfile( getProfile().SUB_PROPERTY_OF(), "SUB_PROPERTY_OF" ); for (StmtIterator i = getModel().listStatements( null, getProfile().SUB_PROPERTY_OF(), this ); i.hasNext(); ) { i.removeNext(); } prop.as( OntProperty.class ).addSuperProperty( this ); }
/** * <p>Assert that this property is super-property of the given property. Any existing * statements for <code>subPropertyOf</code> on <code>prop</code> will be removed.</p> * @param prop The property that is a sub-property of this property * @exception ProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public void setSubProperty( Property prop ) { // first we have to remove all of the inverse sub-prop links checkProfile( getProfile().SUB_PROPERTY_OF(), "SUB_PROPERTY_OF" ); for (StmtIterator i = getModel().listStatements( null, getProfile().SUB_PROPERTY_OF(), this ); i.hasNext(); ) { i.removeNext(); } prop.as( OntProperty.class ).addSuperProperty( this ); }