|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.deri.iris.utils.TermMatchingAndSubstitution
public class TermMatchingAndSubstitution
A collection of utility methods for term/tuple matching and variable substitution.
| Constructor Summary | |
|---|---|
TermMatchingAndSubstitution()
|
|
| Method Summary | |
|---|---|
static List<IVariable> |
getVariables(ITerm term,
boolean unique)
Extract variables from a term (could be constructed term). |
static List<IVariable> |
getVariables(ITuple subGoalTuple,
boolean unique)
Extract the variables in the same order that they are discovered during term matching. |
static boolean |
match(ITerm bodyTerm,
ITerm relationTerm,
Map<IVariable,ITerm> variableMap)
Indicates if bodyTerm (containing >= 0 variables) matches groundTerm and is also consistent with previous matched terms, i.e. |
static ITuple |
matchTuple(ITuple viewCriteria,
ITuple relation)
Match a tuple to view criteria. |
static ITuple |
matchTuple(ITuple viewCriteria,
ITuple relation,
IEquivalentTerms equivalentTerms)
Match a tuple to view criteria. |
static ITerm |
substituteVariablesInToTerm(ITerm term,
List<ITerm> variableValues,
int[] indices)
Substitute variable values in to a term to ground it using variable bindings as a list of terms with indices instead of a variable-term map. |
static ITerm |
substituteVariablesInToTerm(ITerm term,
Map<IVariable,ITerm> variableMap)
Substitute the variable bindings in to a term to ground it. |
static ITuple |
substituteVariablesInToTuple(ITuple tuple,
List<ITerm> variableValues,
int[] indices)
Substitute variable values in to a tuple to ground it using a list of terms with indices instead of a variable-term map. |
static ITuple |
substituteVariablesInToTuple(ITuple tuple,
Map<IVariable,ITerm> variableMap)
Substitute the variable bindings in to a tuple to ground it. |
static boolean |
subsums(IAtom atom1,
IAtom atom2)
|
static boolean |
subsums(ITuple tup1,
ITuple tup2)
Given two tuples, check if one tuple sub-sums the other one. |
static boolean |
unify(ITerm t1,
ITerm t2,
Map<IVariable,ITerm> variableMap)
Given two terms, unify to give variable bindings for all variables. |
static boolean |
unify(ITerm t1,
ITerm t2,
Map<IVariable,ITerm> variableMap,
boolean bothDirections)
Given two terms, unify to give variable bindings for all variables. |
static boolean |
unify(ITerm t1,
ITerm t2,
Map<IVariable,ITerm> variableMap,
boolean bothDirections,
IEquivalentTerms equivalentTerms)
Given two terms, unify to give variable bindings for all variables. |
static boolean |
unify(ITerm t1,
ITerm t2,
Map<IVariable,ITerm> variableMap,
IEquivalentTerms equivalentTerms)
Given two terms, unify to give variable bindings for all variables. |
static boolean |
unify(ITuple tup1,
ITuple tup2,
Map<IVariable,ITerm> variableMap)
Given two tuples, unify to give variable bindings for all variables. |
static boolean |
unify(ITuple tup1,
ITuple tup2,
Map<IVariable,ITerm> variableMap,
boolean bothDirections)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TermMatchingAndSubstitution()
| Method Detail |
|---|
public static List<IVariable> getVariables(ITuple subGoalTuple,
boolean unique)
subGoalTuple - The tuple as it appears in the sub-goalunique - true, if only unique variables are required
public static List<IVariable> getVariables(ITerm term,
boolean unique)
term - The term to extract the variables from.unique - If false, include each variable every time it appears.
public static ITuple matchTuple(ITuple viewCriteria,
ITuple relation)
viewCriteria - The tuple from a sub-goal instance.relation - The tuple from an EDB relation.
public static ITuple matchTuple(ITuple viewCriteria,
ITuple relation,
IEquivalentTerms equivalentTerms)
viewCriteria - The tuple from a sub-goal instance.relation - The tuple from an EDB relation.equivalentTerms - The equivalent terms.
public static boolean match(ITerm bodyTerm,
ITerm relationTerm,
Map<IVariable,ITerm> variableMap)
bodyTerm - The term from the sub-goal predicaterelationTerm - The term from the relation tuplevariableMap - The map of variable to ground term map
public static boolean subsums(ITuple tup1,
ITuple tup2)
tup1 - tuple onetup2 - tuple two
public static boolean subsums(IAtom atom1,
IAtom atom2)
public static boolean unify(ITuple tup1,
ITuple tup2,
Map<IVariable,ITerm> variableMap)
tup1 - tuple onetup2 - tuple twovariableMap - Map where variable bindings are saved
public static boolean unify(ITuple tup1,
ITuple tup2,
Map<IVariable,ITerm> variableMap,
boolean bothDirections)
bothDirections - Do the unification in both directions. Actually an additional flag used by the subsums() method.unify( ITuple tup1, ITuple tup2, Map variableMap)
public static boolean unify(ITerm t1,
ITerm t2,
Map<IVariable,ITerm> variableMap)
t1 - The first term.t2 - The second term.variableMap - The variable bindings.
public static boolean unify(ITerm t1,
ITerm t2,
Map<IVariable,ITerm> variableMap,
IEquivalentTerms equivalentTerms)
t1 - The first term.t2 - The second term.variableMap - The variable bindings.equivalentTerms - The equivalent terms.
public static boolean unify(ITerm t1,
ITerm t2,
Map<IVariable,ITerm> variableMap,
boolean bothDirections)
t1 - The first term.t2 - The second term.variableMap - The variable bindings.bothDirections - Do the unification in both directions. Actually an additional flag used by the subsums() method.
unify(ITerm t1, ITerm t2, Map variableMap)
public static boolean unify(ITerm t1,
ITerm t2,
Map<IVariable,ITerm> variableMap,
boolean bothDirections,
IEquivalentTerms equivalentTerms)
t1 - The first term.t2 - The second term.variableMap - The variable bindings.bothDirections - Do the unification in both directions. Actually an additional flag used by the subsums() method.equivalentTerms - The equivalent terms.
unify(ITerm t1, ITerm t2, Map variableMap)
public static ITuple substituteVariablesInToTuple(ITuple tuple,
Map<IVariable,ITerm> variableMap)
tuple - The tuple containing variables to ground.variableMap - The variable bindings to use.
public static ITerm substituteVariablesInToTerm(ITerm term,
Map<IVariable,ITerm> variableMap)
term - The term to ground.variableMap - The variable bindings to use.
public static ITuple substituteVariablesInToTuple(ITuple tuple,
List<ITerm> variableValues,
int[] indices)
tuple - The tuple containing variables to ground.variableValues - The variable values to be substituted.indices - The indices in to variableValues for each occurrence of a variable
in the tuple IN THE ORDER IN WHICH THEY ARE FOUND. An index value that is less than zero
indicates that there is no binding for this variable.
public static ITerm substituteVariablesInToTerm(ITerm term,
List<ITerm> variableValues,
int[] indices)
term - The term to ground.variableValues - A list of variable valuesindices - The indices in to variableValues for each occurrence of a variable
in the term IN THE ORDER IN WHICH THEY ARE FOUND. An index value that is less than zero
indicates that there is no binding for this variable.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||