Source Code Cross Referenced for OWLLiteProfile.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            10 Feb 2003
009:         * Filename           $RCSfile: OWLLiteProfile.java,v $
010:         * Revision           $Revision: 1.21 $
011:         * Release status     $State: Exp $
012:         *
013:         * Last modified on   $Date: 2008/01/02 12:08:03 $
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.vocabulary.*;
023:        import com.hp.hpl.jena.enhanced.*;
024:        import com.hp.hpl.jena.graph.*;
025:        import com.hp.hpl.jena.ontology.*;
026:        import com.hp.hpl.jena.rdf.model.*;
027:
028:        import java.util.*;
029:
030:        /**
031:         * <p>
032:         * Ontology language profile implementation for the Lite variant of the OWL 2002/07 language.
033:         * </p>
034:         *
035:         * @author Ian Dickinson, HP Labs
036:         *         (<a  href="mailto:Ian.Dickinson@hp.com" >email</a>)
037:         * @version CVS $Id: OWLLiteProfile.java,v 1.21 2008/01/02 12:08:03 andy_seaborne Exp $
038:         */
039:        public class OWLLiteProfile extends OWLProfile {
040:            // Constants
041:            //////////////////////////////////
042:
043:            // Static variables
044:            //////////////////////////////////
045:
046:            // Instance variables
047:            //////////////////////////////////
048:
049:            // Constructors
050:            //////////////////////////////////
051:
052:            // External signature methods
053:            //////////////////////////////////
054:
055:            public Resource DATARANGE() {
056:                return null;
057:            }
058:
059:            public Resource NOTHING() {
060:                return null;
061:            }
062:
063:            public Property COMPLEMENT_OF() {
064:                return null;
065:            }
066:
067:            public Property DISJOINT_WITH() {
068:                return null;
069:            }
070:
071:            public Property HAS_VALUE() {
072:                return null;
073:            }
074:
075:            public Property ONE_OF() {
076:                return null;
077:            }
078:
079:            public Property UNION_OF() {
080:                return null;
081:            }
082:
083:            public Property SAME_AS() {
084:                return null;
085:            }
086:
087:            public Property SAME_INDIVIDUAL_AS() {
088:                return null;
089:            }
090:
091:            /**
092:             * <p>
093:             * Answer a descriptive string for this profile, for use in debugging and other output.
094:             * </p>
095:             * @return "OWL Lite"
096:             */
097:            public String getLabel() {
098:                return "OWL Lite";
099:            }
100:
101:            // Internal implementation methods
102:            //////////////////////////////////
103:
104:            //==============================================================================
105:            // Inner class definitions
106:            //==============================================================================
107:
108:            protected static Object[][] s_supportsCheckData = new Object[][] {
109:                    // Resource (key),              check method
110:                    { AllDifferent.class, new SupportsCheck() {
111:                        public boolean doCheck(Node n, EnhGraph g) {
112:                            return g.asGraph().contains(n, RDF.type.asNode(),
113:                                    OWL.AllDifferent.asNode());
114:                        }
115:                    } },
116:                    { AnnotationProperty.class, new SupportsCheck() {
117:                        public boolean doCheck(Node n, EnhGraph g) {
118:                            for (Iterator i = ((OntModel) g).getProfile()
119:                                    .getAnnotationProperties(); i.hasNext();) {
120:                                if (((Resource) i.next()).asNode().equals(n)) {
121:                                    // a built-in annotation property
122:                                    return true;
123:                                }
124:                            }
125:                            return g.asGraph().contains(n, RDF.type.asNode(),
126:                                    OWL.AnnotationProperty.asNode());
127:                        }
128:                    } },
129:                    { OntClass.class, new SupportsCheck() {
130:                        public boolean doCheck(Node n, EnhGraph eg) {
131:                            Graph g = eg.asGraph();
132:                            Node rdfTypeNode = RDF.type.asNode();
133:                            return g.contains(n, rdfTypeNode, OWL.Class
134:                                    .asNode())
135:                                    || g.contains(n, rdfTypeNode,
136:                                            OWL.Restriction.asNode())
137:                                    || g.contains(n, rdfTypeNode, RDFS.Class
138:                                            .asNode())
139:                                    || g.contains(n, rdfTypeNode, RDFS.Datatype
140:                                            .asNode())
141:                                    ||
142:                                    // These are common cases that we should support
143:                                    n.equals(OWL.Thing.asNode())
144:                                    || g.contains(Node.ANY, RDFS.domain
145:                                            .asNode(), n)
146:                                    || g.contains(Node.ANY,
147:                                            RDFS.range.asNode(), n)
148:                                    || g.contains(n, OWL.intersectionOf
149:                                            .asNode(), Node.ANY);
150:                        }
151:                    } },
152:                    { DatatypeProperty.class, new SupportsCheck() {
153:                        public boolean doCheck(Node n, EnhGraph g) {
154:                            return g.asGraph().contains(n, RDF.type.asNode(),
155:                                    OWL.DatatypeProperty.asNode());
156:                        }
157:                    } },
158:                    { ObjectProperty.class, new SupportsCheck() {
159:                        public boolean doCheck(Node n, EnhGraph g) {
160:                            return g.asGraph().contains(n, RDF.type.asNode(),
161:                                    OWL.ObjectProperty.asNode())
162:                                    || g.asGraph().contains(n,
163:                                            RDF.type.asNode(),
164:                                            OWL.TransitiveProperty.asNode())
165:                                    || g.asGraph().contains(n,
166:                                            RDF.type.asNode(),
167:                                            OWL.SymmetricProperty.asNode())
168:                                    || g.asGraph().contains(
169:                                            n,
170:                                            RDF.type.asNode(),
171:                                            OWL.InverseFunctionalProperty
172:                                                    .asNode());
173:                        }
174:                    } },
175:                    { FunctionalProperty.class, new SupportsCheck() {
176:                        public boolean doCheck(Node n, EnhGraph g) {
177:                            return g.asGraph().contains(n, RDF.type.asNode(),
178:                                    OWL.FunctionalProperty.asNode());
179:                        }
180:                    } },
181:                    { InverseFunctionalProperty.class, new SupportsCheck() {
182:                        public boolean doCheck(Node n, EnhGraph g) {
183:                            return g.asGraph().contains(n, RDF.type.asNode(),
184:                                    OWL.InverseFunctionalProperty.asNode())
185:                                    && !g.asGraph().contains(n,
186:                                            RDF.type.asNode(),
187:                                            OWL.DatatypeProperty.asNode());
188:                        }
189:                    } },
190:                    { RDFList.class, new SupportsCheck() {
191:                        public boolean doCheck(Node n, EnhGraph g) {
192:                            return n.equals(RDF.nil.asNode())
193:                                    || g.asGraph().contains(n,
194:                                            RDF.type.asNode(),
195:                                            RDF.List.asNode());
196:                        }
197:                    } },
198:                    { OntProperty.class, new SupportsCheck() {
199:                        public boolean doCheck(Node n, EnhGraph g) {
200:                            return g.asGraph().contains(n, RDF.type.asNode(),
201:                                    RDF.Property.asNode())
202:                                    || g.asGraph().contains(n,
203:                                            RDF.type.asNode(),
204:                                            OWL.ObjectProperty.asNode())
205:                                    || g.asGraph().contains(n,
206:                                            RDF.type.asNode(),
207:                                            OWL.DatatypeProperty.asNode())
208:                                    || g.asGraph().contains(n,
209:                                            RDF.type.asNode(),
210:                                            OWL.AnnotationProperty.asNode())
211:                                    || g.asGraph().contains(n,
212:                                            RDF.type.asNode(),
213:                                            OWL.TransitiveProperty.asNode())
214:                                    || g.asGraph().contains(n,
215:                                            RDF.type.asNode(),
216:                                            OWL.SymmetricProperty.asNode())
217:                                    || g.asGraph().contains(n,
218:                                            RDF.type.asNode(),
219:                                            OWL.FunctionalProperty.asNode())
220:                                    || g.asGraph().contains(
221:                                            n,
222:                                            RDF.type.asNode(),
223:                                            OWL.InverseFunctionalProperty
224:                                                    .asNode());
225:                        }
226:                    } },
227:                    { Ontology.class, new SupportsCheck() {
228:                        public boolean doCheck(Node n, EnhGraph g) {
229:                            return g.asGraph().contains(n, RDF.type.asNode(),
230:                                    OWL.Ontology.asNode());
231:                        }
232:                    } },
233:                    { Restriction.class, new SupportsCheck() {
234:                        public boolean doCheck(Node n, EnhGraph g) {
235:                            return g.asGraph().contains(n, RDF.type.asNode(),
236:                                    OWL.Restriction.asNode());
237:                        }
238:                    } },
239:                    { AllValuesFromRestriction.class, new SupportsCheck() {
240:                        public boolean doCheck(Node n, EnhGraph g) {
241:                            return g.asGraph().contains(n, RDF.type.asNode(),
242:                                    OWL.Restriction.asNode())
243:                                    && containsSome(g, n, OWL.allValuesFrom)
244:                                    && containsSome(g, n, OWL.onProperty);
245:                        }
246:                    } },
247:                    { SomeValuesFromRestriction.class, new SupportsCheck() {
248:                        public boolean doCheck(Node n, EnhGraph g) {
249:                            return g.asGraph().contains(n, RDF.type.asNode(),
250:                                    OWL.Restriction.asNode())
251:                                    && containsSome(g, n, OWL.someValuesFrom)
252:                                    && containsSome(g, n, OWL.onProperty);
253:                        }
254:                    } },
255:                    { CardinalityRestriction.class, new SupportsCheck() {
256:                        public boolean doCheck(Node n, EnhGraph g) {
257:                            return g.asGraph().contains(n, RDF.type.asNode(),
258:                                    OWL.Restriction.asNode())
259:                                    && containsSome(g, n, OWL.cardinality)
260:                                    && containsSome(g, n, OWL.onProperty);
261:                        }
262:                    } },
263:                    { MinCardinalityRestriction.class, new SupportsCheck() {
264:                        public boolean doCheck(Node n, EnhGraph g) {
265:                            return g.asGraph().contains(n, RDF.type.asNode(),
266:                                    OWL.Restriction.asNode())
267:                                    && containsSome(g, n, OWL.minCardinality)
268:                                    && containsSome(g, n, OWL.onProperty);
269:                        }
270:                    } },
271:                    { MaxCardinalityRestriction.class, new SupportsCheck() {
272:                        public boolean doCheck(Node n, EnhGraph g) {
273:                            return g.asGraph().contains(n, RDF.type.asNode(),
274:                                    OWL.Restriction.asNode())
275:                                    && containsSome(g, n, OWL.maxCardinality)
276:                                    && containsSome(g, n, OWL.onProperty);
277:                        }
278:                    } }, { SymmetricProperty.class, new SupportsCheck() {
279:                        public boolean doCheck(Node n, EnhGraph g) {
280:                            return g.asGraph().contains(n, RDF.type.asNode(),
281:                                    OWL.SymmetricProperty.asNode())
282:                                    && !g.asGraph().contains(n,
283:                                            RDF.type.asNode(),
284:                                            OWL.DatatypeProperty.asNode());
285:                        }
286:                    } }, { TransitiveProperty.class, new SupportsCheck() {
287:                        public boolean doCheck(Node n, EnhGraph g) {
288:                            return g.asGraph().contains(n, RDF.type.asNode(),
289:                                    OWL.TransitiveProperty.asNode())
290:                                    && !g.asGraph().contains(n,
291:                                            RDF.type.asNode(),
292:                                            OWL.DatatypeProperty.asNode());
293:                        }
294:                    } }, { Individual.class, new SupportsCheck() {
295:                        public boolean doCheck(Node n, EnhGraph eg) {
296:                            if (n instanceof  Node_URI
297:                                    || n instanceof  Node_Blank) {
298:                                // necessary to be a uri or bNode, but not sufficient
299:                                Graph g = eg.asGraph();
300:
301:                                // this check filters out OWL-full entailments from the OWL-rule reasoner
302:                                return !(g.contains(n, RDF.type.asNode(),
303:                                        RDFS.Class.asNode()) || g.contains(n,
304:                                        RDF.type.asNode(), RDF.Property
305:                                                .asNode()));
306:                            } else {
307:                                return false;
308:                            }
309:                        }
310:                    } }, };
311:
312:            // to allow concise reference in the code above.
313:            public static boolean containsSome(EnhGraph g, Node n, Property p) {
314:                return AbstractProfile.containsSome(g, n, p);
315:            }
316:
317:            // Static variables
318:            //////////////////////////////////
319:
320:            /** Map from resource to syntactic/semantic checks that a node can be seen as the given facet */
321:            private static HashMap s_supportsChecks = new HashMap();
322:
323:            static {
324:                // initialise the map of supports checks from a table of static data
325:                for (int i = 0; i < s_supportsCheckData.length; i++) {
326:                    s_supportsChecks.put(s_supportsCheckData[i][0],
327:                            s_supportsCheckData[i][1]);
328:                }
329:            }
330:
331:            protected Map getCheckTable() {
332:                return s_supportsChecks;
333:            }
334:        }
335:
336:        /*
337:         (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
338:         All rights reserved.
339:
340:         Redistribution and use in source and binary forms, with or without
341:         modification, are permitted provided that the following conditions
342:         are met:
343:
344:         1. Redistributions of source code must retain the above copyright
345:         notice, this list of conditions and the following disclaimer.
346:
347:         2. Redistributions in binary form must reproduce the above copyright
348:         notice, this list of conditions and the following disclaimer in the
349:         documentation and/or other materials provided with the distribution.
350:
351:         3. The name of the author may not be used to endorse or promote products
352:         derived from this software without specific prior written permission.
353:
354:         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
355:         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
356:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
357:         IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
358:         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
359:         NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
360:         DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
361:         THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
362:         (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
363:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
364:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.