KickJava   Java API By Example, From Geeks To Geeks.

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


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 3 August 2001
8  * Filename $RCSfile: VocabularyManager.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:32 $
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
import com.hp.hpl.jena.vocabulary.*;
27 import com.hp.hpl.jena.rdf.model.*;
28 import com.hp.hpl.jena.rdf.model.impl.*;
29
30
31
32
33 /**
34  * Contains knowledge of different versions of the DAML vocabulary, to help
35  * with managing the different versions of the namespace.
36  *
37  * @author Ian Dickinson, HP Labs (<a HREF="mailto:Ian.Dickinson@hp.com">email</a>)
38  * @version CVS info: $Id: VocabularyManager.java,v 1.7 2005/02/21 12:05:32 andy_seaborne Exp $
39  */

40 public class VocabularyManager
41 {
42     // Constants
43
//////////////////////////////////
44

45
46     // Static variables
47
//////////////////////////////////
48

49
50     // Instance variables
51
//////////////////////////////////
52

53
54     // Constructors
55
//////////////////////////////////
56

57
58     // External signature methods
59
//////////////////////////////////
60

61     /**
62      * Answer the vocabulary that corresponds to the namespace of the
63      * given resource. By default, answer the most recent vocabulary.
64      *
65      * @param resource The RDF resource denoting a namespace
66      * @return a DAML vocabulary object for the namespace
67      */

68     public static DAMLVocabulary getVocabulary( Resource resource ) {
69         return getDefaultVocabulary();
70     }
71
72
73     /**
74      * Answer the vocabulary that corresponds to the namespace of the
75      * given URI. By default, answer the most recent vocabulary.
76      *
77      * @param uri A URI denoting a namespace
78      * @return a DAML vocabulary object for the namespace
79      */

80     public static DAMLVocabulary getVocabulary( String JavaDoc uri ) {
81         if (uri != null) {
82             // pull out the namespace of the uri
83
int splitPoint = Util.splitNamespace( uri );
84             String JavaDoc namespace = (splitPoint < 0) ? uri : uri.substring( 0, splitPoint );
85
86             // test the known namespaces
87
if (namespace != null) {
88
89                 // add further namespace tests here as the namespaces are defined.
90
}
91         }
92
93         // to get here, we assume the default vocabulary
94
return getDefaultVocabulary();
95     }
96
97
98     /**
99      * Answer the default (latest) vocabulary.
100      *
101      * @return a DAML+OIL vocabulary
102      */

103     public static DAMLVocabulary getDefaultVocabulary() {
104         return DAML_OIL.getInstance();
105     }
106
107     // Internal implementation methods
108
//////////////////////////////////
109

110
111
112
113     //==============================================================================
114
// Inner class definitions
115
//==============================================================================
116

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

150
151
Popular Tags