Interface Substitution
- All Superinterfaces:
Comparable<Substitution>
- All Known Implementing Classes:
AbstractMapBasedSubstitution, AbstractSubstitution, EmptySubstitution, FreshVarSubstitution, HashMapSubstitution, TreeMapSubstitution, VariablePrefixSubstitution, VariableRemovePrefixSubstitution
A substitution is an application from a set of variables into a set of terms.
- Author:
- Clément Sipieter (INRIA) <clement@6pi.fr>
-
Method Summary
Modifier and TypeMethodDescription(const) This method construct a new Substitution which is the aggregation of this substitution with the specified one.booleanThe aggregation of a substitution is more complex that just add an new mapping for a new variable.voidAppends this object representation to the provided builder.voidInsert the application of this substitution on the src atom set into the target atom set.voidapply(InMemoryAtomSet src, InMemoryAtomSet target) Insert the application of this substitution on the src atom set into the target atom set.(CONST)
This method construct a new Substitution which is the composition of this substitution with the specified one.booleanFor example, if the current substitution is {Y -> Z} and you compose it with {X -> Y, V -> U}, the result is {X -> Z, Y -> Z, V -> U}.createImageOf(Atom atom) Apply this substitution on an atom.createImageOf(AtomSet src) Apply this substitution on an atom set.Apply this substitution on the given conjunctive query.Apply this substitution on an atom set.createImageOf(Rule rule) Apply this substitution on the given rule.createImageOf(Term term) Get the image of the given term by this substitution, if there is no image specified return the term itself.createImageOf(Collection<? extends Term> terms) Get the image of each terms of the specified list.getTerms()Get the domain of this substitution.Get the codomain of this substitution.booleanput(Substitution s) Add all mappings from an other substitution instance.booleanAdds a mapping from the specified variable into the specified image to this substitution.booleanRemove the mapping for the specified variable.Methods inherited from interface Comparable
compareTo
-
Method Details
-
getTerms
-
getValues
-
createImageOf
-
createImageOf
Get the image of each terms of the specified list.- Parameters:
terms- the terms to substitute- Returns:
- A list of images of each terms.
-
put
Adds a mapping from the specified variable into the specified image to this substitution. Returns false if there already exists an other image for this variable, true otherwise.- Parameters:
var- the variable to mapimage- the image of the variable- Returns:
- true if the mapping was accepted, false otherwise
-
put
Add all mappings from an other substitution instance. Returns false if there already exists an other image for a variable from the domain of s, true otherwise.- Parameters:
s- the substitution whose mappings should be inserted- Returns:
- false if there already exists an other image for a variable from the domain of s, true otherwise.
-
remove
Remove the mapping for the specified variable.- Parameters:
var- the variable whose mapping must be removed- Returns:
- true if there was a mapping.
-
aggregate
The aggregation of a substitution is more complex that just add an new mapping for a new variable. Especially, it does not conserve the domain and codomain. It choose a representative term for each connected component by successive application of the mapping. For example, if the current substitution is {X -> Y, Z -> U} and you add a mapping {Y -> 'a', Z -> V}, the result is {Y -> 'a', X -> 'a', Z -> V, U -> V} or {Y -> 'a', X -> 'a', U -> Z, V -> Z} or {Y -> 'a', X -> 'a', Z -> U, V -> U}.- Parameters:
var- the variable to aggregateimage- the image to aggregate with the variable- Returns:
- false, if the aggregation put two constants into a same connected component.
-
aggregate
(const) This method construct a new Substitution which is the aggregation of this substitution with the specified one.- Parameters:
s- the substitution to aggregate with this one- Returns:
- null, if the aggregation put two constants into a same connected component.
-
compose
For example, if the current substitution is {Y -> Z} and you compose it with {X -> Y, V -> U}, the result is {X -> Z, Y -> Z, V -> U}.- Parameters:
term- the variable to composesubstitut- the image to compose with- Returns:
- true if the composition succeeds, false otherwise
-
compose
(CONST)
This method construct a new Substitution which is the composition of this substitution with the specified one. For example, if the current substitution is {Y -> Z} and you compose it with {X -> Y, V -> U}, the result is {X -> Z, Y -> Z, V -> U}.- Parameters:
s- the substitution to compose with this one- Returns:
- the composed substitution
-
createImageOf
-
createImageOf
Apply this substitution on an atom set.- Parameters:
src- (const)- Returns:
- an InMemoryAtomSet which is the image of specified one by this substitution.
- Throws:
AtomSetException- if the image cannot be computed
-
createImageOf
Apply this substitution on an atom set.- Parameters:
src- (const)- Returns:
- an InMemoryAtomSet which is the image of specified one by this substitution.
-
createImageOf
-
createImageOf
Apply this substitution on the given conjunctive query.- Parameters:
cq- (const)- Returns:
- an conjunctive query which is the image of specified one by this substitution.
-
apply
Insert the application of this substitution on the src atom set into the target atom set.- Parameters:
src- (const)target- the atom set receiving the substituted atoms- Throws:
AtomSetException- if the substituted atoms cannot be inserted
-
apply
Insert the application of this substitution on the src atom set into the target atom set.- Parameters:
src- (const)target- the atom set receiving the substituted atoms
-
appendTo
Appends this object representation to the provided builder.- Parameters:
sb- the target builder
-