ADocumentation Index
Fetch the complete documentation index at: https://mintlify.com/HarvardPL/AbcDatalog/llms.txt
Use this file to discover all available pages before exploring further.
Clause is the fundamental unit of a Datalog program. It pairs a Head with a (possibly empty) list of Premise objects that form the body. The standard interpretation is that the head holds whenever every premise in the body holds. A clause with an empty body is a ground fact; a clause with one or more body premises is a rule.
DatalogParser.parseProgram returns a Set<Clause>, and this set is passed directly to DatalogEngine.init or DatalogValidator.validate.
Constructor
The head of the clause. In practice this is always a
PositiveAtom.The list of body premises. Pass
Collections.emptyList() to create a fact. The list is stored as-is and is accessible via getBody().Methods
getHead
The head of the clause. Cast to
PositiveAtom when you know the clause was produced by the parser or built with a PositiveAtom head.getBody
The list of body premises in declaration order. An empty list means the clause is a fact. Premises may be
PositiveAtom, NegatedAtom, BinaryUnifier, or BinaryDisunifier instances.Facts vs. rules
| Condition | Meaning |
|---|---|
clause.getBody().isEmpty() | The clause is a ground EDB fact. |
!clause.getBody().isEmpty() | The clause is a rule used to derive new facts. |
DatalogValidator uses this distinction to separate EDB initial facts from IDB rules when building an UnstratifiedProgram.
Code example: parsing and inspecting clauses
Building a clause programmatically
Programmatically constructed clauses are not validated until they are passed to
DatalogEngine.init or DatalogValidator.validate. Safety violations (unbound head variables) and unsupported premise types will be detected at that point.