KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > reasoner > rulesys > OWLMiniReasonerFactory


1 /******************************************************************
2  * File: MiniOWLReasonerFactory.java
3  * Created by: Dave Reynolds
4  * Created on: 19-Mar-2004
5  *
6  * (c) Copyright 2004, 2005 Hewlett-Packard Development Company, LP, all rights reserved.
7  * [See end of file]
8  * $Id: OWLMiniReasonerFactory.java,v 1.6 2005/04/11 11:17:06 der Exp $
9  *****************************************************************/

10 package com.hp.hpl.jena.reasoner.rulesys;
11
12 import com.hp.hpl.jena.reasoner.*;
13 import com.hp.hpl.jena.reasoner.rulesys.Util;
14 import com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveReasoner;
15 import com.hp.hpl.jena.rdf.model.*;
16 import com.hp.hpl.jena.vocabulary.*;
17
18 /**
19  * Reasoner factory for the OWL mini configuration. Key limitations over
20  * the normal OWL configuration are:
21  * <UL>
22  * <li>omits the someValuesFrom => bNode entailments</li>
23  * <li>avoids any guard clauses which would break the find() contract</li>
24  * <li>omits inheritance of range implications for XSD datatype ranges</li>
25  * </UL>
26  *
27  * @author <a HREF="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
28  * @version $Revision: 1.6 $ on $Date: 2005/04/11 11:17:06 $
29  */

30 public class OWLMiniReasonerFactory implements ReasonerFactory {
31     
32     /** Single global instance of this factory */
33     private static ReasonerFactory theInstance = new OWLMiniReasonerFactory();
34     
35     /** Static URI for this reasoner type */
36     public static final String JavaDoc URI = "http://jena.hpl.hp.com/2003/OWLMiniFBRuleReasoner";
37     
38     /** Cache of the capabilities description */
39     protected Model capabilities;
40     
41     /**
42      * Return the single global instance of this factory
43      */

44     public static ReasonerFactory theInstance() {
45         return theInstance;
46     }
47     
48     /**
49      * Constructor method that builds an instance of the associated Reasoner
50      * @param configuration a set of arbitrary configuration information to be
51      * passed the reasoner encoded within an RDF graph
52      */

53     public Reasoner create(Resource configuration) {
54         OWLMiniReasoner reasoner = new OWLMiniReasoner(this);
55         if (configuration != null) {
56             Boolean JavaDoc doLog = Util.checkBinaryPredicate(ReasonerVocabulary.PROPderivationLogging, configuration);
57             if (doLog != null) {
58                 reasoner.setDerivationLogging(doLog.booleanValue());
59             }
60             Boolean JavaDoc doTrace = Util.checkBinaryPredicate(ReasonerVocabulary.PROPtraceOn, configuration);
61             if (doTrace != null) {
62                 reasoner.setTraceOn(doTrace.booleanValue());
63             }
64         }
65         return reasoner;
66     }
67    
68     /**
69      * Return a description of the capabilities of this reasoner encoded in
70      * RDF. This method is normally called by the ReasonerRegistry which caches
71      * the resulting information so dynamically creating here is not really an overhead.
72      */

73     public Model getCapabilities() {
74         if (capabilities == null) {
75             capabilities = ModelFactory.createDefaultModel();
76             Resource base = capabilities.createResource(getURI());
77             base.addProperty(ReasonerVocabulary.nameP, "OWL Mini Reasoner")
78                 .addProperty(ReasonerVocabulary.descriptionP, "Experimental mini OWL reasoner.\n"
79                                             + "Can separate tbox and abox data if desired to reuse tbox caching or mix them.")
80                 .addProperty(ReasonerVocabulary.supportsP, RDFS.subClassOf)
81                 .addProperty(ReasonerVocabulary.supportsP, RDFS.subPropertyOf)
82                 .addProperty(ReasonerVocabulary.supportsP, RDFS.member)
83                 .addProperty(ReasonerVocabulary.supportsP, RDFS.range)
84                 .addProperty(ReasonerVocabulary.supportsP, RDFS.domain)
85                 .addProperty(ReasonerVocabulary.supportsP, TransitiveReasoner.directSubClassOf)
86                 .addProperty(ReasonerVocabulary.supportsP, TransitiveReasoner.directSubPropertyOf)
87                 // TODO - add OWL elements supported
88
.addProperty(ReasonerVocabulary.supportsP, ReasonerVocabulary.individualAsThingP )
89                 .addProperty(ReasonerVocabulary.supportsP, OWL.ObjectProperty )
90                 .addProperty(ReasonerVocabulary.supportsP, OWL.DatatypeProperty)
91                 .addProperty(ReasonerVocabulary.supportsP, OWL.FunctionalProperty )
92                 .addProperty(ReasonerVocabulary.supportsP, OWL.SymmetricProperty )
93                 .addProperty(ReasonerVocabulary.supportsP, OWL.TransitiveProperty )
94                 .addProperty(ReasonerVocabulary.supportsP, OWL.InverseFunctionalProperty )
95
96                 .addProperty(ReasonerVocabulary.supportsP, OWL.hasValue )
97                 .addProperty(ReasonerVocabulary.supportsP, OWL.intersectionOf )
98                 .addProperty(ReasonerVocabulary.supportsP, OWL.unionOf ) // Only partial
99
.addProperty(ReasonerVocabulary.supportsP, OWL.maxCardinality ) // Only partial
100
.addProperty(ReasonerVocabulary.supportsP, OWL.cardinality ) // Only partial
101
.addProperty(ReasonerVocabulary.supportsP, OWL.allValuesFrom ) // Only partial
102
.addProperty(ReasonerVocabulary.supportsP, OWL.sameAs )
103                 .addProperty(ReasonerVocabulary.supportsP, OWL.differentFrom )
104                 .addProperty(ReasonerVocabulary.supportsP, OWL.disjointWith )
105                 
106                 .addProperty(ReasonerVocabulary.versionP, "0.1");
107         }
108         return capabilities;
109     }
110     
111     /**
112      * Return the URI labelling this type of reasoner
113      */

114     public String JavaDoc getURI() {
115         return URI;
116     }
117     
118 }
119
120
121 /*
122     (c) Copyright 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 */
Popular Tags