KickJava   Java API By Example, From Geeks To Geeks.

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


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

10 package com.hp.hpl.jena.reasoner.rulesys;
11
12 import com.hp.hpl.jena.reasoner.InfGraph;
13 import com.hp.hpl.jena.util.iterator.ClosableIterator;
14 import com.hp.hpl.jena.graph.*;
15
16 /**
17  * Interface used to convey context information from a rule engine
18  * to the stack of procedural builtins. This gives access
19  * to the triggering rule, the variable bindings and the set of
20  * currently known triples.
21  *
22  * @author <a HREF="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
23  * @version $Revision: 1.9 $ on $Date: 2005/02/21 12:17:05 $
24  */

25 public interface RuleContext {
26     /**
27      * Returns the current variable binding environment for the current rule.
28      * @return BindingEnvironment
29      */

30     public BindingEnvironment getEnv();
31
32     /**
33      * Returns the parent inference graph.
34      * @return InfGraph
35      */

36     public InfGraph getGraph();
37     
38     /**
39      * Returns the rule.
40      * @return Rule
41      */

42     public Rule getRule();
43
44     /**
45      * Sets the rule.
46      * @param rule The rule to set
47      */

48     public void setRule(Rule rule);
49     
50     /**
51      * Return true if the triple is already in either the graph or the stack.
52      * I.e. it has already been deduced.
53      */

54     public boolean contains(Triple t);
55     
56     /**
57      * Return true if the triple pattern is already in either the graph or the stack.
58      * I.e. it has already been deduced.
59      */

60     public boolean contains(Node s, Node p, Node o);
61     
62     /**
63      * In some formulations the context includes deductions that are not yet
64      * visible to the underlying graph but need to be checked for.
65      */

66     public ClosableIterator find(Node s, Node p, Node o);
67     
68     /**
69      * Assert a new triple in the deduction graph, bypassing any processing machinery.
70      */

71     public void silentAdd(Triple t);
72
73     /**
74      * Assert a new triple in the deduction graph, triggering any consequent processing as appropriate.
75      */

76     public void add(Triple t);
77     
78     /**
79      * Remove a triple from the deduction graph (and the original graph if relevant).
80      */

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

114
Popular Tags