dlvhex
2.5.0
|
Stores ordinary atoms of kind p(a1, ..., an). More...
#include <include/dlvhex2/Atoms.h>
Public Member Functions | |
bool | unifiesWith (const OrdinaryAtom &a) const |
Checks if the atom unifies with another one. | |
bool | unifiesWith (const OrdinaryAtom &a, RegistryPtr reg) const |
Checks if the atom unifies with another one. | |
bool | existsHomomorphism (RegistryPtr reg, const OrdinaryAtom &a) const |
Checks if there is a homomorphism which maps this atom to another one. | |
OrdinaryAtom (IDKind kind) | |
Constructor. | |
OrdinaryAtom (IDKind kind, const std::string &text) | |
Constructor. | |
OrdinaryAtom (IDKind kind, const std::string &text, const Tuple &tuple) | |
Constructor. | |
std::ostream & | print (std::ostream &o) const |
Prints the atom in a human readable format. | |
Data Fields | |
std::string | text |
The textual representation of the whole thing this is stored for efficient parsing and printing. |
OrdinaryAtom::OrdinaryAtom | ( | IDKind | kind | ) | [inline] |
OrdinaryAtom::OrdinaryAtom | ( | IDKind | kind, |
const std::string & | text | ||
) | [inline] |
Constructor.
kind | See Atom::kind. |
test | See OrdinaryAtom::text. |
OrdinaryAtom::OrdinaryAtom | ( | IDKind | kind, |
const std::string & | text, | ||
const Tuple & | tuple | ||
) | [inline] |
Constructor.
kind | See Atom::kind. |
test | See OrdinaryAtom::text. |
tuple | See Atom::tuple. |
bool OrdinaryAtom::existsHomomorphism | ( | RegistryPtr | reg, |
const OrdinaryAtom & | a | ||
) | const |
Checks if there is a homomorphism which maps this atom to another one.
While unification allows only for replacing variables (consistently) in order to make atoms equal, a homomorphism might also substitute null values (auxiliaries of type '0', see Registry).
a
and false otherwise. Definition at line 323 of file Atoms.cpp.
References DBGLOG, DBGLOG_SCOPE, printvector(), and Atom::tuple.
std::ostream& OrdinaryAtom::print | ( | std::ostream & | o | ) | const [inline] |
Prints the atom in a human readable format.
o | Stream to print. |
o
. Definition at line 172 of file Atoms.h.
References printvector().
DLVHEX_NAMESPACE_BEGIN bool OrdinaryAtom::unifiesWith | ( | const OrdinaryAtom & | a | ) | const |
Checks if the atom unifies with another one.
This variant of the method works only for atoms without function symbols.
a | Atom to compare to. |
a
and false otherwise. Definition at line 54 of file Atoms.cpp.
References DBGLOG, DBGLOG_SCOPE, printvector(), and Atom::tuple.
Referenced by ComponentGraph::calculateFixedDomain(), ComponentGraph::calculateStratificationInfo(), AnnotatedGroundProgram::computeAdditionalDependencies(), Nogood::match(), InternalGrounder::matchOrdinary(), StrongSafetyChecker::operator()(), GenPluginAtom1::retrieve(), unifiesWith(), ImmediateNogoodGrounder::update(), and LazyNogoodGrounder::update().
bool OrdinaryAtom::unifiesWith | ( | const OrdinaryAtom & | a, |
RegistryPtr | reg | ||
) | const |
Checks if the atom unifies with another one.
This variant of the method works also recursively for atoms with function symbols.
a
and false otherwise. Definition at line 132 of file Atoms.cpp.
References Term::arguments, DBGLOG, ID_FAIL(), RawPrinter::print(), Atom::tuple, and unifiesWith().
std::string OrdinaryAtom::text |
The textual representation of the whole thing this is stored for efficient parsing and printing.
Note: We could make 'text' part of a template parameter of OrdinaryAtom, such that different backends can store different "efficient" representations here (e.g., we could store clasp- or dlv-library internal atom representations here and index them). If we don't need it, we can replace it by an empty struct and conserve space.
Also note: If we only need this for printing, we should generate it on-demand and save a lot of effort if not everything is printed.
Definition at line 111 of file Atoms.h.
Referenced by ExternalAtomMask::addOutputAtoms(), DependencyGraph::createAuxiliaryRuleHead(), handle_fact::operator()(), RawPrinter::print(), Registry::printAtomForUser(), RawPrinter::printWithoutPrefix(), and ExternalAtomMask::updateMask().