java.lang.Object
org.apache.jena.reasoner.rulesys.impl.BindingVector
- All Implemented Interfaces:
- BindingEnvironment
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.
- 
Constructor SummaryConstructorsConstructorDescriptionBindingVector(int size) Constructor - create an empty binding environmentBindingVector(Node[] env) Constructor - create a binding environment from a vector of bindingsBindingVector(BindingVector clone) Constructor - create a binding environment which is a copy of the given environment
- 
Method SummaryModifier and TypeMethodDescriptionbooleanBind the ith variable in the current environment to the given value.booleanBind a variable in the current environment to the given value.booleanEquality overridegetBinding(Node node) If the node is a variable then return the current binding (null if not bound) otherwise return the node itself.Node[]Return the current array of bindings.getGroundVersion(Node node) Return the most ground version of the node.inthashCode()hash function overrideinstantiate(TriplePattern pattern) Instantiate a triple pattern against the current environment.partInstantiate(TriplePattern goal) Bind the variables in a goal pattern using the binding environment, to generate a more specialized goaltoString()Printable formstatic BindingVectorunify(TriplePattern goal, TriplePattern head, int numRuleVars) Unify a goal with the head of a rule.
- 
Constructor Details- 
BindingVectorpublic BindingVector(int size) Constructor - create an empty binding environment
- 
BindingVectorConstructor - create a binding environment from a vector of bindings
- 
BindingVectorConstructor - create a binding environment which is a copy of the given environment
 
- 
- 
Method Details- 
getEnvironmentReturn the current array of bindings. Useful for fast access to several bindings, not useful for doing updates.
- 
getBindingIf the node is a variable then return the current binding (null if not bound) otherwise return the node itself.
- 
getGroundVersionReturn the most ground version of the node. If the node is not a variable just return it, if it is a variable bound in this environment return the binding, if it is an unbound variable return the variable.- Specified by:
- getGroundVersionin interface- BindingEnvironment
 
- 
bindBind the ith variable in the current environment to the given value. Checks that the new binding is compatible with any current binding. Handles aliased variables.- Returns:
- false if the binding fails
 
- 
bindBind a variable in the current environment to the given value. Checks that the new binding is compatible with any current binding.- Specified by:
- bindin interface- BindingEnvironment
- Parameters:
- var- a Node_RuleVariable defining the variable to bind
- value- the value to bind
- Returns:
- false if the binding fails
 
- 
partInstantiateBind the variables in a goal pattern using the binding environment, to generate a more specialized goal- Parameters:
- goal- the TriplePattern to be instantiated
- Returns:
- a TriplePattern obtained from the goal by substituting current bindings
 
- 
instantiateInstantiate a triple pattern against the current environment. This version handles unbound variables by turning them into bNodes.- Specified by:
- instantiatein interface- BindingEnvironment
- Parameters:
- pattern- the triple pattern to match
- Returns:
- a new, instantiated triple
 
- 
toStringPrintable form
- 
unifyUnify a goal with the head of a rule. This is a poor-man's unification, we should try switching to a more conventional global-variables-with-trail implementation in the future.- Parameters:
- goal- the goal pattern which it being matched to a rule
- head- the head pattern of the rule which is being instantiated
- numRuleVars- the length of the environment to allocate.
- Returns:
- An initialized binding environment for the rule variables or null if the unification fails. If a variable in the environment becomes aliased to another variable through the unification this is represented by having its value in the environment be the variable to which it is aliased.
 
- 
equalsEquality override
- 
hashCodepublic int hashCode()hash function override
 
-