KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > ontology > daml > impl > DAMLRestrictionImpl


1 /*****************************************************************************
2  * Source code information
3  * -----------------------
4  * Original author Ian Dickinson, HP Labs Bristol
5  * Author email Ian.Dickinson@hp.com
6  * Package Jena
7  * Created 4 Jan 2001
8  * Filename $RCSfile: DAMLRestrictionImpl.java,v $
9  * Revision $Revision: 1.7 $
10  * Release status Preview-release $State: Exp $
11  *
12  * Last modified on $Date: 2005/02/21 12:05:29 $
13  * by $Author: andy_seaborne $
14  *
15  * (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
16  * (see footer for full conditions)
17  *****************************************************************************/

18
19 // Package
20
///////////////
21
package com.hp.hpl.jena.ontology.daml.impl;
22
23
24 // Imports
25
///////////////
26

27 import com.hp.hpl.jena.enhanced.*;
28 import com.hp.hpl.jena.graph.*;
29 import com.hp.hpl.jena.ontology.*;
30 import com.hp.hpl.jena.ontology.daml.*;
31 import com.hp.hpl.jena.vocabulary.*;
32
33
34 /**
35  * <p>Java encapsulation of a DAML Restriction.</p>
36  *
37  * @author Ian Dickinson, HP Labs (<a HREF="mailto:Ian.Dickinson@hp.com">email</a>)
38  * @version CVS info: $Id: DAMLRestrictionImpl.java,v 1.7 2005/02/21 12:05:29 andy_seaborne Exp $
39  */

40 public class DAMLRestrictionImpl
41     extends DAMLClassImpl
42     implements DAMLRestriction
43 {
44     // Constants
45
//////////////////////////////////
46

47
48     // Static variables
49
//////////////////////////////////
50

51     /**
52      * A factory for generating DAMLRestriction facets from nodes in enhanced graphs.
53      * Note: should not be invoked directly by user code: use
54      * {@link com.hp.hpl.jena.rdf.model.RDFNode#as as()} instead.
55      */

56     public static Implementation factory = new Implementation() {
57         public EnhNode wrap( Node n, EnhGraph eg ) {
58             if (canWrap( n, eg )) {
59                 return new DAMLRestrictionImpl( n, eg );
60             }
61             else {
62                 throw new ConversionException( "Cannot convert node " + n.toString() + " to DAMLRestriction" );
63             }
64         }
65             
66         public boolean canWrap( Node n, EnhGraph g ) {
67             return hasType( n, g, DAML_OIL.Restriction );
68         }
69     };
70
71     // Instance variables
72
//////////////////////////////////
73

74     /** Property accessor for onProperty */
75     private PropertyAccessor m_propOnProperty = new PropertyAccessorImpl( getVocabulary().onProperty(), this );
76
77     /** Property accessor for hasClass */
78     private PropertyAccessor m_propHasClass = new PropertyAccessorImpl( getVocabulary().hasClass(), this );
79
80     /** Property accessor for toClass */
81     private PropertyAccessor m_propToClass = new PropertyAccessorImpl( getVocabulary().toClass(), this );
82
83     /** Property accessor for hasValue */
84     private PropertyAccessor m_propHasValue = new PropertyAccessorImpl( getVocabulary().hasValue(), this );
85
86     /** Property accessor for hasClassQ */
87     private PropertyAccessor m_propHasClassQ = new PropertyAccessorImpl( getVocabulary().hasClassQ(), this );
88
89     /** Property accessor for cardinality */
90     private IntLiteralAccessor m_propCardinality = new IntLiteralAccessorImpl( getVocabulary().cardinality(), this );
91
92     /** Property accessor for minCardinality */
93     private IntLiteralAccessor m_propMinCardinality = new IntLiteralAccessorImpl( getVocabulary().minCardinality(), this );
94
95     /** Property accessor for maxCardinality */
96     private IntLiteralAccessor m_propMaxCardinality = new IntLiteralAccessorImpl( getVocabulary().maxCardinality(), this );
97
98     /** Property accessor for cardinalityQ */
99     private IntLiteralAccessor m_propCardinalityQ = new IntLiteralAccessorImpl( getVocabulary().cardinalityQ(), this );
100
101     /** Property accessor for minCardinalityQ */
102     private IntLiteralAccessor m_propMinCardinalityQ = new IntLiteralAccessorImpl( getVocabulary().minCardinalityQ(), this );
103
104     /** Property accessor for maxCardinalityQ */
105     private IntLiteralAccessor m_propMaxCardinalityQ = new IntLiteralAccessorImpl( getVocabulary().maxCardinalityQ(), this );
106
107
108
109     // Constructors
110
//////////////////////////////////
111

112     /**
113      * <p>
114      * Construct a DAML restriction represented by the given node in the given graph.
115      * </p>
116      *
117      * @param n The node that represents the resource
118      * @param g The enh graph that contains n
119      */

120     public DAMLRestrictionImpl( Node n, EnhGraph g ) {
121         super( n, g );
122     }
123     
124
125
126     // External signature methods
127
//////////////////////////////////
128

129
130     /**
131      * Answer true if this class expression is an property restriction (i&#046;e&#046; is a
132      * Restriction value). This is not an exclusive property, a class
133      * expression can be a property restriction at the same time as one of the other kinds
134      * of class expression, though the conjunction of these may produce the Nothing
135      * class.
136      *
137      * @return necessarily true.
138      */

139     public boolean isRestriction() {
140         return true;
141     }
142
143
144     public PropertyAccessor prop_onProperty() { return m_propOnProperty; }
145     public PropertyAccessor prop_toClass() { return m_propToClass; }
146     public PropertyAccessor prop_hasValue() { return m_propHasValue; }
147     public PropertyAccessor prop_hasClass() { return m_propHasClass; }
148     public IntLiteralAccessor prop_cardinality() { return m_propCardinality; }
149     public IntLiteralAccessor prop_minCardinality() { return m_propMinCardinality; }
150     public IntLiteralAccessor prop_maxCardinality() { return m_propMaxCardinality; }
151     public PropertyAccessor prop_hasClassQ() { return m_propHasClassQ; }
152     public IntLiteralAccessor prop_cardinalityQ() { return m_propCardinalityQ; }
153     public IntLiteralAccessor prop_minCardinalityQ() { return m_propMinCardinalityQ; }
154     public IntLiteralAccessor prop_maxCardinalityQ() { return m_propMaxCardinalityQ; }
155
156
157     // Internal implementation methods
158
//////////////////////////////////
159

160
161
162     //==============================================================================
163
// Inner class definitions
164
//==============================================================================
165

166 }
167
168
169 /*
170     (c) Copyright 2001, 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
171     All rights reserved.
172
173     Redistribution and use in source and binary forms, with or without
174     modification, are permitted provided that the following conditions
175     are met:
176
177     1. Redistributions of source code must retain the above copyright
178        notice, this list of conditions and the following disclaimer.
179
180     2. Redistributions in binary form must reproduce the above copyright
181        notice, this list of conditions and the following disclaimer in the
182        documentation and/or other materials provided with the distribution.
183
184     3. The name of the author may not be used to endorse or promote products
185        derived from this software without specific prior written permission.
186
187     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
188     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
189     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
190     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
191     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
192     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
193     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
194     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
195     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
196     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
197 */

198
199
Popular Tags