Source Code Cross Referenced for OntologyImpl.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » ontology » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.ontology.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*****************************************************************************
002:         * Source code information
003:         * -----------------------
004:         * Original author    Ian Dickinson, HP Labs Bristol
005:         * Author email       Ian.Dickinson@hp.com
006:         * Package            Jena 2
007:         * Web                http://sourceforge.net/projects/jena/
008:         * Created            25-Mar-2003
009:         * Filename           $RCSfile: OntologyImpl.java,v $
010:         * Revision           $Revision: 1.15 $
011:         * Release status     $State: Exp $
012:         *
013:         * Last modified on   $Date: 2008/01/02 12:08:02 $
014:         *               by   $Author: andy_seaborne $
015:         *
016:         * (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
017:         * (see footer for full conditions)
018:         *****************************************************************************/package com.hp.hpl.jena.ontology.impl;
019:
020:        // Imports
021:        ///////////////
022:        import com.hp.hpl.jena.enhanced.*;
023:        import com.hp.hpl.jena.graph.Node;
024:        import com.hp.hpl.jena.ontology.*;
025:        import com.hp.hpl.jena.rdf.model.*;
026:        import com.hp.hpl.jena.util.iterator.ExtendedIterator;
027:
028:        /**
029:         * <p>
030:         * Implementation of the Ontology interface, encapsulating nodes that hold the
031:         * meta-data about whole ontologies.
032:         * </p>
033:         *
034:         * @author Ian Dickinson, HP Labs
035:         *         (<a  href="mailto:Ian.Dickinson@hp.com" >email</a>)
036:         * @version CVS $Id: OntologyImpl.java,v 1.15 2008/01/02 12:08:02 andy_seaborne Exp $
037:         */
038:        public class OntologyImpl extends OntResourceImpl implements  Ontology {
039:            // Constants
040:            //////////////////////////////////
041:
042:            // Static variables
043:            //////////////////////////////////
044:
045:            /**
046:             * A factory for generating Ontology facets from nodes in enhanced graphs.
047:             */
048:            public static Implementation factory = new Implementation() {
049:                public EnhNode wrap(Node n, EnhGraph eg) {
050:                    if (canWrap(n, eg)) {
051:                        return new OntologyImpl(n, eg);
052:                    } else {
053:                        throw new ConversionException("Cannot convert node "
054:                                + n + " to Ontology");
055:                    }
056:                }
057:
058:                public boolean canWrap(Node node, EnhGraph eg) {
059:                    // node will support being an Ontology facet if it has rdf:type owl:Ontology or equivalent
060:                    Profile profile = (eg instanceof  OntModel) ? ((OntModel) eg)
061:                            .getProfile()
062:                            : null;
063:                    return (profile != null)
064:                            && profile.isSupported(node, eg, Ontology.class);
065:                }
066:            };
067:
068:            // Instance variables
069:            //////////////////////////////////
070:
071:            // Constructors
072:            //////////////////////////////////
073:
074:            /**
075:             * <p>
076:             * Construct an ontology metadata node represented by the given node in the given graph.
077:             * </p>
078:             * 
079:             * @param n The node that represents the resource
080:             * @param g The enh graph that contains n
081:             */
082:            public OntologyImpl(Node n, EnhGraph g) {
083:                super (n, g);
084:            }
085:
086:            // External signature methods
087:            //////////////////////////////////
088:
089:            // imports
090:
091:            /**
092:             * <p>Assert that this ontology imports only the given ontology. Any existing 
093:             * statements for <code>sameAs</code> will be removed.</p>
094:             * @param res Represents a resource that this ontology imports.
095:             * @exception OntProfileException If the {@link Profile#IMPORTS()()} property is not supported in the current language profile.   
096:             */
097:            public void setImport(Resource res) {
098:                setPropertyValue(getProfile().IMPORTS(), "IMPORTS", res);
099:            }
100:
101:            /**
102:             * <p>Add a resource representing an ontology that this ontology 
103:             * (strictly, the ontology reprsented by this node) imports.</p>
104:             * @param res Represents a resource that this ontology imports.
105:             * @exception OntProfileException If the {@link Profile#IMPORTS()()} property is not supported in the current language profile.   
106:             */
107:            public void addImport(Resource res) {
108:                addPropertyValue(getProfile().IMPORTS(), "IMPORTS", res);
109:            }
110:
111:            /**
112:             * <p>Answer a resource that represents an ontology imported by this ontology. If there is
113:             * more than one such resource, an arbitrary selection is made.</p>
114:             * @return An ont resource representing a resource that this ontology imports
115:             * @exception OntProfileException If the {@link Profile#IMPORTS()()} property is not supported in the current language profile.   
116:             */
117:            public OntResource getImport() {
118:                return objectAsResource(getProfile().IMPORTS(), "IMPORTS");
119:            }
120:
121:            /**
122:             * <p>Answer an iterator over all of the resources representing ontologies imported by this ontology. 
123:             * Each elemeent of the iterator will be an {@link OntResource}.</p>
124:             * @return An iterator over the ontology import resources
125:             * @exception OntProfileException If the {@link Profile#IMPORTS()()} property is not supported in the current language profile.   
126:             */
127:            public ExtendedIterator listImports() {
128:                return listAs(getProfile().IMPORTS(), "IMPORTS",
129:                        OntResource.class);
130:            }
131:
132:            /**
133:             * <p>Answer true if this ontology (the ontology represented by this 
134:             * resource) imports the given resource.</p>
135:             * @param res A resource to test against
136:             * @return True if this ontology imports the ontology represented by <code>res</code>
137:             */
138:            public boolean imports(Resource res) {
139:                return hasPropertyValue(getProfile().IMPORTS(), "IMPORTS", res);
140:            }
141:
142:            /**
143:             * <p>Remove the statement that this ontology imports the ontology represented by the given resource.  If this statement
144:             * is not true of the current model, nothing happens.</p>
145:             * @param res A resource that represents an ontology that is no longer to be imported
146:             */
147:            public void removeImport(Resource res) {
148:                removePropertyValue(getProfile().IMPORTS(), "IMPORTS", res);
149:            }
150:
151:            // backwardCompatibleWith
152:
153:            /**
154:             * <p>Assert that this ontology is backward compatible with the given ontology. Any existing 
155:             * statements for <code>sameAs</code> will be removed.</p>
156:             * @param res Represents a resource that this ontology is compatible with.
157:             * @exception OntProfileException If the {@link Profile#BACKWARD_COMPATIBLE_WITH} property is not supported in the current language profile.   
158:             */
159:            public void setBackwardCompatibleWith(Resource res) {
160:                setPropertyValue(getProfile().BACKWARD_COMPATIBLE_WITH(),
161:                        "BACKWARD_COMPATIBLE_WITH", res);
162:            }
163:
164:            /**
165:             * <p>Add a resource representing an ontology that this ontology 
166:             * (strictly, the ontology reprsented by this node) is backwards compatible with.</p>
167:             * @param res Represents a resource that this ontology is compatible with.
168:             * @exception OntProfileException If the {@link Profile#BACKWARD_COMPATIBLE_WITH} property is not supported in the current language profile.   
169:             */
170:            public void addBackwardCompatibleWith(Resource res) {
171:                addPropertyValue(getProfile().BACKWARD_COMPATIBLE_WITH(),
172:                        "BACKWARD_COMPATIBLE_WITH", res);
173:            }
174:
175:            /**
176:             * <p>Answer a resource that represents an ontology that is backwards compatible with this ontology. If there is
177:             * more than one such resource, an arbitrary selection is made.</p>
178:             * @return An ont resource representing an ontology that this ontology is compatible with
179:             * @exception OntProfileException If the {@link Profile#BACKWARD_COMPATIBLE_WITH} property is not supported in the current language profile.   
180:             */
181:            public OntResource getBackwardCompatibleWith() {
182:                return objectAsResource(
183:                        getProfile().BACKWARD_COMPATIBLE_WITH(),
184:                        "BACKWARD_COMPATIBLE_WITH");
185:            }
186:
187:            /**
188:             * <p>Answer an iterator over all of the resources representing 
189:             * ontologies that this ontology is backwards compatible with. 
190:             * Each element of the iterator will be an {@link OntResource}.</p>
191:             * @return An iterator over the ontology resources compatible with this ontology
192:             * @exception OntProfileException If the {@link Profile#BACKWARD_COMPATIBLE_WITH} property is not supported in the current language profile.   
193:             */
194:            public ExtendedIterator listBackwardCompatibleWith() {
195:                return listAs(getProfile().BACKWARD_COMPATIBLE_WITH(),
196:                        "BACKWARD_COMPATIBLE_WITH", OntResource.class);
197:            }
198:
199:            /**
200:             * <p>Answer true if this ontology (the ontology represented by this 
201:             * resource) is backward compatible with the given resource.</p>
202:             * @param res A resource to test against
203:             * @return True if this ontology is compatible with the ontology represented by <code>res</code>
204:             */
205:            public boolean isBackwardCompatibleWith(Resource res) {
206:                return hasPropertyValue(
207:                        getProfile().BACKWARD_COMPATIBLE_WITH(),
208:                        "BACKWARD_COMPATIBLE_WITH", res);
209:            }
210:
211:            /**
212:             * <p>Remove the statement that this ontology is backwards compatible with
213:             * the ontology represented by the given resource.  If this statement
214:             * is not true of the current model, nothing happens.</p>
215:             * @param res A resource that represents an ontology that is no longer to be imported
216:             */
217:            public void removeBackwardCompatibleWith(Resource res) {
218:                removePropertyValue(getProfile().BACKWARD_COMPATIBLE_WITH(),
219:                        "BACKWARD_COMPATIBLE_WITH", res);
220:            }
221:
222:            // priorVersion
223:
224:            /**
225:             * <p>Assert that this ontology is a new version of the given ontology. Any existing 
226:             * statements for <code>priorVersion</code> will be removed.</p>
227:             * @param res Represents a resource that this ontology supercedes.
228:             * @exception OntProfileException If the {@link Profile#PRIOR_VERSION} property is not supported in the current language profile.   
229:             */
230:            public void setPriorVersion(Resource res) {
231:                setPropertyValue(getProfile().PRIOR_VERSION(), "PRIOR_VERSION",
232:                        res);
233:            }
234:
235:            /**
236:             * <p>Add a resource representing an ontology that this ontology 
237:             * (strictly, the ontology reprsented by this node) supercedes.</p>
238:             * @param res Represents a resource that this ontology supercedes.
239:             * @exception OntProfileException If the {@link Profile#PRIOR_VERSION} property is not supported in the current language profile.   
240:             */
241:            public void addPriorVersion(Resource res) {
242:                addPropertyValue(getProfile().PRIOR_VERSION(), "PRIOR_VERSION",
243:                        res);
244:            }
245:
246:            /**
247:             * <p>Answer a resource that represents an ontology that is superceded by this ontology. If there is
248:             * more than one such resource, an arbitrary selection is made.</p>
249:             * @return An ont resource representing an ontology that this ontology supercedes
250:             * @exception OntProfileException If the {@link Profile#PRIOR_VERSION} property is not supported in the current language profile.   
251:             */
252:            public OntResource getPriorVersion() {
253:                return objectAsResource(getProfile().PRIOR_VERSION(),
254:                        "PRIOR_VERSION");
255:            }
256:
257:            /**
258:             * <p>Answer an iterator over all of the resources representing 
259:             * ontologies that this ontology supercedes. 
260:             * Each element of the iterator will be an {@link OntResource}.</p>
261:             * @return An iterator over the ontology resources superceded by this ontology
262:             * @exception OntProfileException If the {@link Profile#PRIOR_VERSION} property is not supported in the current language profile.   
263:             */
264:            public ExtendedIterator listPriorVersion() {
265:                return listAs(getProfile().PRIOR_VERSION(), "PRIOR_VERSION",
266:                        OntResource.class);
267:            }
268:
269:            /**
270:             * <p>Answer true if this ontology (the ontology represented by this 
271:             * resource) supercedes the given resource.</p>
272:             * @param res A resource to test against
273:             * @return True if this ontology supercedes the ontology represented by <code>res</code>
274:             */
275:            public boolean hasPriorVersion(Resource res) {
276:                return hasPropertyValue(getProfile().PRIOR_VERSION(),
277:                        "PRIOR_VERSION", res);
278:            }
279:
280:            /**
281:             * <p>Remove the statement that the given ontology is a prior version of this ontology.  If this statement
282:             * is not true of the current model, nothing happens.</p>
283:             * @param res A resource that represents an ontology that is no longer a prior version of this ontology
284:             */
285:            public void removePriorVersion(Resource res) {
286:                removePropertyValue(getProfile().PRIOR_VERSION(),
287:                        "PRIOR_VERSION", res);
288:            }
289:
290:            // incompatibleWith
291:
292:            /**
293:             * <p>Assert that this ontology is incompatible with the given ontology. Any existing 
294:             * statements for <code>incompatibleWith</code> will be removed.</p>
295:             * @param res Represents a resource that this ontology is incompatible with.
296:             * @exception OntProfileException If the {@link Profile#INCOMPATIBLE_WITH} property is not supported in the current language profile.   
297:             */
298:            public void setIncompatibleWith(Resource res) {
299:                setPropertyValue(getProfile().INCOMPATIBLE_WITH(),
300:                        "INCOMPATIBLE_WITH", res);
301:            }
302:
303:            /**
304:             * <p>Add a resource representing an ontology that this ontology 
305:             * (strictly, the ontology reprsented by this node) is incompatible with.</p>
306:             * @param res Represents a resource that this ontology is incompatible with.
307:             * @exception OntProfileException If the {@link Profile#INCOMPATIBLE_WITH} property is not supported in the current language profile.   
308:             */
309:            public void addIncompatibleWith(Resource res) {
310:                addPropertyValue(getProfile().INCOMPATIBLE_WITH(),
311:                        "INCOMPATIBLE_WITH", res);
312:            }
313:
314:            /**
315:             * <p>Answer a resource that represents an ontology that is is incompatible with this ontology. If there is
316:             * more than one such resource, an arbitrary selection is made.</p>
317:             * @return An ont resource representing an ontology that this ontology is incompatible with
318:             * @exception OntProfileException If the {@link Profile#INCOMPATIBLE_WITH} property is not supported in the current language profile.   
319:             */
320:            public OntResource getIncompatibleWith() {
321:                return objectAsResource(getProfile().INCOMPATIBLE_WITH(),
322:                        "INCOMPATIBLE_WITH");
323:            }
324:
325:            /**
326:             * <p>Answer an iterator over all of the resources representing 
327:             * ontologies that this ontology is incompatible with. 
328:             * Each element of the iterator will be an {@link OntResource}.</p>
329:             * @return An iterator over the ontology resources that this ontology is incompatible with
330:             * @exception OntProfileException If the {@link Profile#INCOMPATIBLE_WITH} property is not supported in the current language profile.   
331:             */
332:            public ExtendedIterator listIncompatibleWith() {
333:                return listAs(getProfile().INCOMPATIBLE_WITH(),
334:                        "INCOMPATIBLE_WITH", OntResource.class);
335:            }
336:
337:            /**
338:             * <p>Answer true if this ontology (the ontology represented by this 
339:             * resource) is incompatible with the given resource.</p>
340:             * @param res A resource to test against
341:             * @return True if this ontology is incompatible with the ontology represented by <code>res</code>
342:             */
343:            public boolean isIncompatibleWith(Resource res) {
344:                return hasPropertyValue(getProfile().INCOMPATIBLE_WITH(),
345:                        "INCOMPATIBLE_WITH", res);
346:            }
347:
348:            /**
349:             * <p>Remove the statement that the given ontology is incompatible with this ontology.  If this statement
350:             * is not true of the current model, nothing happens.</p>
351:             * @param res A resource that represents an ontology that is no longer incompatible with this ontology
352:             */
353:            public void removeIncompatibleWith(Resource res) {
354:                removePropertyValue(getProfile().INCOMPATIBLE_WITH(),
355:                        "INCOMPATIBLE_WITH", res);
356:            }
357:
358:            // Internal implementation methods
359:            //////////////////////////////////
360:
361:            //==============================================================================
362:            // Inner class definitions
363:            //==============================================================================
364:
365:        }
366:
367:        /*
368:         (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
369:         All rights reserved.
370:
371:         Redistribution and use in source and binary forms, with or without
372:         modification, are permitted provided that the following conditions
373:         are met:
374:
375:         1. Redistributions of source code must retain the above copyright
376:         notice, this list of conditions and the following disclaimer.
377:
378:         2. Redistributions in binary form must reproduce the above copyright
379:         notice, this list of conditions and the following disclaimer in the
380:         documentation and/or other materials provided with the distribution.
381:
382:         3. The name of the author may not be used to endorse or promote products
383:         derived from this software without specific prior written permission.
384:
385:         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
386:         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
387:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
388:         IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
389:         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
390:         NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
391:         DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
392:         THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
393:         (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
394:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
395:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.