Source Code Cross Referenced for DAML_OILProfile.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: DAML_OILProfile.java,v $
010:         * Revision           $Revision: 1.30 $
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 2001, 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.*;
024:        import com.hp.hpl.jena.ontology.*;
025:        import com.hp.hpl.jena.rdf.model.*;
026:        import com.hp.hpl.jena.vocabulary.*;
027:
028:        import java.util.*;
029:
030:        /**
031:         * <p>
032:         * Vocabulary constants for DAML+OIL, March 2001 version. This version of the DAML
033:         * vocabulary uses RDFS namespace terms for subClass, subProperty, etc. This was not
034:         * the case up to and including Jena 2.1.  In Jena 2.1, all of the constants in the
035:         * DAML vocabulary used the DAML namespace.  The DAML langauge defines both as
036:         * equivalent, but recognising this equivalence requires the use of the DAML micro
037:         * reasoner.  For backwards compatability with Jena 2.1, developers should use
038:         * {@link DAML_OILLegacyProfile} with the OntModelSpec.
039:         * </p>
040:         *
041:         * @author Ian Dickinson, HP Labs
042:         *         (<a  href="mailto:Ian.Dickinson@hp.com" >email</a>)
043:         * @version CVS $Id: DAML_OILProfile.java,v 1.30 2008/01/02 12:08:02 andy_seaborne Exp $
044:         */
045:        public class DAML_OILProfile extends AbstractProfile {
046:            // Constants
047:            //////////////////////////////////
048:
049:            // Static variables
050:            //////////////////////////////////
051:
052:            // Instance variables
053:            //////////////////////////////////
054:
055:            /** Model to hold the vocabulary resources only */
056:            private Model m_vocabModel = ModelFactory.createDefaultModel();
057:
058:            // class resources
059:            private Resource m_class = m_vocabModel
060:                    .createResource(DAML_OIL.Class.getURI());
061:            private Resource m_restriction = m_vocabModel
062:                    .createResource(DAML_OIL.Restriction.getURI());
063:            private Resource m_thing = m_vocabModel
064:                    .createResource(DAML_OIL.Thing.getURI());
065:            private Resource m_nothing = m_vocabModel
066:                    .createResource(DAML_OIL.Nothing.getURI());
067:            private Resource m_property = m_vocabModel
068:                    .createResource(DAML_OIL.Property.getURI());
069:            private Resource m_objectProperty = m_vocabModel
070:                    .createResource(DAML_OIL.ObjectProperty.getURI());
071:            private Resource m_datatypeProperty = m_vocabModel
072:                    .createResource(DAML_OIL.DatatypeProperty.getURI());
073:            private Resource m_transitiveProperty = m_vocabModel
074:                    .createResource(DAML_OIL.TransitiveProperty.getURI());
075:            private Resource m_symmetricProperty = null;
076:            private Resource m_functionalProperty = m_vocabModel
077:                    .createResource(DAML_OIL.UniqueProperty.getURI());
078:            private Resource m_inverseFunctionalProperty = m_vocabModel
079:                    .createResource(DAML_OIL.UnambiguousProperty.getURI());
080:            private Resource m_allDifferent = null;
081:            private Resource m_ontology = m_vocabModel
082:                    .createResource(DAML_OIL.Ontology.getURI());
083:            private Resource m_deprecatedClass = null;
084:            private Resource m_deprecatedProperty = null;
085:            private Resource m_annotationProperty = null;
086:            private Resource m_ontologyProperty = null;
087:            private Resource m_list = m_vocabModel.createResource(DAML_OIL.List
088:                    .getURI());
089:            private Resource m_nil = m_vocabModel.createResource(DAML_OIL.nil
090:                    .getURI());
091:            private Resource m_datarange = null;
092:
093:            private Property m_equivalentProperty = m_vocabModel
094:                    .createProperty(DAML_OIL.samePropertyAs.getNameSpace(),
095:                            DAML_OIL.samePropertyAs.getLocalName());
096:            private Property m_equivalentClass = m_vocabModel.createProperty(
097:                    DAML_OIL.sameClassAs.getNameSpace(), DAML_OIL.sameClassAs
098:                            .getLocalName());
099:            private Property m_disjointWith = m_vocabModel.createProperty(
100:                    DAML_OIL.disjointWith.getNameSpace(), DAML_OIL.disjointWith
101:                            .getLocalName());
102:            private Property m_sameIndividualAs = m_vocabModel.createProperty(
103:                    DAML_OIL.sameIndividualAs.getNameSpace(),
104:                    DAML_OIL.sameIndividualAs.getLocalName());
105:            private Property m_sameAs = m_vocabModel.createProperty(
106:                    DAML_OIL.equivalentTo.getNameSpace(), DAML_OIL.equivalentTo
107:                            .getLocalName());
108:            private Property m_differentFrom = m_vocabModel.createProperty(
109:                    DAML_OIL.differentIndividualFrom.getNameSpace(),
110:                    DAML_OIL.differentIndividualFrom.getLocalName());
111:            private Property m_distinctMembers = null;
112:            private Property m_unionOf = m_vocabModel.createProperty(
113:                    DAML_OIL.unionOf.getNameSpace(), DAML_OIL.unionOf
114:                            .getLocalName());
115:            private Property m_intersectionOf = m_vocabModel.createProperty(
116:                    DAML_OIL.intersectionOf.getNameSpace(),
117:                    DAML_OIL.intersectionOf.getLocalName());
118:            private Property m_complementOf = m_vocabModel.createProperty(
119:                    DAML_OIL.complementOf.getNameSpace(), DAML_OIL.complementOf
120:                            .getLocalName());
121:            private Property m_oneOf = m_vocabModel.createProperty(
122:                    DAML_OIL.oneOf.getNameSpace(), DAML_OIL.oneOf
123:                            .getLocalName());
124:            private Property m_onProperty = m_vocabModel.createProperty(
125:                    DAML_OIL.onProperty.getNameSpace(), DAML_OIL.onProperty
126:                            .getLocalName());
127:            private Property m_allValuesFrom = m_vocabModel.createProperty(
128:                    DAML_OIL.toClass.getNameSpace(), DAML_OIL.toClass
129:                            .getLocalName());
130:            private Property m_hasValue = m_vocabModel.createProperty(
131:                    DAML_OIL.hasValue.getNameSpace(), DAML_OIL.hasValue
132:                            .getLocalName());
133:            private Property m_someValuesFrom = m_vocabModel.createProperty(
134:                    DAML_OIL.hasClass.getNameSpace(), DAML_OIL.hasClass
135:                            .getLocalName());
136:            private Property m_minCardinality = m_vocabModel.createProperty(
137:                    DAML_OIL.minCardinality.getNameSpace(),
138:                    DAML_OIL.minCardinality.getLocalName());
139:            private Property m_maxCardinality = m_vocabModel.createProperty(
140:                    DAML_OIL.maxCardinality.getNameSpace(),
141:                    DAML_OIL.maxCardinality.getLocalName());
142:            private Property m_cardinality = m_vocabModel.createProperty(
143:                    DAML_OIL.cardinality.getNameSpace(), DAML_OIL.cardinality
144:                            .getLocalName());
145:            private Property m_inverseOf = m_vocabModel.createProperty(
146:                    DAML_OIL.inverseOf.getNameSpace(), DAML_OIL.inverseOf
147:                            .getLocalName());
148:            private Property m_imports = m_vocabModel.createProperty(
149:                    DAML_OIL.imports.getNameSpace(), DAML_OIL.imports
150:                            .getLocalName());
151:            private Property m_versionInfo = m_vocabModel.createProperty(
152:                    DAML_OIL.versionInfo.getNameSpace(), DAML_OIL.versionInfo
153:                            .getLocalName());
154:            private Property m_priorVersion = null;
155:            private Property m_backwardsCompatibleWith = null;
156:            private Property m_incompatibleWith = null;
157:            private Property m_subPropertyOf = m_vocabModel
158:                    .createProperty(RDFS.subPropertyOf.getURI());
159:            private Property m_subClassOf = m_vocabModel
160:                    .createProperty(RDFS.subClassOf.getURI());
161:            private Property m_domain = m_vocabModel.createProperty(RDFS.domain
162:                    .getURI());
163:            private Property m_range = m_vocabModel.createProperty(RDFS.range
164:                    .getURI());
165:            private Property m_first = m_vocabModel.createProperty(
166:                    DAML_OIL.first.getNameSpace(), DAML_OIL.first
167:                            .getLocalName());
168:            private Property m_rest = m_vocabModel.createProperty(DAML_OIL.rest
169:                    .getNameSpace(), DAML_OIL.rest.getLocalName());
170:            private Property m_minCardinalityQ = m_vocabModel.createProperty(
171:                    DAML_OIL.minCardinalityQ.getNameSpace(),
172:                    DAML_OIL.minCardinalityQ.getLocalName());
173:            private Property m_maxCardinalityQ = m_vocabModel.createProperty(
174:                    DAML_OIL.maxCardinalityQ.getNameSpace(),
175:                    DAML_OIL.maxCardinalityQ.getLocalName());
176:            private Property m_cardinalityQ = m_vocabModel.createProperty(
177:                    DAML_OIL.cardinalityQ.getNameSpace(), DAML_OIL.cardinalityQ
178:                            .getLocalName());
179:            private Property m_hasClassQ = m_vocabModel.createProperty(
180:                    DAML_OIL.hasClassQ.getNameSpace(), DAML_OIL.hasClassQ
181:                            .getLocalName());
182:
183:            // Constructors
184:            //////////////////////////////////
185:
186:            // External signature methods
187:            //////////////////////////////////
188:
189:            /**
190:             * <p>
191:             * Answer the string that is the namespace prefix for this vocabulary
192:             * </p>
193:             *
194:             * @return The namespace prefix <code>http://www.daml.org/2001/03/daml+oil#</code>
195:             */
196:            public static String _NAMESPACE() {
197:                return "http://www.daml.org/2001/03/daml+oil#";
198:            }
199:
200:            public String NAMESPACE() {
201:                return DAML_OILProfile._NAMESPACE();
202:            }
203:
204:            public Resource CLASS() {
205:                return m_class;
206:            }
207:
208:            public Resource RESTRICTION() {
209:                return m_restriction;
210:            }
211:
212:            public Resource THING() {
213:                return m_thing;
214:            }
215:
216:            public Resource NOTHING() {
217:                return m_nothing;
218:            }
219:
220:            public Resource PROPERTY() {
221:                return m_property;
222:            }
223:
224:            public Resource OBJECT_PROPERTY() {
225:                return m_objectProperty;
226:            }
227:
228:            public Resource DATATYPE_PROPERTY() {
229:                return m_datatypeProperty;
230:            }
231:
232:            public Resource TRANSITIVE_PROPERTY() {
233:                return m_transitiveProperty;
234:            }
235:
236:            public Resource SYMMETRIC_PROPERTY() {
237:                return m_symmetricProperty;
238:            }
239:
240:            public Resource FUNCTIONAL_PROPERTY() {
241:                return m_functionalProperty;
242:            }
243:
244:            public Resource INVERSE_FUNCTIONAL_PROPERTY() {
245:                return m_inverseFunctionalProperty;
246:            }
247:
248:            public Resource ALL_DIFFERENT() {
249:                return m_allDifferent;
250:            }
251:
252:            public Resource ONTOLOGY() {
253:                return m_ontology;
254:            }
255:
256:            public Resource DEPRECATED_CLASS() {
257:                return m_deprecatedClass;
258:            }
259:
260:            public Resource DEPRECATED_PROPERTY() {
261:                return m_deprecatedProperty;
262:            }
263:
264:            public Resource ANNOTATION_PROPERTY() {
265:                return m_annotationProperty;
266:            }
267:
268:            public Resource ONTOLOGY_PROPERTY() {
269:                return m_ontologyProperty;
270:            }
271:
272:            public Resource LIST() {
273:                return m_list;
274:            }
275:
276:            public Resource NIL() {
277:                return m_nil;
278:            }
279:
280:            public Resource DATARANGE() {
281:                return m_datarange;
282:            }
283:
284:            public Property EQUIVALENT_PROPERTY() {
285:                return m_equivalentProperty;
286:            }
287:
288:            public Property EQUIVALENT_CLASS() {
289:                return m_equivalentClass;
290:            }
291:
292:            public Property DISJOINT_WITH() {
293:                return m_disjointWith;
294:            }
295:
296:            public Property SAME_INDIVIDUAL_AS() {
297:                return m_sameIndividualAs;
298:            }
299:
300:            public Property SAME_AS() {
301:                return m_sameAs;
302:            }
303:
304:            public Property DIFFERENT_FROM() {
305:                return m_differentFrom;
306:            }
307:
308:            public Property DISTINCT_MEMBERS() {
309:                return m_distinctMembers;
310:            }
311:
312:            public Property UNION_OF() {
313:                return m_unionOf;
314:            }
315:
316:            public Property INTERSECTION_OF() {
317:                return m_intersectionOf;
318:            }
319:
320:            public Property COMPLEMENT_OF() {
321:                return m_complementOf;
322:            }
323:
324:            public Property ONE_OF() {
325:                return m_oneOf;
326:            }
327:
328:            public Property ON_PROPERTY() {
329:                return m_onProperty;
330:            }
331:
332:            public Property ALL_VALUES_FROM() {
333:                return m_allValuesFrom;
334:            }
335:
336:            public Property HAS_VALUE() {
337:                return m_hasValue;
338:            }
339:
340:            public Property SOME_VALUES_FROM() {
341:                return m_someValuesFrom;
342:            }
343:
344:            public Property MIN_CARDINALITY() {
345:                return m_minCardinality;
346:            }
347:
348:            public Property MAX_CARDINALITY() {
349:                return m_maxCardinality;
350:            }
351:
352:            public Property CARDINALITY() {
353:                return m_cardinality;
354:            }
355:
356:            public Property INVERSE_OF() {
357:                return m_inverseOf;
358:            }
359:
360:            public Property IMPORTS() {
361:                return m_imports;
362:            }
363:
364:            public Property PRIOR_VERSION() {
365:                return m_priorVersion;
366:            }
367:
368:            public Property BACKWARD_COMPATIBLE_WITH() {
369:                return m_backwardsCompatibleWith;
370:            }
371:
372:            public Property INCOMPATIBLE_WITH() {
373:                return m_incompatibleWith;
374:            }
375:
376:            public Property SUB_CLASS_OF() {
377:                return m_subClassOf;
378:            }
379:
380:            public Property SUB_PROPERTY_OF() {
381:                return m_subPropertyOf;
382:            }
383:
384:            public Property DOMAIN() {
385:                return m_domain;
386:            }
387:
388:            public Property RANGE() {
389:                return m_range;
390:            }
391:
392:            public Property FIRST() {
393:                return m_first;
394:            }
395:
396:            public Property REST() {
397:                return m_rest;
398:            }
399:
400:            public Property MIN_CARDINALITY_Q() {
401:                return m_minCardinalityQ;
402:            }
403:
404:            public Property MAX_CARDINALITY_Q() {
405:                return m_maxCardinalityQ;
406:            }
407:
408:            public Property CARDINALITY_Q() {
409:                return m_cardinalityQ;
410:            }
411:
412:            public Property HAS_CLASS_Q() {
413:                return m_hasClassQ;
414:            }
415:
416:            // Annotations
417:            public Property VERSION_INFO() {
418:                return m_versionInfo;
419:            }
420:
421:            public Property LABEL() {
422:                return RDFS.label;
423:            }
424:
425:            public Property COMMENT() {
426:                return RDFS.comment;
427:            }
428:
429:            public Property SEE_ALSO() {
430:                return RDFS.seeAlso;
431:            }
432:
433:            public Property IS_DEFINED_BY() {
434:                return RDFS.isDefinedBy;
435:            }
436:
437:            protected Resource[][] aliasTable() {
438:                return new Resource[][] {
439:                        { DAML_OIL.subClassOf, RDFS.subClassOf },
440:                        { DAML_OIL.Literal, RDFS.Literal },
441:                        { DAML_OIL.Property, RDF.Property },
442:                        { DAML_OIL.type, RDF.type },
443:                        { DAML_OIL.value, RDF.value },
444:                        { DAML_OIL.subPropertyOf, RDFS.subPropertyOf },
445:                        { DAML_OIL.domain, RDFS.domain },
446:                        { DAML_OIL.range, RDFS.range },
447:                        { DAML_OIL.label, RDFS.label },
448:                        { DAML_OIL.comment, RDFS.comment },
449:                        { DAML_OIL.seeAlso, RDFS.seeAlso },
450:                        { DAML_OIL.isDefinedBy, RDFS.isDefinedBy }, };
451:            }
452:
453:            /** There are no first-class axioms in DAML */
454:            public Iterator getAxiomTypes() {
455:                return Arrays.asList(new Resource[] {}).iterator();
456:            }
457:
458:            /** The annotation properties of DAML (currently none) */
459:            public Iterator getAnnotationProperties() {
460:                return Arrays.asList(new Resource[] {}).iterator();
461:            }
462:
463:            public Iterator getClassDescriptionTypes() {
464:                return Arrays
465:                        .asList(
466:                                new Resource[] { DAML_OIL.Class,
467:                                        DAML_OIL.Restriction }).iterator();
468:            }
469:
470:            /**
471:             * <p>
472:             * Answer true if the given graph supports a view of this node as the given
473:             * language element, according to the semantic constraints of the profile.
474:             * If strict checking on the ontology model is turned off, this check is
475:             * skipped.
476:             * </p>
477:             *
478:             * @param n A node to test
479:             * @param g The enhanced graph containing <code>n</code>, which is assumed to
480:             * be an {@link OntModel}.
481:             * @param type A class indicating the facet that we are testing against.
482:             * @return True if strict checking is off, or if <code>n</code> can be
483:             * viewed according to the facet resource <code>res</code>
484:             */
485:            public boolean isSupported(Node n, EnhGraph g, Class type) {
486:                if (g instanceof  OntModel) {
487:                    OntModel m = (OntModel) g;
488:
489:                    if (type == null) {
490:                        // if the facet resource is null, the facet is not in this profile so
491:                        // we automatically return false;
492:                        return false;
493:                    } else if (!m.strictMode()) {
494:                        // checking turned off
495:                        return true;
496:                    } else {
497:                        // lookup the profile check for this resource
498:                        SupportsCheck check = (SupportsCheck) s_supportsChecks
499:                                .get(type);
500:
501:                        return (check == null) || check.doCheck(n, g);
502:                    }
503:                } else {
504:                    return false;
505:                }
506:            }
507:
508:            /**
509:             * <p>
510:             * Answer a descriptive string for this profile, for use in debugging and other output.
511:             * </p>
512:             * @return "DAML+OIL"
513:             */
514:            public String getLabel() {
515:                return "DAML+OIL";
516:            }
517:
518:            // Internal implementation methods
519:            //////////////////////////////////
520:
521:            //==============================================================================
522:            // Inner class definitions
523:            //==============================================================================
524:
525:            /** Helper class for doing syntactic/semantic checks on a node */
526:            protected static class SupportsCheck {
527:                public boolean doCheck(Node n, EnhGraph g) {
528:                    return true;
529:                }
530:            }
531:
532:            // Table of check data
533:            //////////////////////
534:
535:            private static Object[][] s_supportsCheckTable = new Object[][] {
536:                    // Resource (key),              check method
537:                    { OntClass.class, new SupportsCheck() {
538:                        public boolean doCheck(Node n, EnhGraph g) {
539:                            return g.asGraph().contains(n, RDF.type.asNode(),
540:                                    DAML_OIL.Class.asNode())
541:                                    || g.asGraph().contains(n,
542:                                            RDF.type.asNode(),
543:                                            DAML_OIL.Restriction.asNode())
544:                                    || g.asGraph().contains(n,
545:                                            RDF.type.asNode(),
546:                                            RDFS.Class.asNode())
547:                                    ||
548:                                    // common cases we should support
549:                                    n.equals(DAML_OIL.Thing.asNode())
550:                                    || n.equals(DAML_OIL.Nothing.asNode())
551:                                    || g.asGraph().contains(Node.ANY,
552:                                            RDFS.domain.asNode(), n)
553:                                    || g.asGraph().contains(Node.ANY,
554:                                            RDFS.range.asNode(), n);
555:                        }
556:                    } },
557:                    { DatatypeProperty.class, new SupportsCheck() {
558:                        public boolean doCheck(Node n, EnhGraph g) {
559:                            return g.asGraph().contains(n, RDF.type.asNode(),
560:                                    DAML_OIL.DatatypeProperty.asNode());
561:                        }
562:                    } },
563:                    { ObjectProperty.class, new SupportsCheck() {
564:                        public boolean doCheck(Node n, EnhGraph g) {
565:                            return g.asGraph().contains(n, RDF.type.asNode(),
566:                                    DAML_OIL.ObjectProperty.asNode())
567:                                    || g.asGraph().contains(
568:                                            n,
569:                                            RDF.type.asNode(),
570:                                            DAML_OIL.TransitiveProperty
571:                                                    .asNode())
572:                                    || g.asGraph().contains(
573:                                            n,
574:                                            RDF.type.asNode(),
575:                                            DAML_OIL.UnambiguousProperty
576:                                                    .asNode());
577:                        }
578:                    } },
579:                    { FunctionalProperty.class, new SupportsCheck() {
580:                        public boolean doCheck(Node n, EnhGraph g) {
581:                            // DAML's alias for functional property is uniqueProperty
582:                            return g.asGraph().contains(n, RDF.type.asNode(),
583:                                    DAML_OIL.UniqueProperty.asNode());
584:                        }
585:                    } },
586:                    { InverseFunctionalProperty.class, new SupportsCheck() {
587:                        public boolean doCheck(Node n, EnhGraph g) {
588:                            // DAML's alias for functional property is unambiguousProperty
589:                            return g.asGraph().contains(n, RDF.type.asNode(),
590:                                    DAML_OIL.UnambiguousProperty.asNode());
591:                        }
592:                    } },
593:                    { RDFList.class, new SupportsCheck() {
594:                        public boolean doCheck(Node n, EnhGraph g) {
595:                            return n.equals(DAML_OIL.nil.asNode())
596:                                    || g.asGraph().contains(n,
597:                                            RDF.type.asNode(),
598:                                            DAML_OIL.List.asNode());
599:                        }
600:                    } },
601:                    { Ontology.class, new SupportsCheck() {
602:                        public boolean doCheck(Node n, EnhGraph g) {
603:                            return n.equals(RDF.nil.asNode())
604:                                    || g.asGraph().contains(n,
605:                                            RDF.type.asNode(),
606:                                            DAML_OIL.Ontology.asNode());
607:                        }
608:                    } },
609:                    { OntProperty.class, new SupportsCheck() {
610:                        public boolean doCheck(Node n, EnhGraph g) {
611:                            return g.asGraph().contains(n, RDF.type.asNode(),
612:                                    RDF.Property.asNode())
613:                                    || g.asGraph().contains(n,
614:                                            RDF.type.asNode(),
615:                                            DAML_OIL.Property.asNode())
616:                                    || g.asGraph().contains(n,
617:                                            RDF.type.asNode(),
618:                                            DAML_OIL.ObjectProperty.asNode())
619:                                    || g.asGraph().contains(n,
620:                                            RDF.type.asNode(),
621:                                            DAML_OIL.DatatypeProperty.asNode())
622:                                    || g.asGraph().contains(
623:                                            n,
624:                                            RDF.type.asNode(),
625:                                            DAML_OIL.TransitiveProperty
626:                                                    .asNode())
627:                                    || g.asGraph().contains(
628:                                            n,
629:                                            RDF.type.asNode(),
630:                                            DAML_OIL.UnambiguousProperty
631:                                                    .asNode())
632:                                    || g.asGraph().contains(n,
633:                                            RDF.type.asNode(),
634:                                            DAML_OIL.UniqueProperty.asNode());
635:                        }
636:                    } },
637:                    { Restriction.class, new SupportsCheck() {
638:                        public boolean doCheck(Node n, EnhGraph g) {
639:                            return g.asGraph().contains(n, RDF.type.asNode(),
640:                                    DAML_OIL.Restriction.asNode());
641:                        }
642:                    } },
643:                    { HasValueRestriction.class, new SupportsCheck() {
644:                        public boolean doCheck(Node n, EnhGraph g) {
645:                            return g.asGraph().contains(n, RDF.type.asNode(),
646:                                    DAML_OIL.Restriction.asNode())
647:                                    && containsSome(g, n, DAML_OIL.hasValue)
648:                                    && containsSome(g, n, DAML_OIL.onProperty);
649:                        }
650:                    } },
651:                    { AllValuesFromRestriction.class, new SupportsCheck() {
652:                        public boolean doCheck(Node n, EnhGraph g) {
653:                            return g.asGraph().contains(n, RDF.type.asNode(),
654:                                    DAML_OIL.Restriction.asNode())
655:                                    && containsSome(g, n, DAML_OIL.toClass)
656:                                    && containsSome(g, n, DAML_OIL.onProperty);
657:                        }
658:                    } },
659:                    { SomeValuesFromRestriction.class, new SupportsCheck() {
660:                        public boolean doCheck(Node n, EnhGraph g) {
661:                            return g.asGraph().contains(n, RDF.type.asNode(),
662:                                    DAML_OIL.Restriction.asNode())
663:                                    && containsSome(g, n, DAML_OIL.hasClass)
664:                                    && containsSome(g, n, DAML_OIL.onProperty);
665:                        }
666:                    } },
667:                    { CardinalityRestriction.class, new SupportsCheck() {
668:                        public boolean doCheck(Node n, EnhGraph g) {
669:                            return g.asGraph().contains(n, RDF.type.asNode(),
670:                                    DAML_OIL.Restriction.asNode())
671:                                    && containsSome(g, n, DAML_OIL.cardinality)
672:                                    && containsSome(g, n, DAML_OIL.onProperty);
673:                        }
674:                    } },
675:                    { MinCardinalityRestriction.class, new SupportsCheck() {
676:                        public boolean doCheck(Node n, EnhGraph g) {
677:                            return g.asGraph().contains(n, RDF.type.asNode(),
678:                                    DAML_OIL.Restriction.asNode())
679:                                    && containsSome(g, n,
680:                                            DAML_OIL.minCardinality)
681:                                    && containsSome(g, n, DAML_OIL.onProperty);
682:                        }
683:                    } },
684:                    { MaxCardinalityRestriction.class, new SupportsCheck() {
685:                        public boolean doCheck(Node n, EnhGraph g) {
686:                            return g.asGraph().contains(n, RDF.type.asNode(),
687:                                    DAML_OIL.Restriction.asNode())
688:                                    && containsSome(g, n,
689:                                            DAML_OIL.maxCardinality)
690:                                    && containsSome(g, n, DAML_OIL.onProperty);
691:                        }
692:                    } },
693:                    { TransitiveProperty.class, new SupportsCheck() {
694:                        public boolean doCheck(Node n, EnhGraph g) {
695:                            return g.asGraph().contains(n, RDF.type.asNode(),
696:                                    DAML_OIL.TransitiveProperty.asNode())
697:                                    && !g.asGraph().contains(n,
698:                                            RDF.type.asNode(),
699:                                            DAML_OIL.DatatypeProperty.asNode());
700:                        }
701:                    } },
702:                    { QualifiedRestriction.class, new SupportsCheck() {
703:                        public boolean doCheck(Node n, EnhGraph g) {
704:                            return g.asGraph().contains(n, RDF.type.asNode(),
705:                                    DAML_OIL.Restriction.asNode())
706:                                    && g.asGraph().contains(n,
707:                                            DAML_OIL.hasClassQ.asNode(),
708:                                            Node.ANY);
709:                        }
710:                    } },
711:                    { CardinalityQRestriction.class, new SupportsCheck() {
712:                        public boolean doCheck(Node n, EnhGraph g) {
713:                            return g.asGraph().contains(n, RDF.type.asNode(),
714:                                    DAML_OIL.Restriction.asNode())
715:                                    && g.asGraph().contains(n,
716:                                            DAML_OIL.cardinalityQ.asNode(),
717:                                            Node.ANY);
718:                        }
719:                    } },
720:                    { MinCardinalityQRestriction.class, new SupportsCheck() {
721:                        public boolean doCheck(Node n, EnhGraph g) {
722:                            return g.asGraph().contains(n, RDF.type.asNode(),
723:                                    DAML_OIL.Restriction.asNode())
724:                                    && g.asGraph().contains(n,
725:                                            DAML_OIL.minCardinalityQ.asNode(),
726:                                            Node.ANY);
727:                        }
728:                    } },
729:                    { MaxCardinalityQRestriction.class, new SupportsCheck() {
730:                        public boolean doCheck(Node n, EnhGraph g) {
731:                            return g.asGraph().contains(n, RDF.type.asNode(),
732:                                    DAML_OIL.Restriction.asNode())
733:                                    && g.asGraph().contains(n,
734:                                            DAML_OIL.maxCardinalityQ.asNode(),
735:                                            Node.ANY);
736:                        }
737:                    } }, };
738:
739:            /* just to avoid having to decorate all the calls above */
740:
741:            public static boolean containsSome(EnhGraph g, Node n, Property p) {
742:                return AbstractProfile.containsSome(g, n, p);
743:            }
744:
745:            // Static variables
746:            //////////////////////////////////
747:
748:            /** Map from resource to syntactic/semantic checks that a node can be seen as the given facet */
749:            protected static HashMap s_supportsChecks = new HashMap();
750:
751:            static {
752:                // initialise the map of supports checks from a table of static data
753:                for (int i = 0; i < s_supportsCheckTable.length; i++) {
754:                    s_supportsChecks.put(s_supportsCheckTable[i][0],
755:                            s_supportsCheckTable[i][1]);
756:                }
757:            }
758:
759:        }
760:
761:        /*
762:         (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
763:         All rights reserved.
764:
765:         Redistribution and use in source and binary forms, with or without
766:         modification, are permitted provided that the following conditions
767:         are met:
768:
769:         1. Redistributions of source code must retain the above copyright
770:         notice, this list of conditions and the following disclaimer.
771:
772:         2. Redistributions in binary form must reproduce the above copyright
773:         notice, this list of conditions and the following disclaimer in the
774:         documentation and/or other materials provided with the distribution.
775:
776:         3. The name of the author may not be used to endorse or promote products
777:         derived from this software without specific prior written permission.
778:
779:         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
780:         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
781:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
782:         IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
783:         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
784:         NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
785:         DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
786:         THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
787:         (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
788:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
789:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.