|
|||||||||
| Home >> All >> com >> hp >> hpl >> jena >> reasoner >> rulesys >> [ impl overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.hp.hpl.jena.reasoner.rulesys.impl
Class BindingVector

java.lang.Objectcom.hp.hpl.jena.reasoner.rulesys.impl.BindingVector
- All Implemented Interfaces:
- com.hp.hpl.jena.reasoner.rulesys.BindingEnvironment
- public class BindingVector
- extends java.lang.Object
- implements com.hp.hpl.jena.reasoner.rulesys.BindingEnvironment
- extends java.lang.Object
An implementation of a binding environment that maintains a single array of bound values for the variables in a rule. Stack management is done externally. This is intended for use in the Brule system and so also supports variable-variable bindings by use of reference chains.
- Version:
- $Revision: 1.21 $ on $Date: 2005/02/21 12:17:39 $
| Field Summary | |
protected com.hp.hpl.jena.graph.Node[] |
environment
The current binding set |
| Constructor Summary | |
BindingVector()
Constructor - create an empty binding environment |
|
BindingVector(BindingVector clone)
Constructor - create a binding environment which is a copy of the given environment |
|
BindingVector(com.hp.hpl.jena.graph.Node[] env)
Constructor - create a binding environment from a vector of bindings |
|
| Method Summary | |
boolean |
bind(int i,
com.hp.hpl.jena.graph.Node value)
Bind the ith variable in the current envionment to the given value. |
boolean |
bind(com.hp.hpl.jena.graph.Node var,
com.hp.hpl.jena.graph.Node value)
Bind a variable in the current envionment to the given value. |
boolean |
equals(java.lang.Object o)
Equality override |
com.hp.hpl.jena.graph.Node |
getBinding(com.hp.hpl.jena.graph.Node node)
If the node is a variable then return the current binding (null if not bound) otherwise return the node itself. |
com.hp.hpl.jena.graph.Node[] |
getEnvironment()
Return the current array of bindings. |
com.hp.hpl.jena.graph.Node |
getGroundVersion(com.hp.hpl.jena.graph.Node node)
Return the most ground version of the node. |
int |
hashCode()
hash function override |
com.hp.hpl.jena.graph.Triple |
instantiate(com.hp.hpl.jena.reasoner.TriplePattern pattern)
Instantiate a triple pattern against the current environment. |
com.hp.hpl.jena.reasoner.TriplePattern |
partInstantiate(com.hp.hpl.jena.reasoner.TriplePattern goal)
Bind the variables in a goal pattern using the binding environment, to generate a more specialized goal |
java.lang.String |
toString()
Printable form |
private static boolean |
unify(com.hp.hpl.jena.graph.Node gNode,
com.hp.hpl.jena.graph.Node hNode,
com.hp.hpl.jena.graph.Node[] gEnv,
com.hp.hpl.jena.graph.Node[] hEnv)
Unify a single pair of goal/head nodes. |
static BindingVector |
unify(com.hp.hpl.jena.reasoner.TriplePattern goal,
com.hp.hpl.jena.reasoner.TriplePattern head)
Unify a goal with the head of a rule. |
static BindingVector |
unify(com.hp.hpl.jena.reasoner.TriplePattern goal,
com.hp.hpl.jena.reasoner.TriplePattern head,
int numRuleVars)
Unify a goal with the head of a rule. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
environment
protected com.hp.hpl.jena.graph.Node[] environment
- The current binding set
| Constructor Detail |
BindingVector
public BindingVector()
- Constructor - create an empty binding environment
BindingVector
public BindingVector(com.hp.hpl.jena.graph.Node[] env)
- Constructor - create a binding environment from a vector of bindings
BindingVector
public BindingVector(BindingVector clone)
- Constructor - create a binding environment which is a copy
of the given environment
| Method Detail |
getEnvironment
public com.hp.hpl.jena.graph.Node[] getEnvironment()
- Return the current array of bindings. Useful for fast access to
serveral bindings, not useful for doing updates.
getBinding
public com.hp.hpl.jena.graph.Node getBinding(com.hp.hpl.jena.graph.Node node)
- If the node is a variable then return the current binding (null if not bound)
otherwise return the node itself.
getGroundVersion
public com.hp.hpl.jena.graph.Node getGroundVersion(com.hp.hpl.jena.graph.Node node)
- Return the most ground version of the node. If the node is not a variable
just return it, if it is a varible bound in this enviroment return the binding,
if it is an unbound variable return the variable.
- Specified by:
getGroundVersionin interfacecom.hp.hpl.jena.reasoner.rulesys.BindingEnvironment
bind
public boolean bind(int i,
com.hp.hpl.jena.graph.Node value)
- Bind the ith variable in the current envionment to the given value.
Checks that the new binding is compatible with any current binding.
Handles aliased variables.
bind
public boolean bind(com.hp.hpl.jena.graph.Node var, com.hp.hpl.jena.graph.Node value)
- Bind a variable in the current envionment to the given value.
Checks that the new binding is compatible with any current binding.
- Specified by:
bindin interfacecom.hp.hpl.jena.reasoner.rulesys.BindingEnvironment
partInstantiate
public com.hp.hpl.jena.reasoner.TriplePattern partInstantiate(com.hp.hpl.jena.reasoner.TriplePattern goal)
- Bind the variables in a goal pattern using the binding environment, to
generate a more specialized goal
instantiate
public com.hp.hpl.jena.graph.Triple instantiate(com.hp.hpl.jena.reasoner.TriplePattern pattern)
- Instantiate a triple pattern against the current environment.
This version handles unbound varibles by turning them into bNodes.
- Specified by:
instantiatein interfacecom.hp.hpl.jena.reasoner.rulesys.BindingEnvironment
toString
public java.lang.String toString()
- Printable form
unify
public static BindingVector unify(com.hp.hpl.jena.reasoner.TriplePattern goal, com.hp.hpl.jena.reasoner.TriplePattern head)
- Unify a goal with the head of a rule.
unify
public static BindingVector unify(com.hp.hpl.jena.reasoner.TriplePattern goal, com.hp.hpl.jena.reasoner.TriplePattern head, int numRuleVars)
- Unify a goal with the head of a rule. This is a poor-man's unification,
we should try swtiching to a more conventional global-variables-with-trail
implementation in the future.
unify
private static boolean unify(com.hp.hpl.jena.graph.Node gNode, com.hp.hpl.jena.graph.Node hNode, com.hp.hpl.jena.graph.Node[] gEnv, com.hp.hpl.jena.graph.Node[] hEnv)
- Unify a single pair of goal/head nodes. Unification of a head var to
a goal var is recorded using an Integer in the head env to point to a
goal env and storing the head var in the goal env slot.
equals
public boolean equals(java.lang.Object o)
- Equality override
hashCode
public int hashCode()
- hash function override
|
|||||||||
| Home >> All >> com >> hp >> hpl >> jena >> reasoner >> rulesys >> [ impl overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.hp.hpl.jena.reasoner.rulesys.impl.BindingVector