KickJava   Java API By Example, From Geeks To Geeks.

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


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 06-Mar-2003
9  * Filename $RCSfile: ProfileRegistry.java,v $
10  * Revision $Revision: 1.10 $
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 // Imports
26
///////////////
27
import com.hp.hpl.jena.ontology.impl.*;
28 import com.hp.hpl.jena.vocabulary.*;
29
30 import java.util.*;
31
32
33 /**
34  * <p>
35  * Provides a means to map between the URI's that represent ontology languages
36  * and their language profiles.
37  * </p>
38  *
39  * @author Ian Dickinson, HP Labs
40  * (<a HREF="mailto:Ian.Dickinson@hp.com" >email</a>)
41  * @version CVS $Id: ProfileRegistry.java,v 1.10 2005/02/21 12:04:42 andy_seaborne Exp $
42  */

43 public class ProfileRegistry {
44     // Constants
45
//////////////////////////////////
46

47     /** The URI that maps to the language profile for OWL-Full */
48     public static final String JavaDoc OWL_LANG = OWL.FULL_LANG.getURI();
49     
50     /** The URI that maps to the language profile for OWL-DL */
51     public static final String JavaDoc OWL_DL_LANG = OWL.DL_LANG.getURI();
52     
53     /** The URI that maps to the language profile for OWL-Lite */
54     public static final String JavaDoc OWL_LITE_LANG = OWL.LITE_LANG.getURI();
55     
56     /** The URI that maps to the language profile for DAML+OIL */
57     public static final String JavaDoc DAML_LANG = DAML_OIL.NAMESPACE_DAML_2001_03_URI;
58     
59     /** The URI that maps to the language profile for RDFS */
60     public static final String JavaDoc RDFS_LANG = RDFS.getURI();
61     
62     
63     // Static variables
64
//////////////////////////////////
65

66     private static Object JavaDoc[][] s_initData = new Object JavaDoc[][] {
67         {OWL_LANG, new OWLProfile()},
68         {OWL_DL_LANG, new OWLDLProfile()},
69         {OWL_LITE_LANG, new OWLLiteProfile()},
70         {DAML_LANG, new DAML_OILProfile()},
71         {RDFS_LANG, new RDFSProfile()}
72     };
73     
74     
75     /** Singleton instance */
76     private static ProfileRegistry s_instance = new ProfileRegistry();
77     
78     
79     // Instance variables
80
//////////////////////////////////
81

82     /** Maps from public URI's to language profiles */
83     private Map m_registry = new HashMap();
84
85
86     // Constructors
87
//////////////////////////////////
88

89     /**
90      * <p>
91      * Singleton constructor
92      * </p>
93      */

94     private ProfileRegistry() {
95         for (int i = 0; i < s_initData.length; i++) {
96             registerProfile( (String JavaDoc) s_initData[i][0], (Profile) s_initData[i][1] );
97         }
98     }
99     
100     
101     // External signature methods
102
//////////////////////////////////
103

104     /**
105      * <p>
106      * Answer the singleton instance
107      * </p>
108      *
109      * @return The singleton registry
110      */

111     public static ProfileRegistry getInstance() {
112         return s_instance;
113     }
114     
115     
116     /**
117      * <p>
118      * Add a language profile with the given URI key
119      * </p>
120      *
121      * @param uri The URI denoting the language
122      * @param profile The language profile for the language
123      */

124     public void registerProfile( String JavaDoc uri, Profile profile ) {
125         m_registry.put( uri, profile );
126     }
127     
128     
129     /**
130      * <p>
131      * Answer the language profile for the given language URI, or null if not known.
132      * </p>
133      *
134      * @param uri A URI denoting an ontology language
135      * @return An ontology langugae profile for that language
136      */

137     public Profile getProfile( String JavaDoc uri ) {
138         return (Profile) m_registry.get( uri );
139     }
140     
141     
142     // Internal implementation methods
143
//////////////////////////////////
144

145     //==============================================================================
146
// Inner class definitions
147
//==============================================================================
148

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

181
182
Popular Tags