KickJava   Java API By Example, From Geeks To Geeks.

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


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

10 package com.hp.hpl.jena.reasoner.rulesys;
11
12 import com.hp.hpl.jena.rdf.model.*;
13 import com.hp.hpl.jena.reasoner.*;
14 import com.hp.hpl.jena.vocabulary.ReasonerVocabulary;
15
16 /**
17  * Factory object for creating general rule reasoner instances. The
18  * specific rule set and mode confriguration can be set either be method
19  * calls to the created reasoner or though parameters in the configuration Model.
20  *
21  * @author <a HREF="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
22  * @version $Revision: 1.10 $ on $Date: 2005/02/21 12:16:59 $
23  */

24 public class GenericRuleReasonerFactory implements ReasonerFactory {
25     
26     /** Single global instance of this factory */
27     private static GenericRuleReasonerFactory theInstance = new GenericRuleReasonerFactory();
28     
29     /** Static URI for this reasoner type */
30     public static final String JavaDoc URI = "http://jena.hpl.hp.com/2003/GenericRuleReasoner";
31     
32     /** Cache of the capabilities description */
33     protected Model capabilities;
34     
35     /**
36      * Return the single global instance of this factory
37      */

38     public static GenericRuleReasonerFactory theInstance() {
39         return theInstance;
40     }
41     
42     /**
43      * Constructor method that builds an instance of the associated Reasoner
44      * @param configuration a set of arbitrary configuration information to be
45      * passed the reasoner, encoded as RDF properties of a base configuration resource,
46      * can be null in no custom configuration is required.
47      */

48     public Reasoner create( Resource configuration ) {
49         return new GenericRuleReasoner( this, configuration );
50     }
51    
52     /**
53      * Return a description of the capabilities of this reasoner encoded in
54      * RDF. This method is normally called by the ReasonerRegistry which caches
55      * the resulting information so dynamically creating here is not really an overhead.
56      */

57     public Model getCapabilities() {
58         if (capabilities == null) {
59             capabilities = ModelFactory.createDefaultModel();
60             Resource base = capabilities.createResource(getURI());
61             base.addProperty(ReasonerVocabulary.nameP, "Generic Rule Reasoner")
62                 .addProperty(ReasonerVocabulary.descriptionP, "Generic rule reasoner, configurable")
63                 .addProperty(ReasonerVocabulary.versionP, "0.1");
64         }
65         return capabilities;
66     }
67     
68     /**
69      * Return the URI labelling this type of reasoner
70      */

71     public String JavaDoc getURI() {
72         return URI;
73     }
74
75 }
76
77
78
79 /*
80     (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
81     All rights reserved.
82
83     Redistribution and use in source and binary forms, with or without
84     modification, are permitted provided that the following conditions
85     are met:
86
87     1. Redistributions of source code must retain the above copyright
88        notice, this list of conditions and the following disclaimer.
89
90     2. Redistributions in binary form must reproduce the above copyright
91        notice, this list of conditions and the following disclaimer in the
92        documentation and/or other materials provided with the distribution.
93
94     3. The name of the author may not be used to endorse or promote products
95        derived from this software without specific prior written permission.
96
97     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
98     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
99     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
100     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
101     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
102     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
103     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
104     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
105     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
106     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
107 */
Popular Tags