KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > reasoner > rulesys > impl > oldCode > OWLRuleReasonerFactory


1 /******************************************************************
2  * File: OWLRuleReasonerFactory.java
3  * Created by: Dave Reynolds
4  * Created on: 12-Apr-03
5  *
6  * (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
7  * [See end of file]
8  * $Id: OWLRuleReasonerFactory.java,v 1.5 2005/02/21 12:18:05 andy_seaborne Exp $
9  *****************************************************************/

10 package com.hp.hpl.jena.reasoner.rulesys.impl.oldCode;
11
12
13 import com.hp.hpl.jena.reasoner.*;
14 import com.hp.hpl.jena.reasoner.rulesys.Util;
15 import com.hp.hpl.jena.rdf.model.*;
16 import com.hp.hpl.jena.vocabulary.*;
17
18 /**
19  * @deprecated Obsoleted post jena2.0, replaced by
20  * {@link com.hp.hpl.jena.reasoner.rulesys.OWLFBRuleReasonerFactory}.
21  *
22  * Factory class for creating blank instances of the OWL Reasoner.
23  * <p>
24  * The reasoner can be configured using three properties (set as
25  * properties of the base reasonder URI in a configuration model). These are:
26  * <ul>
27  * <li><b>derivationLogging</b> - if set to true this causes all derivations to
28  * be recorded in an internal data structure for replay through the {@link com.hp.hpl.jena.reasoner.InfGraph#getDerivation getDerivation}
29  * method. </li>
30  * <li><b>traceOn</b> - if set to true this causes all rule firings and deduced triples to be
31  * written out to the Log at INFO level.</li>
32  * <li><b>ruleThreshold</b> - which limits the number of rules that can be fired on a single
33  * data processing stage to the given number (useful to limit infinite runaways). </li>
34  * </ul>
35  *
36  * @author <a HREF="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
37  * @version $Revision: 1.5 $ on $Date: 2005/02/21 12:18:05 $
38  */

39 public class OWLRuleReasonerFactory implements ReasonerFactory {
40     
41     /** Single global instance of this factory */
42     private static ReasonerFactory theInstance = new OWLRuleReasonerFactory();
43     
44     /** Static URI for this reasoner type */
45     public static final String JavaDoc URI = "http://jena.hpl.hp.com/2003/OWLRuleReasoner";
46     
47     /** Cache of the capabilities description */
48     protected Model capabilities;
49     
50     /**
51      * Return the single global instance of this factory
52      */

53     public static ReasonerFactory theInstance() {
54         return theInstance;
55     }
56     
57     /**
58      * Constructor method that builds an instance of the associated Reasoner
59      * @param configuration a set of arbitrary configuration information to be
60      * passed the reasoner, encoded as RDF properties of a base configuration resource,
61      * can be null in no custom configuration is required.
62      */

63     public Reasoner create(Resource configuration) {
64         OWLRuleReasoner reasoner = new OWLRuleReasoner();
65         if (configuration != null) {
66             Boolean JavaDoc doLog = Util.checkBinaryPredicate(ReasonerVocabulary.PROPderivationLogging, configuration);
67             if (doLog != null) {
68                 reasoner.setDerivationLogging(doLog.booleanValue());
69             }
70             Boolean JavaDoc doTrace = Util.checkBinaryPredicate(ReasonerVocabulary.PROPtraceOn, configuration);
71             if (doTrace != null) {
72                 reasoner.setTraceOn(doTrace.booleanValue());
73             }
74         }
75         return reasoner;
76     }
77    
78     /**
79      * Return a description of the capabilities of this reasoner encoded in
80      * RDF. This method is normally called by the ReasonerRegistry which caches
81      * the resulting information so dynamically creating here is not really an overhead.
82      */

83     public Model getCapabilities() {
84         if (capabilities == null) {
85             capabilities = ModelFactory.createDefaultModel();
86             Resource base = capabilities.createResource(getURI());
87             base.addProperty(ReasonerVocabulary.nameP, "OWL Rule Reasoner")
88                 .addProperty(ReasonerVocabulary.descriptionP, "Experimental OWL reasoner.\n"
89                                             + "Pure forward chaining so all entailments are immediate calculated\n"
90                                             + "Can separate tbox and abox data if desired to reuse tbox caching or mix them.")
91                 .addProperty(ReasonerVocabulary.supportsP, RDFS.subClassOf)
92                 .addProperty(ReasonerVocabulary.supportsP, RDFS.subPropertyOf)
93                 .addProperty(ReasonerVocabulary.supportsP, RDFS.member)
94                 .addProperty(ReasonerVocabulary.supportsP, RDFS.range)
95                 .addProperty(ReasonerVocabulary.supportsP, RDFS.domain)
96                 // TODO - add OWL elements supported
97
.addProperty(ReasonerVocabulary.supportsP, ReasonerVocabulary.individualAsThingP )
98                 .addProperty(ReasonerVocabulary.versionP, "0.1");
99         }
100         return capabilities;
101     }
102     
103     /**
104      * Return the URI labelling this type of reasoner
105      */

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

141
142
Popular Tags