KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > reasoner > Reasoner


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

10 package com.hp.hpl.jena.reasoner;
11
12 import com.hp.hpl.jena.graph.Capabilities;
13 import com.hp.hpl.jena.graph.Graph;
14 import com.hp.hpl.jena.rdf.model.*;
15
16 /**
17  * The minimal interface to which all reasoners (or reasoner adaptors) conform.
18  * This only supports attaching the reasoner to a set of RDF graphs
19  * which represent the rules or ontologies and instance data. The actual
20  * reasoner requests are made through the InfGraph which is generated once
21  * the reasoner has been bound to a set of RDF data.
22  *
23  * @author <a HREF="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
24  * @version $Revision: 1.16 $ on $Date: 2005/02/21 12:16:15 $
25  */

26 public interface Reasoner {
27     
28     /**
29      * This is most commonly used to attach an ontology (a set of tbox
30      * axioms in description logics jargon) to a reasoner. A certain amount
31      * of precomputation may be done at this time (e.g. constructing the
32      * class lattice). When the reasoner is later applied some instance data
33      * these cached precomputations may be reused.
34      * <p>In fact this call may be more general than the above
35      * description suggests. Firstly, a reasoner that supports arbitrary rules
36      * rather than ontologies may use the same method to bind the reasoner
37      * to the specific rule set (encoded in RDF). Secondly, even in the ontology
38      * case a given reasoner may not require a strict separation of tbox and
39      * abox - it may allow instance data in the tbox and terminology axioms in
40      * the abox. </p>
41      * <p>A reasoner is free to simply note this set of RDF and merge with any
42      * future RDF rather than do processing at this time. </p>
43      * @param tbox the ontology axioms or rule set encoded in RDF
44      * @return a reasoner instace which can be used to process a data graph,
45      * it may be the same instance - bindSchema is not required to be side-effect free.
46      * @throws ReasonerException if the reasoner cannot be
47      * bound to a rule set in this way, for example if the underlying engine
48      * can only accept a single rule set in this way and one rule set has
49      * already been bound in of if the ruleset is illformed.
50      */

51     public Reasoner bindSchema(Graph tbox) throws ReasonerException;
52     
53     /**
54      * This is most commonly used to attach an ontology (a set of tbox
55      * axioms in description logics jargon) to a reasoner. A certain amount
56      * of precomputation may be done at this time (e.g. constructing the
57      * class lattice). When the reasoner is later applied some instance data
58      * these cached precomputations may be reused.
59      * <p>In fact this call may be more general than the above
60      * description suggests. Firstly, a reasoner that supports arbitrary rules
61      * rather than ontologies may use the same method to bind the reasoner
62      * to the specific rule set (encoded in RDF). Secondly, even in the ontology
63      * case a given reasoner may not require a strict separation of tbox and
64      * abox - it may allow instance data in the tbox and terminology axioms in
65      * the abox. </p>
66      * <p>A reasoner is free to simply note this set of RDF and merge with any
67      * future RDF rather than do processing at this time. </p>
68      * @param tbox the ontology axioms or rule set encoded in RDF
69      * @return a reasoner instace which can be used to process a data graph,
70      * it may be the same instance - bindSchema is not required to be side-effect free.
71      * @throws ReasonerException if the reasoner cannot be
72      * bound to a rule set in this way, for example if the underlying engine
73      * can only accept a single rule set in this way and one rule set has
74      * already been bound in of if the ruleset is illformed.
75      */

76     public Reasoner bindSchema(Model tbox) throws ReasonerException;
77     
78     /**
79      * Attach the reasoner to a set of RDF data to process.
80      * The reasoner may already have been bound to specific rules or ontology
81      * axioms (encoded in RDF) through earlier bindRuleset calls.
82      * @param data the RDF data to be processed, some reasoners may restrict
83      * the range of RDF which is legal here (e.g. syntactic restrictions in OWL).
84      * @return an inference graph through which the data+reasoner can be queried.
85      * @throws ReasonerException if the data is ill-formed according to the
86      * constraints imposed by this reasoner.
87      */

88     public InfGraph bind(Graph data) throws ReasonerException;
89
90     
91     /**
92      * Switch on/off drivation logging.
93      * If set to true then the InfGraph created from the bind operation will start
94      * life with recording of derivations switched on. This is currently only of relevance
95      * to rule-based reasoners.
96      * <p>
97      * Default - false.
98      */

99     public void setDerivationLogging(boolean logOn);
100     
101     /**
102      * Set a configuration parameter for the reasoner. Parameters can identified
103      * by URI and can also be set when the Reasoner instance is created by specifying a
104      * configuration in RDF.
105      *
106      * @param parameterUri the property identifying the parameter to be changed
107      * @param value the new value for the parameter, typically this is a wrapped
108      * java object like Boolean or Integer.
109      */

110     public void setParameter(Property parameterUri, Object JavaDoc value);
111
112     /**
113      * Return a description of the capabilities of this reasoner encoded in
114      * RDF. These capabilities may be static or may depend on configuration
115      * information supplied at construction time. May be null if there are
116      * no useful capabilities registered.
117      */

118     public Model getReasonerCapabilities();
119     
120     /**
121      * Add a configuration description for this reasoner into a partial
122      * configuration specification model.
123      * @param configSpec a Model into which the configuration information should be placed
124      * @param base the Resource to which the configuration parameters should be added.
125      */

126     public void addDescription(Model configSpec, Resource base);
127
128     /**
129      * Determine whether the given property is recognized and treated specially
130      * by this reasoner. This is a convenience packaging of a special case of getCapabilities.
131      * @param property the property which we want to ask the reasoner about
132      * @return true if the given property is handled specially by the reasoner.
133      */

134     public boolean supportsProperty(Property property);
135
136     /**
137      * Return the Jena Graph Capabilties that the inference graphs generated
138      * by this reasoner are expected to conform to.
139      */

140     public Capabilities getGraphCapabilities();
141 }
142
143
144 /*
145     (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
146     All rights reserved.
147
148     Redistribution and use in source and binary forms, with or without
149     modification, are permitted provided that the following conditions
150     are met:
151
152     1. Redistributions of source code must retain the above copyright
153        notice, this list of conditions and the following disclaimer.
154
155     2. Redistributions in binary form must reproduce the above copyright
156        notice, this list of conditions and the following disclaimer in the
157        documentation and/or other materials provided with the distribution.
158
159     3. The name of the author may not be used to endorse or promote products
160        derived from this software without specific prior written permission.
161
162     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
163     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
164     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
165     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
166     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
167     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
168     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
169     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
170     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
171     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
172 */

173
174
Popular Tags