/** * <p>Remove the statement that this restriction has the given class * as the class to which all values must belong. If this statement * is not true of the current model, nothing happens.</p> * @param cls The ont class that is the object of the <code>hasClassQ</code> property. */ @Override public void removeHasClassQ( OntClass cls ) { Property has_class_q = getProfile().HAS_CLASS_Q(); removePropertyValue( has_class_q, "HAS_CLASS_Q", cls ); }
/** * <p>Assert that this qualified restriction restricts the property to have a given * cardinality and to have values belonging to the class denoted by <code>hasClassQ</code>. * Any existing statements for <code>hasClassQ</code> * will be removed.</p> * @param cls The class to which all of the value of the restricted property must belong * @exception OntProfileException If the {@link Profile#HAS_CLASS_Q()} property is not supported in the current language profile. */ @Override public void setHasClassQ( OntClass cls ) { setPropertyValue( getProfile().HAS_CLASS_Q(), "HAS_CLASS_Q", cls ); }
/** * <p>Answer true if this qualified property restriction has the given datarange as * the class to which all of the property values must belong.</p> * @param dr The datarange to test against * @return True if the given class is the class to which all members of this restriction must belong * @exception OntProfileException If the {@link Profile#HAS_CLASS_Q()} property is not supported in the current language profile. */ @Override public boolean hasHasClassQ( DataRange dr ) { return hasPropertyValue( getProfile().HAS_CLASS_Q(), "HAS_CLASS_Q", dr ); }
/** * <p>Answer true if this qualified property restriction has the given class as * the class to which all of the property values must belong.</p> * @param cls The class to test against * @return True if the given class is the class to which all members of this restriction must belong * @exception OntProfileException If the {@link Profile#HAS_CLASS_Q()} property is not supported in the current language profile. */ @Override public boolean hasHasClassQ( OntClass cls ) { return hasPropertyValue( getProfile().HAS_CLASS_Q(), "HAS_CLASS_Q", cls ); }
/** * <p>Remove the statement that this restriction has the given datarange * as the class to which all values must belong. If this statement * is not true of the current model, nothing happens.</p> * @param dr The datarange that is the object of the <code>hasClassQ</code> property. */ @Override public void removeHasClassQ( DataRange dr ) { removePropertyValue( getProfile().HAS_CLASS_Q(), "HAS_CLASS_Q", dr ); }
/** * <p>Answer the class or datarnage to which all values of the restricted property belong.</p> * @return The ontology class of the restricted property values * @exception OntProfileException If the {@link Profile#HAS_CLASS_Q()} property is not supported in the current language profile. */ @Override public OntResource getHasClassQ() { checkProfile( getProfile().HAS_CLASS_Q(), "HAS_CLASS_Q" ); Resource r = getProperty( getProfile().HAS_CLASS_Q() ).getResource(); if (r.canAs( OntClass.class )) { return r.as( OntClass.class ); } else if (r.canAs( DataRange.class )) { return r.as( DataRange.class ); } else { return r.as( OntResource.class ); } }
/** * <p>Answer a class description defined as the class of those individuals that have at least * the given number of values for the given property, all values of which belong to the given * class.</p> * * @param uri The optional URI for the restriction, or null for an anonymous restriction (which * should be the normal case) * @param prop The property the restriction applies to * @param cardinality The minimun cardinality of the property * @param cls The class to which all values of the restricted property should belong * @return A new resource representing a mas-cardinality restriction */ @Override public MinCardinalityQRestriction createMinCardinalityQRestriction( String uri, Property prop, int cardinality, OntClass cls ) { checkProfileEntry( getProfile().RESTRICTION(), "RESTRICTION" ); checkProfileEntry( getProfile().ON_PROPERTY(), "ON_PROPERTY" ); checkProfileEntry( getProfile().MIN_CARDINALITY_Q(), "MIN_CARDINALITY_Q" ); checkProfileEntry( getProfile().HAS_CLASS_Q(), "HAS_CLASS_Q" ); if (prop == null) { throw new IllegalArgumentException( "Cannot create MinCardinalityQRestriction with a null property" ); } if (cls == null) { throw new IllegalArgumentException( "Cannot create MinCardinalityQRestriction with a null class" ); } Restriction r = createOntResource( Restriction.class, getProfile().RESTRICTION(), uri ); r.addProperty( getProfile().ON_PROPERTY(), prop ); r.addProperty( getProfile().MIN_CARDINALITY_Q(), createTypedLiteral( cardinality ) ); r.addProperty( getProfile().HAS_CLASS_Q(), cls ); return r.as( MinCardinalityQRestriction.class ); }
/** * <p>Answer a class description defined as the class of those individuals that have at most * the given number of values for the given property, all values of which belong to the given * class.</p> * * @param uri The optional URI for the restriction, or null for an anonymous restriction (which * should be the normal case) * @param prop The property the restriction applies to * @param cardinality The maximum cardinality of the property * @param cls The class to which all values of the restricted property should belong * @return A new resource representing a mas-cardinality restriction */ @Override public MaxCardinalityQRestriction createMaxCardinalityQRestriction( String uri, Property prop, int cardinality, OntClass cls ) { checkProfileEntry( getProfile().RESTRICTION(), "RESTRICTION" ); checkProfileEntry( getProfile().ON_PROPERTY(), "ON_PROPERTY" ); checkProfileEntry( getProfile().MAX_CARDINALITY_Q(), "MAX_CARDINALITY_Q" ); checkProfileEntry( getProfile().HAS_CLASS_Q(), "HAS_CLASS_Q" ); if (prop == null) { throw new IllegalArgumentException( "Cannot create MaxCardinalityQRestriction with a null property" ); } if (cls == null) { throw new IllegalArgumentException( "Cannot create MaxCardinalityQRestriction with a null class" ); } Restriction r = createOntResource( Restriction.class, getProfile().RESTRICTION(), uri ); r.addProperty( getProfile().ON_PROPERTY(), prop ); r.addProperty( getProfile().MAX_CARDINALITY_Q(), createTypedLiteral( cardinality ) ); r.addProperty( getProfile().HAS_CLASS_Q(), cls ); return r.as( MaxCardinalityQRestriction.class ); }
/** * <p>Answer a class description defined as the class of those individuals that have exactly * the given number of values for the given property, all values of which belong to the given * class.</p> * * @param uri The optional URI for the restriction, or null for an anonymous restriction (which * should be the normal case) * @param prop The property the restriction applies to * @param cardinality The cardinality of the property * @param cls The class to which all values of the restricted property should belong * @return A new resource representing a mas-cardinality restriction */ @Override public CardinalityQRestriction createCardinalityQRestriction( String uri, Property prop, int cardinality, OntClass cls ) { checkProfileEntry( getProfile().RESTRICTION(), "RESTRICTION" ); checkProfileEntry( getProfile().ON_PROPERTY(), "ON_PROPERTY" ); checkProfileEntry( getProfile().CARDINALITY_Q(), "CARDINALITY_Q" ); checkProfileEntry( getProfile().HAS_CLASS_Q(), "HAS_CLASS_Q" ); if (prop == null) { throw new IllegalArgumentException( "Cannot create CardinalityQRestriction with a null property" ); } if (cls == null) { throw new IllegalArgumentException( "Cannot create CardinalityQRestriction with a null class" ); } Restriction r = createOntResource( Restriction.class, getProfile().RESTRICTION(), uri ); r.addProperty( getProfile().ON_PROPERTY(), prop ); r.addProperty( getProfile().CARDINALITY_Q(), createTypedLiteral( cardinality ) ); r.addProperty( getProfile().HAS_CLASS_Q(), cls ); return r.as( CardinalityQRestriction.class ); }