public class BindingVector extends Object implements BindingEnvironment
Constructor and Description |
---|
BindingVector(BindingVector clone)
Constructor - create a binding environment which is a copy
of the given environment
|
BindingVector(int size)
Constructor - create an empty binding environment
|
BindingVector(Node[] env)
Constructor - create a binding environment from a vector of bindings
|
Modifier and Type | Method and Description |
---|---|
boolean |
bind(int i,
Node value)
Bind the ith variable in the current environment to the given value.
|
boolean |
bind(Node var,
Node value)
Bind a variable in the current environment to the given value.
|
boolean |
equals(Object o)
Equality override
|
Node |
getBinding(Node node)
If the node is a variable then return the current binding (null if not bound)
otherwise return the node itself.
|
Node[] |
getEnvironment()
Return the current array of bindings.
|
Node |
getGroundVersion(Node node)
Return the most ground version of the node.
|
int |
hashCode()
hash function override
|
Triple |
instantiate(TriplePattern pattern)
Instantiate a triple pattern against the current environment.
|
TriplePattern |
partInstantiate(TriplePattern goal)
Bind the variables in a goal pattern using the binding environment, to
generate a more specialized goal
|
String |
toString()
Printable form
|
static BindingVector |
unify(TriplePattern goal,
TriplePattern head,
int numRuleVars)
Unify a goal with the head of a rule.
|
public BindingVector(int size)
public BindingVector(Node[] env)
public BindingVector(BindingVector clone)
public Node[] getEnvironment()
public Node getBinding(Node node)
public Node getGroundVersion(Node node)
getGroundVersion
in interface BindingEnvironment
public boolean bind(int i, Node value)
public boolean bind(Node var, Node value)
bind
in interface BindingEnvironment
var
- a Node_RuleVariable defining the variable to bindvalue
- the value to bindpublic TriplePattern partInstantiate(TriplePattern goal)
goal
- the TriplePattern to be instantiatedpublic Triple instantiate(TriplePattern pattern)
instantiate
in interface BindingEnvironment
pattern
- the triple pattern to matchpublic static BindingVector unify(TriplePattern goal, TriplePattern head, int numRuleVars)
goal
- the goal pattern which it being matched to a rulehead
- the head pattern of the rule which is being instantiatednumRuleVars
- the length of the environment to allocate.Licenced under the Apache License, Version 2.0