KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > ontology > Restriction


1 /*****************************************************************************
2  * Source code information
3  * -----------------------
4  * Original author Ian Dickinson, HP Labs Bristol
5  * Author email Ian.Dickinson@hp.com
6  * Package Jena 2
7  * Web http://sourceforge.net/projects/jena/
8  * Created 10 Feb 2003
9  * Filename $RCSfile: Restriction.java,v $
10  * Revision $Revision: 1.11 $
11  * Release status $State: Exp $
12  *
13  * Last modified on $Date: 2005/02/21 12:04:42 $
14  * by $Author: andy_seaborne $
15  *
16  * (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
17  * (see footer for full conditions)
18  * ****************************************************************************/

19
20 // Package
21
///////////////
22
package com.hp.hpl.jena.ontology;
23
24
25
26 // Imports
27
///////////////
28
import com.hp.hpl.jena.rdf.model.*;
29
30
31 /**
32  * <p>
33  * Interface that encapsulates a class description formed by restricting one or
34  * more properties to have constrained values and/or cardinalities.
35  * </p>
36  *
37  * @author Ian Dickinson, HP Labs
38  * (<a HREF="mailto:Ian.Dickinson@hp.com" >email</a>)
39  * @version CVS $Id: Restriction.java,v 1.11 2005/02/21 12:04:42 andy_seaborne Exp $
40  */

41 public interface Restriction
42     extends OntClass
43 {
44     // Constants
45
//////////////////////////////////
46

47
48     // External signature methods
49
//////////////////////////////////
50

51     // onProperty
52

53     /**
54      * <p>Assert that the property that this restriction applies to is the given property. Any existing
55      * statements for <code>onProperty</code> will be removed.</p>
56      * @param prop The property that this restriction applies to
57      * @exception OntProfileException If the {@link Profile#ON_PROPERTY()} property is not supported in the current language profile.
58      */

59     public void setOnProperty( Property prop );
60
61     /**
62      * <p>Answer the property that this property restriction applies to. If there is
63      * more than one such resource, an arbitrary selection is made (though well-defined property restrictions
64      * should not have more than one <code>onProperty</code> statement.</p>
65      * @return The property that this property restriction applies to
66      * @exception OntProfileException If the {@link Profile#ON_PROPERTY()} property is not supported in the current language profile.
67      */

68     public OntProperty getOnProperty();
69
70     /**
71      * <p>Answer true if this restriction is a property restriction on the given property.</p>
72      * @param prop A property to test against
73      * @return True if this restriction is a restriction on <code>prop</code>
74      * @exception OntProfileException If the {@link Profile#ON_PROPERTY()} property is not supported in the current language profile.
75      */

76     public boolean onProperty( Property prop );
77     
78     /**
79      * <p>Remove the given property as the property that this restriction applies to. If this statement
80      * is not true of the current model, nothing happens.</p>
81      * @param prop The property to be removed as a the property that this restriction applies to
82      */

83     public void removeOnProperty( Property prop );
84     
85
86
87     // facets
88

89     /**
90      * <p>Answer a view of this restriction as an all values from expression</p>
91      * @return This class, but viewed as an AllValuesFromRestriction node
92      * @exception ConversionException if the class cannot be converted to an all values from restriction
93      * given the lanuage profile and the current state of the underlying model.
94      */

95     public AllValuesFromRestriction asAllValuesFromRestriction();
96          
97     /**
98      * <p>Answer a view of this restriction as a some values from expression</p>
99      * @return This class, but viewed as a SomeValuesFromRestriction node
100      * @exception ConversionException if the class cannot be converted to an all values from restriction
101      * given the lanuage profile and the current state of the underlying model.
102      */

103     public SomeValuesFromRestriction asSomeValuesFromRestriction();
104          
105     /**
106      * <p>Answer a view of this restriction as a has value expression</p>
107      * @return This class, but viewed as a HasValueRestriction node
108      * @exception ConversionException if the class cannot be converted to a has value restriction
109      * given the lanuage profile and the current state of the underlying model.
110      */

111     public HasValueRestriction asHasValueRestriction();
112          
113     /**
114      * <p>Answer a view of this restriction as a cardinality restriction class expression</p>
115      * @return This class, but viewed as a CardinalityRestriction node
116      * @exception ConversionException if the class cannot be converted to a cardinality restriction
117      * given the lanuage profile and the current state of the underlying model.
118      */

119     public CardinalityRestriction asCardinalityRestriction();
120
121     /**
122      * <p>Answer a view of this restriction as a min cardinality restriction class expression</p>
123      * @return This class, but viewed as a MinCardinalityRestriction node
124      * @exception ConversionException if the class cannot be converted to a min cardinality restriction
125      * given the lanuage profile and the current state of the underlying model.
126      */

127     public MinCardinalityRestriction asMinCardinalityRestriction();
128
129     /**
130      * <p>Answer a view of this restriction as a max cardinality restriction class expression</p>
131      * @return This class, but viewed as a MaxCardinalityRestriction node
132      * @exception ConversionException if the class cannot be converted to a max cardinality restriction
133      * given the lanuage profile and the current state of the underlying model.
134      */

135     public MaxCardinalityRestriction asMaxCardinalityRestriction();
136
137
138     // type tests
139

140     /**
141      * <p>Answer true if this restriction is an all values from restriction</p>
142      * @return True if this is an allValuesFrom property restriction
143      * @exception ProfileException if {@link Profile#ALL_VALUES_FROM()} is not supported in the current profile
144      */

145     public boolean isAllValuesFromRestriction();
146          
147     /**
148      * <p>Answer true if this restriction is a some values from restriction</p>
149      * @return True if this is a someValuesFrom property restriction
150      * @exception ProfileException if {@link Profile#SOME_VALUES_FROM()} is not supported in the current profile
151      */

152     public boolean isSomeValuesFromRestriction();
153          
154     /**
155      * <p>Answer true if this restriction is a has value restriction</p>
156      * @return True if this is a hasValue property restriction
157      * @exception ProfileException if {@link Profile#HAS_VALUE()} is not supported in the current profile
158      */

159     public boolean isHasValueRestriction();
160          
161     /**
162      * <p>Answer true if this restriction is a cardinality restriction (ie is a property restriction
163      * constructed with an <code>owl:cardinality</code> operator, or similar). This is not a test for
164      * a restriction that tests cardinalities in general.</p>
165      * @return True if this is a cardinality property restriction
166      * @exception ProfileException if {@link Profile#CARDINALITY()} is not supported in the current profile
167      */

168     public boolean isCardinalityRestriction();
169
170     /**
171      * <p>Answer true if this restriction is a min cardinality restriction (ie is a property restriction
172      * constructed with an <code>owl:minCardinality</code> operator, or similar). This is not a test for
173      * a restriction that tests cardinalities in general.</p>
174      * @return True if this is a minCardinality property restriction
175      * @exception ProfileException if {@link Profile#MIN_CARDINALITY()} is not supported in the current profile
176      */

177     public boolean isMinCardinalityRestriction();
178
179     /**
180      * <p>Answer true if this restriction is a max cardinality restriction (ie is a property restriction
181      * constructed with an <code>owl:maxCardinality</code> operator, or similar). This is not a test for
182      * a restriction that tests cardinalities in general.</p>
183      * @return True if this is a maxCardinality property restriction
184      * @exception ProfileException if {@link Profile#MAX_CARDINALITY()} is not supported in the current profile
185      */

186     public boolean isMaxCardinalityRestriction();
187
188
189     // conversions
190

191     /**
192      * <p>Convert this restriction to an all values from class expression.</p>
193      * @param cls The class to which all values of the restricted property must belong, to be in the
194      * extension of this restriction
195      * @return This class, but converted to a AllValuesFromRestriction class expression
196      * @exception ProfileException if {@link Profile#ALL_VALUES_FROM()} is not supported in the current profile
197      */

198     public AllValuesFromRestriction convertToAllValuesFromRestriction( Resource cls );
199          
200     /**
201      * <p>Convert this restriction to a some values from class expression</p>
202      * @param cls The class to which at least one value of the restricted property must belong, to be in the
203      * extension of this restriction
204      * @return This class, but converted to a SomeValuesFromRestriction node
205      * @exception ProfileException if {@link Profile#SOME_VALUES_FROM()} is not supported in the current profile
206      */

207     public SomeValuesFromRestriction convertToSomeValuesFromRestriction( Resource cls );
208          
209     /**
210      * <p>Convert this restriction to a has value class expression</p>
211      * @param value The value which the restricted property must have, for resource to be
212      * in the extension of this restriction. Can be a resource or a literal.
213      * @return This class, but converted to a HasValueRestriction
214      * @exception ProfileException if {@link Profile#HAS_VALUE()} is not supported in the current profile
215      */

216     public HasValueRestriction convertToHasValueRestriction( RDFNode value );
217          
218     /**
219      * <p>Convert this restriction to a cardinality restriction class expression</p>
220      * @param cardinality The exact cardinality for the restricted property
221      * @return This class, but converted to a CardinalityRestriction node
222      * @exception ProfileException if {@link Profile#CARDINALITY()} is not supported in the current profile
223      */

224     public CardinalityRestriction convertToCardinalityRestriction( int cardinality );
225
226     /**
227      * <p>Convert this restriction to a min cardinality restriction class expression</p>
228      * @param cardinality The minimum cardinality for the restricted property
229      * @return This class, but converted to a MinCardinalityRestriction node
230      * @exception ProfileException if {@link Profile#MIN_CARDINALITY()} is not supported in the current profile
231      */

232     public MinCardinalityRestriction convertToMinCardinalityRestriction( int cardinality );
233
234     /**
235      * <p>Convert this restriction to a max cardinality restriction class expression</p>
236      * @param cardinality The maximum cardinality for the restricted property
237      * @return This class, but converted to a MaxCardinalityRestriction node
238      * @exception ProfileException if {@link Profile#MAX_CARDINALITY()} is not supported in the current profile
239      */

240     public MaxCardinalityRestriction convertToMaxCardinalityRestriction( int cardinality );
241
242 }
243
244
245 /*
246     (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
247     All rights reserved.
248
249     Redistribution and use in source and binary forms, with or without
250     modification, are permitted provided that the following conditions
251     are met:
252
253     1. Redistributions of source code must retain the above copyright
254        notice, this list of conditions and the following disclaimer.
255
256     2. Redistributions in binary form must reproduce the above copyright
257        notice, this list of conditions and the following disclaimer in the
258        documentation and/or other materials provided with the distribution.
259
260     3. The name of the author may not be used to endorse or promote products
261        derived from this software without specific prior written permission.
262
263     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
264     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
265     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
266     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
267     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
268     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
269     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
270     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
271     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
272     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273 */

274
275
Popular Tags