KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

51     public static ReasonerFactory theInstance() {
52         return theInstance;
53     }
54     
55     /**
56      * Constructor method that builds an instance of the associated Reasoner
57      * @param configuration a set of arbitrary configuration information to be
58      * passed the reasoner encoded within an RDF graph
59      */

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

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

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