dlvhex  2.5.0
OrdinaryAtom Struct Reference

Stores ordinary atoms of kind p(a1, ..., an). More...

#include <include/dlvhex2/Atoms.h>

Inheritance diagram for OrdinaryAtom:
Collaboration diagram for OrdinaryAtom:

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.

Detailed Description

Stores ordinary atoms of kind p(a1, ..., an).

Definition at line 95 of file Atoms.h.


Constructor & Destructor Documentation

OrdinaryAtom::OrdinaryAtom ( IDKind  kind) [inline]

Constructor.

Parameters:
kindSee Atom::kind.

Definition at line 145 of file Atoms.h.

OrdinaryAtom::OrdinaryAtom ( IDKind  kind,
const std::string &  text 
) [inline]

Constructor.

Parameters:
kindSee Atom::kind.
testSee OrdinaryAtom::text.

Definition at line 153 of file Atoms.h.

OrdinaryAtom::OrdinaryAtom ( IDKind  kind,
const std::string &  text,
const Tuple tuple 
) [inline]

Constructor.

Parameters:
kindSee Atom::kind.
testSee OrdinaryAtom::text.
tupleSee Atom::tuple.

Definition at line 162 of file Atoms.h.


Member Function Documentation

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).

Parameters:
regRegistry used to interpret atom arguments.
aAtom to compare to.
Returns:
True if there is a homomorphism from this atom to 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.

Parameters:
oStream to print.
Returns:
o.

Definition at line 172 of file Atoms.h.

References printvector().

Checks if the atom unifies with another one.

This variant of the method works only for atoms without function symbols.

Parameters:
aAtom to compare to.
Returns:
True if this atom unifies with 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.

Parameters:
aAtom to compare to.
regRegistry used to interpret atom arguments.
Returns:
True if this atom unifies with a and false otherwise.

Definition at line 132 of file Atoms.cpp.

References Term::arguments, DBGLOG, ID_FAIL(), RawPrinter::print(), Atom::tuple, and unifiesWith().


Field Documentation

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().


The documentation for this struct was generated from the following files: