Class Atom
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> T
accept
(LogicSchemaVisitor<T> visitor) applySubstitution
(Substitution substitution) getTerms()
boolean
isBase()
boolean
boolean
isGround()
boolean
toString()
unfold()
Unfolding an atom returns a list of literals' list, one for each derivation rule of (the predicate of) this atom.protected ImmutableLiteralsList
unfold
(int derivationRuleIndex)
-
Constructor Details
-
Atom
-
-
Method Details
-
getPredicate
-
getTerms
-
unfold
Unfolding an atom returns a list of literals' list, one for each derivation rule of (the predicate of) this atom. In particular, for each derivation rule, it returns a literals' list replacing the variables of the derivation rule's head for the terms appearing in this atom.
For instance, if we have the atom "P(1)", with derivation rules "P(x) :- R(x), S(x)" and "P(y) :- T(y), U(y)", unfolding "P(1)" will return two literals' list: "R(1), S(1)" and "T(1), U(1)".
This unfolding avoids clashing the variables inside the derivation rule's body with the variables appearing in this atom. For instance, if we have the ordinary literal "P(a, b)" with a derivation rule "P(x, y) :- R(x, y, a, b)" it will return "R(a, b, a', b')"
If the the derivation rules of such atom contains constants, or repeated variables in the head, they are treated as new built-in literals. E.g. if we have the rule "R(a, 1) :- S(a)", and we unfold "R(x, y)", we obtain "R(x, y), y = 1"; similarly, if we have the rule "R(a,a) :- S(a)", and we unfold "R(x,y)" we obtain "R(x,y), x=y"
- Returns:
- a list of ImmutableLiteralsList representing the result of unfolding this atom
-
unfold
-
getPredicateName
-
isDerived
public boolean isDerived() -
isBase
public boolean isBase() -
applySubstitution
- Parameters:
substitution
- not null- Returns:
- an atom after applying the given substitution. The atom will be new if some term has changed. Otherwise, it will be the same
-
toString
-
accept
-
isGround
public boolean isGround()- Returns:
- true if all the terms of this atom are constants, false otherwise
-
getVariables
-
isRecursive
public boolean isRecursive()- Returns:
- whether the Predicate of this atom is recursive, or not
-