KickJava   Java API By Example, From Geeks To Geeks.

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


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

10 package com.hp.hpl.jena.reasoner.rulesys;
11
12 import com.hp.hpl.jena.graph.*;
13 import com.hp.hpl.jena.reasoner.TriplePattern;
14
15 /**
16  * Interface through which the current bound values of variables
17  * can be found. Many of the details vary between the forward and
18  * backward chaining system - this interface is the minimal one needed
19  * by most builtins the specific implementations offer richer functionality.
20  *
21  * @author <a HREF="mailto:der@hplb.hpl.hp.com">Dave Reynolds</a>
22  * @version $Revision: 1.8 $ on $Date: 2005/02/21 12:16:56 $
23  */

24 public interface BindingEnvironment {
25         
26     /**
27      * Return the most ground version of the node. If the node is not a variable
28      * just return it, if it is a varible bound in this environment return the binding,
29      * if it is an unbound variable return the variable.
30      */

31     public Node getGroundVersion(Node node);
32     
33     /**
34      * Bind a variable in the current envionment to the given value.
35      * Checks that the new binding is compatible with any current binding.
36      * @param var a Node_RuleVariable defining the variable to bind
37      * @param value the value to bind
38      * @return false if the binding fails
39      */

40     public boolean bind(Node var, Node value);
41     
42     /**
43       * Instantiate a triple pattern against the current environment.
44       * This version handles unbound varibles by turning them into bNodes.
45       * @param pattern the triple pattern to match
46       * @return a new, instantiated triple
47       */

48      public Triple instantiate(TriplePattern pattern);
49          
50 }
51
52 /*
53     (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
54     All rights reserved.
55
56     Redistribution and use in source and binary forms, with or without
57     modification, are permitted provided that the following conditions
58     are met:
59
60     1. Redistributions of source code must retain the above copyright
61        notice, this list of conditions and the following disclaimer.
62
63     2. Redistributions in binary form must reproduce the above copyright
64        notice, this list of conditions and the following disclaimer in the
65        documentation and/or other materials provided with the distribution.
66
67     3. The name of the author may not be used to endorse or promote products
68        derived from this software without specific prior written permission.
69
70     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
71     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
72     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
73     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
74     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
75     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
76     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
77     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
78     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
79     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
80 */

81
Popular Tags