KickJava   Java API By Example, From Geeks To Geeks.

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


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

10 package com.hp.hpl.jena.reasoner.rulesys;
11
12 import com.hp.hpl.jena.reasoner.*;
13 import com.hp.hpl.jena.rdf.model.*;
14 import com.hp.hpl.jena.vocabulary.*;
15
16 /**
17  * We do not support DAML inference. This factory creates a reasoner which is
18  * a slightly extended variant
19  * of the RDFS reasoner to support some interesting subsets of DAML
20  * that correspond roughly to what was there in Jena1. We hope.
21  *
22  * @author <a HREF="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
23  * @version $Revision: 1.7 $ on $Date: 2005/02/21 12:16:57 $
24  */

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

39     public static ReasonerFactory theInstance() {
40         return theInstance;
41     }
42     
43     /**
44      * Constructor method that builds an instance of the associated Reasoner
45      * @param configuration a set of arbitrary configuration information for the reasoner, this will be
46      * ignored in this case because the micro reasoner is not configurable
47      */

48     public Reasoner create(Resource configuration) {
49         return new DAMLMicroReasoner(this);
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, "DAML micro Rule Reasoner")
62                 .addProperty(ReasonerVocabulary.descriptionP, "RDFS rule set with small extensions to support DAML")
63                 .addProperty(ReasonerVocabulary.supportsP, RDFS.subClassOf)
64                 .addProperty(ReasonerVocabulary.supportsP, RDFS.subPropertyOf)
65                 .addProperty(ReasonerVocabulary.supportsP, RDFS.member)
66                 .addProperty(ReasonerVocabulary.supportsP, RDFS.range)
67                 .addProperty(ReasonerVocabulary.supportsP, RDFS.domain)
68                 .addProperty(ReasonerVocabulary.supportsP, DAML_OIL.subClassOf)
69                 .addProperty(ReasonerVocabulary.supportsP, DAML_OIL.subPropertyOf)
70                 .addProperty(ReasonerVocabulary.supportsP, DAML_OIL.range)
71                 .addProperty(ReasonerVocabulary.supportsP, DAML_OIL.domain)
72                 .addProperty(ReasonerVocabulary.supportsP, ReasonerVocabulary.individualAsThingP )
73                 .addProperty(ReasonerVocabulary.versionP, "0.1");
74         }
75         return capabilities;
76     }
77     
78     /**
79      * Return the URI labelling this type of reasoner
80      */

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