001: /*****************************************************************************
002: * Source code information
003: * -----------------------
004: * Original author Ian Dickinson, HP Labs Bristol
005: * Author email Ian.Dickinson@hp.com
006: * Package Jena 2
007: * Web http://sourceforge.net/projects/jena/
008: * Created 10 Feb 2003
009: * Filename $RCSfile: Restriction.java,v $
010: * Revision $Revision: 1.14 $
011: * Release status $State: Exp $
012: *
013: * Last modified on $Date: 2008/01/02 12:06:42 $
014: * by $Author: andy_seaborne $
015: *
016: * (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
017: * (see footer for full conditions)
018: * ****************************************************************************/package com.hp.hpl.jena.ontology;
019:
020: // Imports
021: ///////////////
022: import com.hp.hpl.jena.rdf.model.*;
023:
024: /**
025: * <p>
026: * Interface that encapsulates a class description formed by restricting one or
027: * more properties to have constrained values and/or cardinalities.
028: * </p>
029: *
030: * @author Ian Dickinson, HP Labs
031: * (<a href="mailto:Ian.Dickinson@hp.com" >email</a>)
032: * @version CVS $Id: Restriction.java,v 1.14 2008/01/02 12:06:42 andy_seaborne Exp $
033: */
034: public interface Restriction extends OntClass {
035: // Constants
036: //////////////////////////////////
037:
038: // External signature methods
039: //////////////////////////////////
040:
041: // onProperty
042:
043: /**
044: * <p>Assert that the property that this restriction applies to is the given property. Any existing
045: * statements for <code>onProperty</code> will be removed.</p>
046: * @param prop The property that this restriction applies to
047: * @exception OntProfileException If the {@link Profile#ON_PROPERTY()} property is not supported in the current language profile.
048: */
049: public void setOnProperty(Property prop);
050:
051: /**
052: * <p>Answer the property that this property restriction applies to. If there is
053: * more than one such resource, an arbitrary selection is made (though well-defined property restrictions
054: * should not have more than one <code>onProperty</code> statement.</p>
055: * @return The property that this property restriction applies to
056: * @exception OntProfileException If the {@link Profile#ON_PROPERTY()} property is not supported in the current language profile.
057: */
058: public OntProperty getOnProperty();
059:
060: /**
061: * <p>Answer true if this restriction is a property restriction on the given property.</p>
062: * @param prop A property to test against
063: * @return True if this restriction is a restriction on <code>prop</code>
064: * @exception OntProfileException If the {@link Profile#ON_PROPERTY()} property is not supported in the current language profile.
065: */
066: public boolean onProperty(Property prop);
067:
068: /**
069: * <p>Remove the given property as the property that this restriction applies to. If this statement
070: * is not true of the current model, nothing happens.</p>
071: * @param prop The property to be removed as a the property that this restriction applies to
072: */
073: public void removeOnProperty(Property prop);
074:
075: // facets
076:
077: /**
078: * <p>Answer a view of this restriction as an all values from expression</p>
079: * @return This class, but viewed as an AllValuesFromRestriction node
080: * @exception ConversionException if the class cannot be converted to an all values from restriction
081: * given the lanuage profile and the current state of the underlying model.
082: */
083: public AllValuesFromRestriction asAllValuesFromRestriction();
084:
085: /**
086: * <p>Answer a view of this restriction as a some values from expression</p>
087: * @return This class, but viewed as a SomeValuesFromRestriction node
088: * @exception ConversionException if the class cannot be converted to an all values from restriction
089: * given the lanuage profile and the current state of the underlying model.
090: */
091: public SomeValuesFromRestriction asSomeValuesFromRestriction();
092:
093: /**
094: * <p>Answer a view of this restriction as a has value expression</p>
095: * @return This class, but viewed as a HasValueRestriction node
096: * @exception ConversionException if the class cannot be converted to a has value restriction
097: * given the lanuage profile and the current state of the underlying model.
098: */
099: public HasValueRestriction asHasValueRestriction();
100:
101: /**
102: * <p>Answer a view of this restriction as a cardinality restriction class expression</p>
103: * @return This class, but viewed as a CardinalityRestriction node
104: * @exception ConversionException if the class cannot be converted to a cardinality restriction
105: * given the lanuage profile and the current state of the underlying model.
106: */
107: public CardinalityRestriction asCardinalityRestriction();
108:
109: /**
110: * <p>Answer a view of this restriction as a min cardinality restriction class expression</p>
111: * @return This class, but viewed as a MinCardinalityRestriction node
112: * @exception ConversionException if the class cannot be converted to a min cardinality restriction
113: * given the lanuage profile and the current state of the underlying model.
114: */
115: public MinCardinalityRestriction asMinCardinalityRestriction();
116:
117: /**
118: * <p>Answer a view of this restriction as a max cardinality restriction class expression</p>
119: * @return This class, but viewed as a MaxCardinalityRestriction node
120: * @exception ConversionException if the class cannot be converted to a max cardinality restriction
121: * given the lanuage profile and the current state of the underlying model.
122: */
123: public MaxCardinalityRestriction asMaxCardinalityRestriction();
124:
125: // type tests
126:
127: /**
128: * <p>Answer true if this restriction is an all values from restriction</p>
129: * @return True if this is an allValuesFrom property restriction
130: * @exception ProfileException if {@link Profile#ALL_VALUES_FROM()} is not supported in the current profile
131: */
132: public boolean isAllValuesFromRestriction();
133:
134: /**
135: * <p>Answer true if this restriction is a some values from restriction</p>
136: * @return True if this is a someValuesFrom property restriction
137: * @exception ProfileException if {@link Profile#SOME_VALUES_FROM()} is not supported in the current profile
138: */
139: public boolean isSomeValuesFromRestriction();
140:
141: /**
142: * <p>Answer true if this restriction is a has value restriction</p>
143: * @return True if this is a hasValue property restriction
144: * @exception ProfileException if {@link Profile#HAS_VALUE()} is not supported in the current profile
145: */
146: public boolean isHasValueRestriction();
147:
148: /**
149: * <p>Answer true if this restriction is a cardinality restriction (ie is a property restriction
150: * constructed with an <code>owl:cardinality</code> operator, or similar). This is not a test for
151: * a restriction that tests cardinalities in general.</p>
152: * @return True if this is a cardinality property restriction
153: * @exception ProfileException if {@link Profile#CARDINALITY()} is not supported in the current profile
154: */
155: public boolean isCardinalityRestriction();
156:
157: /**
158: * <p>Answer true if this restriction is a min cardinality restriction (ie is a property restriction
159: * constructed with an <code>owl:minCardinality</code> operator, or similar). This is not a test for
160: * a restriction that tests cardinalities in general.</p>
161: * @return True if this is a minCardinality property restriction
162: * @exception ProfileException if {@link Profile#MIN_CARDINALITY()} is not supported in the current profile
163: */
164: public boolean isMinCardinalityRestriction();
165:
166: /**
167: * <p>Answer true if this restriction is a max cardinality restriction (ie is a property restriction
168: * constructed with an <code>owl:maxCardinality</code> operator, or similar). This is not a test for
169: * a restriction that tests cardinalities in general.</p>
170: * @return True if this is a maxCardinality property restriction
171: * @exception ProfileException if {@link Profile#MAX_CARDINALITY()} is not supported in the current profile
172: */
173: public boolean isMaxCardinalityRestriction();
174:
175: // conversions
176:
177: /**
178: * <p>Convert this restriction to an all values from class expression.</p>
179: * @param cls The class to which all values of the restricted property must belong, to be in the
180: * extension of this restriction
181: * @return This class, but converted to a AllValuesFromRestriction class expression
182: * @exception ProfileException if {@link Profile#ALL_VALUES_FROM()} is not supported in the current profile
183: */
184: public AllValuesFromRestriction convertToAllValuesFromRestriction(
185: Resource cls);
186:
187: /**
188: * <p>Convert this restriction to a some values from class expression</p>
189: * @param cls The class to which at least one value of the restricted property must belong, to be in the
190: * extension of this restriction
191: * @return This class, but converted to a SomeValuesFromRestriction node
192: * @exception ProfileException if {@link Profile#SOME_VALUES_FROM()} is not supported in the current profile
193: */
194: public SomeValuesFromRestriction convertToSomeValuesFromRestriction(
195: Resource cls);
196:
197: /**
198: * <p>Convert this restriction to a has value class expression</p>
199: * @param value The value which the restricted property must have, for resource to be
200: * in the extension of this restriction. Can be a resource or a literal.
201: * @return This class, but converted to a HasValueRestriction
202: * @exception ProfileException if {@link Profile#HAS_VALUE()} is not supported in the current profile
203: */
204: public HasValueRestriction convertToHasValueRestriction(
205: RDFNode value);
206:
207: /**
208: * <p>Convert this restriction to a cardinality restriction class expression</p>
209: * @param cardinality The exact cardinality for the restricted property
210: * @return This class, but converted to a CardinalityRestriction node
211: * @exception ProfileException if {@link Profile#CARDINALITY()} is not supported in the current profile
212: */
213: public CardinalityRestriction convertToCardinalityRestriction(
214: int cardinality);
215:
216: /**
217: * <p>Convert this restriction to a min cardinality restriction class expression</p>
218: * @param cardinality The minimum cardinality for the restricted property
219: * @return This class, but converted to a MinCardinalityRestriction node
220: * @exception ProfileException if {@link Profile#MIN_CARDINALITY()} is not supported in the current profile
221: */
222: public MinCardinalityRestriction convertToMinCardinalityRestriction(
223: int cardinality);
224:
225: /**
226: * <p>Convert this restriction to a max cardinality restriction class expression</p>
227: * @param cardinality The maximum cardinality for the restricted property
228: * @return This class, but converted to a MaxCardinalityRestriction node
229: * @exception ProfileException if {@link Profile#MAX_CARDINALITY()} is not supported in the current profile
230: */
231: public MaxCardinalityRestriction convertToMaxCardinalityRestriction(
232: int cardinality);
233:
234: }
235:
236: /*
237: (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
238: All rights reserved.
239:
240: Redistribution and use in source and binary forms, with or without
241: modification, are permitted provided that the following conditions
242: are met:
243:
244: 1. Redistributions of source code must retain the above copyright
245: notice, this list of conditions and the following disclaimer.
246:
247: 2. Redistributions in binary form must reproduce the above copyright
248: notice, this list of conditions and the following disclaimer in the
249: documentation and/or other materials provided with the distribution.
250:
251: 3. The name of the author may not be used to endorse or promote products
252: derived from this software without specific prior written permission.
253:
254: THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
255: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
256: OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
257: IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
258: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
259: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
260: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
261: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
262: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
263: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
264: */
|