dlvhex  2.1.0
PluginAtom::Query Struct Reference

Query class which provides the input of an external atom call. More...

#include <include/dlvhex2/PluginInterface.h>

Collaboration diagram for PluginAtom::Query:

Public Member Functions

 Query (const ProgramCtx *ctx, InterpretationConstPtr interpretation, const Tuple &input, const Tuple &pattern, const ExternalAtom *ea=0, const InterpretationPtr predicateInputMask=InterpretationPtr())
 Construct query.
bool operator== (const Query &other) const
 Equality for hashing the query for caching query results.

Data Fields

const ProgramCtxctx
 Reference to the active program context.
InterpretationConstPtr interpretation
 Bitset of ground atoms representing current (partial) model.
InterpretationConstPtr extinterpretation
 Bitset of ground atoms representing current (partial) model.
Tuple input
 Input constant vector.
Tuple pattern
 Output term vector.
const ExternalAtomeatom
InterpretationPtr predicateInputMask

Detailed Description

Query class which provides the input of an external atom call.

The Query is passed to external computations as a const ref, therefore its data members are not encapsulated.

Query::input contains the ground terms of the input list.

Query::pattern tuple corresponds to the atom's output list: if it contains variables, the query will be a functional one for those missing values; if it is nullary or completely ground, the query will be a boolean one.

The answer shall contain exactly those tuples that match the pattern and are in the output of the atom's function for the interpretation and the input arguments.

Query objects are passed to PluginAtom::retrieve or PluginAtom::retrieveCached.

Definition at line 656 of file PluginInterface.h.


Constructor & Destructor Documentation

PluginAtom::Query::Query ( const ProgramCtx ctx,
InterpretationConstPtr  interpretation,
const Tuple input,
const Tuple pattern,
const ExternalAtom ea = 0,
const InterpretationPtr  predicateInputMask = InterpretationPtr() 
) [inline]

Construct query.

Definition at line 708 of file PluginInterface.h.


Member Function Documentation

DLVHEX_NAMESPACE_BEGIN bool PluginAtom::Query::operator== ( const Query other) const

Equality for hashing the query for caching query results.

Definition at line 70 of file PluginInterface.cpp.

References input, interpretation, and pattern.


Field Documentation

Bitset of ground atoms representing current (partial) model.

This model might be more complete than "interpretation", i.e., it might contain atoms which are not relevant for computing the result of the external atom. However, some learning techniques may make use of them since they give a hint which atoms might be relevant for the program.

Definition at line 680 of file PluginInterface.h.

Referenced by BaseModelGenerator::evaluateExternalAtom(), and ExternalLearningHelper::learnFromNegativeAtoms().

Output term vector.

The vector of output terms of the external atom. This vector might contain variables, if variables occur as output terms in the program. Several of these variables might even be the same, e.g., if the external atom is &extatom[a,b](X,c,X,d) the pattern is <X,c,X,d>.

Definition at line 701 of file PluginInterface.h.

Referenced by hash_value(), operator==(), ComfortPluginAtom::retrieve(), and PluginAtom::retrieveCached().


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