KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > ontology > impl > FunctionalPropertyImpl


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 01-Apr-2003
9  * Filename $RCSfile: FunctionalPropertyImpl.java,v $
10  * Revision $Revision: 1.7 $
11  * Release status $State: Exp $
12  *
13  * Last modified on $Date: 2005/02/21 12:06:21 $
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.impl;
23
24
25
26 // Imports
27
///////////////
28
import com.hp.hpl.jena.enhanced.*;
29 import com.hp.hpl.jena.graph.*;
30 import com.hp.hpl.jena.ontology.*;
31
32
33
34 /**
35  * <p>
36  * Implementation of the functional property abstraction
37  * </p>
38  *
39  * @author Ian Dickinson, HP Labs
40  * (<a HREF="mailto:Ian.Dickinson@hp.com" >email</a>)
41  * @version CVS $Id: FunctionalPropertyImpl.java,v 1.7 2005/02/21 12:06:21 andy_seaborne Exp $
42  */

43 public class FunctionalPropertyImpl
44     extends OntPropertyImpl
45     implements FunctionalProperty
46 {
47     // Constants
48
//////////////////////////////////
49

50     // Static variables
51
//////////////////////////////////
52

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

58     public static Implementation factory = new Implementation() {
59         public EnhNode wrap( Node n, EnhGraph eg ) {
60             if (canWrap( n, eg )) {
61                 return new FunctionalPropertyImpl( n, eg );
62             }
63             else {
64                 throw new ConversionException( "Cannot convert node " + n + " to FunctionalProperty");
65             }
66         }
67             
68         public boolean canWrap( Node node, EnhGraph eg ) {
69             // node will support being an FunctionalProperty facet if it has rdf:type owl:FunctionalProperty or equivalent
70
Profile profile = (eg instanceof OntModel) ? ((OntModel) eg).getProfile() : null;
71             return (profile != null) && profile.isSupported( node, eg, FunctionalProperty.class );
72         }
73     };
74
75
76     // Instance variables
77
//////////////////////////////////
78

79     // Constructors
80
//////////////////////////////////
81

82     /**
83      * <p>
84      * Construct a functional property node represented by the given node in the given graph.
85      * </p>
86      *
87      * @param n The node that represents the resource
88      * @param g The enh graph that contains n
89      */

90     public FunctionalPropertyImpl( Node n, EnhGraph g ) {
91         super( n, g );
92     }
93
94
95     // External signature methods
96
//////////////////////////////////
97

98     // Internal implementation methods
99
//////////////////////////////////
100

101     //==============================================================================
102
// Inner class definitions
103
//==============================================================================
104

105 }
106
107
108 /*
109     (c) Copyright 2002, 2003, 2004, 2005 Hewlett-Packard Development Company, LP
110     All rights reserved.
111
112     Redistribution and use in source and binary forms, with or without
113     modification, are permitted provided that the following conditions
114     are met:
115
116     1. Redistributions of source code must retain the above copyright
117        notice, this list of conditions and the following disclaimer.
118
119     2. Redistributions in binary form must reproduce the above copyright
120        notice, this list of conditions and the following disclaimer in the
121        documentation and/or other materials provided with the distribution.
122
123     3. The name of the author may not be used to endorse or promote products
124        derived from this software without specific prior written permission.
125
126     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
127     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
128     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
129     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
130     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
131     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
132     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
133     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
134     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
135     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
136 */

137
138
Popular Tags