29 [[nodiscard]]
const std::string&
predicate_name()
const {
return predicate_name_; }
30 [[nodiscard]]
const std::vector<Term>&
terms()
const {
return terms_; }
31 [[nodiscard]] std::size_t
arity()
const {
return terms_.size(); }
35 for (
const Term& term : terms_) {
36 if (!term.is_constant())
return false;
42 return predicate_name_ == other.predicate_name_ && terms_ == other.terms_;
44 [[nodiscard]]
bool operator!=(
const Atom& other)
const {
return !(*
this == other); }
47 std::string predicate_name_;
48 std::vector<Term> terms_;
56 h ^= (
TermHash{}(term) + 0x9e3779b9U + (h << 6) + (h >> 2));
An atom is a predicate name applied to a tuple of Terms, e.g. edge(a, b) or ancestor(X,...
Definition datalog_atom.hpp:24
const std::vector< Term > & terms() const
Definition datalog_atom.hpp:30
bool operator==(const Atom &other) const
Definition datalog_atom.hpp:41
std::size_t arity() const
Definition datalog_atom.hpp:31
const std::string & predicate_name() const
Definition datalog_atom.hpp:29
bool operator!=(const Atom &other) const
Definition datalog_atom.hpp:44
Atom(std::string predicate_name, std::vector< Term > terms)
Definition datalog_atom.hpp:26
bool is_ground() const
True iff every term in this atom is a constant (no variables).
Definition datalog_atom.hpp:34
A Datalog term: either a constant (e.g. a) or a variable (e.g. X) – never a compound/function-symbol ...
Definition datalog_term.hpp:38
Function-symbol-free Datalog term – a constant or a variable, never a compound term....
Definition datalog_atom.hpp:14
Hash functor for Atom, for use in std::unordered_map/std::unordered_set.
Definition datalog_atom.hpp:52
std::size_t operator()(const Atom &atom) const
Definition datalog_atom.hpp:53
Hash functor for Term, for use in std::unordered_map/std::unordered_set.
Definition datalog_term.hpp:71