AbstractClauseVisitor

Base ClauseVisitor that implements the head/body and negated/non-negated dispatching itself, so subclasses only need to fold per-literal results together (via reduce) and, typically, override the leaf-level visitX methods inherited from ExhaustiveTermVisitor to inspect the literals' arguments.

visitClause walks a Clause's head (if any) and every body item — each normalised to a literal via it.unibo.tuprolog.datalog.asLiteral — dispatching negated body literals (see isNegated) to ClauseVisitor.visitNegatedLiteral with the literal inside the not(...)/\+(...) wrapper, and everything else to ClauseVisitor.visitNonNegatedLiteral/ClauseVisitor.visitHead; visitLiteral then recurses into each of that literal's arguments and folds the per-argument results with reduce. CompoundFinder and HeadVariablesOutsideNonNegatedLiterals are the two concrete visitors built on top of this class.

Inheritors

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
abstract fun defaultValue(term: Term): T
Link copied to clipboard
open override fun visitAtom(term: Atom): T
Link copied to clipboard
open fun visitBlock(term: Block): T
Link copied to clipboard
open override fun visitClause(term: Clause): T
Link copied to clipboard
open fun visitCollection(term: Recursive): T
Link copied to clipboard
open fun visitCons(term: Cons): T
Link copied to clipboard
open fun visitConstant(term: Constant): T
Link copied to clipboard
open fun visitDirective(term: Directive): T
Link copied to clipboard
open fun visitEmpty(term: Empty): T
Link copied to clipboard
open override fun visitEmptyBlock(term: EmptyBlock): T
Link copied to clipboard
open override fun visitEmptyList(term: EmptyList): T
Link copied to clipboard
open fun visitFact(term: Fact): T
Link copied to clipboard
open fun visitHead(head: Struct): T

Visits the head of a Clause (a no-op wrapper around visitLiteral by default).

Link copied to clipboard
open fun visitIndicator(term: Indicator): T
Link copied to clipboard
open fun visitInteger(term: Integer): T
Link copied to clipboard
open fun visitList(term: List): T
Link copied to clipboard
open override fun visitLiteral(literal: Struct): T

Visits any literal (head or body) of a Clause, regardless of whether it is negated.

Link copied to clipboard
open fun visitNegatedLiteral(literal: Struct): T

Visits a body literal known to be negated, receiving the literal inside the not(...)/\+(...) wrapper (not the wrapper itself). Falls back to visitLiteral.

Link copied to clipboard
open fun visitNonNegatedLiteral(literal: Struct): T

Visits a body literal known not to be negated. Falls back to visitLiteral.

Link copied to clipboard
open fun visitNumeric(term: Numeric): T
Link copied to clipboard
open fun visitReal(term: Real): T
Link copied to clipboard
open fun visitRule(term: Rule): T
Link copied to clipboard
open fun visitStruct(term: Struct): T
Link copied to clipboard
open fun visitTerm(term: Term): T
Link copied to clipboard
open fun visitTruth(term: Truth): T
Link copied to clipboard
open fun visitTuple(term: Tuple): T
Link copied to clipboard
open fun visitVar(term: Var): T