dlvhex  2.5.0
ExtSourceProperties Struct Reference

This struct is used to store sets of properties of an external atom. More...

#include <include/dlvhex2/ExtSourceProperties.h>

Collaboration diagram for ExtSourceProperties:

Public Member Functions

 ExtSourceProperties ()
 Constructor.
ExtSourcePropertiesoperator|= (const ExtSourceProperties &prop2)
 Adds properties from prop2 to this object.
void addMonotonicInputPredicate (int index)
 See ExtSourceProperties::isMonotonic.
void addAntimonotonicInputPredicate (int index)
 See ExtSourceProperties::isAntiMonotonic.
void addPredicateParameterNameIndependence (int index)
 See ExtSourceProperties::isIndependentOfPredicateParameterName.
void addFiniteOutputDomain (int index)
 See ExtSourceProperties::hasFiniteDomain.
void addRelativeFiniteOutputDomain (int index1, int index2)
 See ExtSourceProperties::hasRelativeFiniteDomain.
void setFunctional (bool value)
 See ExtSourceProperties::isFunction.
void setFunctionalStart (int value)
 See ExtSourceProperties::isFunction.
void setOnlySafeSupportSets (bool value)
 See ExtSourceProperties::onlySafeSupportSets.
void setSupportSets (bool value)
 See ExtSourceProperties::providesSupportSets.
void setCompletePositiveSupportSets (bool value)
 See ExtSourceProperties::providesCompletePositiveSupportSets.
void setCompleteNegativeSupportSets (bool value)
 See ExtSourceProperties::providesCompleteNegativeSupportSets.
void setVariableOutputArity (bool value)
 See ExtSourceProperties::hasVariableOutputArity.
void setCaresAboutAssigned (bool value)
 See ExtSourceProperties::doesCareAboutAssigned.
void setCaresAboutChanged (bool value)
 See ExtSourceProperties::doesCareAboutChanged.
void setAtomlevellinear (bool value)
 See ExtSourceProperties::isLinearOnAtomLevel.
void setTuplelevellinear (bool value)
 See ExtSourceProperties::isLinearOnTupleLevel.
void setUsesEnvironment (bool value)
 See ExtSourceProperties::doesItUseEnvironment.
void setFiniteFiber (bool value)
 See ExtSourceProperties::hasFiniteFiber.
void addWellorderingStrlen (int index1, int index2)
 See ExtSourceProperties::hasWellorderingStrlen.
void addWellorderingNatural (int index1, int index2)
 See ExtSourceProperties::hasWellorderingNatural.
void setProvidesPartialAnswer (bool value)
 See ExtSourceProperties::hasWellorderingNatural.
bool isMonotonic () const
 Checks if the external source is monotonic.
bool isAntimonotonic () const
 Checks if the external source is antimonotonic.
bool isNonmonotonic () const
 Checks if the external source is nonmonotonic.
bool isMonotonic (int parameterIndex) const
 Checks if the external source is monotonic in a given parameter.
bool isAntimonotonic (int parameterIndex) const
 Checks if the external source is antimonotonic in a given parameter.
bool isNonmonotonic (int parameterIndex) const
 Checks if the external source is nonmonotonic (i.e., neither monotonic nor antimonotonic) in a given parameter.
bool isFunctional () const
 Checks if the external source is functional.
bool isLinearOnAtomLevel () const
 Checks if the external source is linear on the atom level.
bool isLinearOnTupleLevel () const
 Checks if the external source is linear on the tuple level.
bool isIndependentOfPredicateParameterName (int parameterIndex) const
 Checks if the name of predicate parameter parameterIndex is relevant (otherwise only its extension is).
bool doesItUseEnvironment () const
 Checks if the external source uses the environment (see actionplugin).
bool hasFiniteDomain (int outputElement) const
 Checks if the external source has a finite domain for a certain output element.
bool hasRelativeFiniteDomain (int outputElement, int inputElement) const
 Checks if the external source has a finite domain for a certain output element relative to a given input.
bool hasFiniteFiber () const
 Checks if the external source has a finite fiber.
bool hasWellorderingStrlen (int from, int to) const
 Checks if the external source supports a wellordering concerning string length.
bool hasWellorderingNatural (int from, int to) const
 Checks if the external source supports a wellordering with respect to natural numbers.
bool providesOnlySafeSupportSets () const
 Checks if the external source provides only safe support sets.
bool providesSupportSets () const
 Checks if the external source provides support sets.
bool providesCompletePositiveSupportSets () const
 Checks if the external source provides complete complete positive support sets.
bool providesCompleteNegativeSupportSets () const
 Checks if the external source provides complete complete negative support sets.
bool hasVariableOutputArity () const
 Checks if the external source has a variable output arity.
bool doesCareAboutAssigned () const
 Checks if the external source is interested in the assigned atoms during evaluation.
bool doesCareAboutChanged () const
 Checks if the external source is interested in the atoms which possibly changed since the previous evaluation.
bool doesProvidePartialAnswer () const
 Checks if the external source provides a partial answer.
void interpretProperties (RegistryPtr reg, const ExternalAtom &atom, const std::vector< std::vector< std::string > > &props)
 Parses external source properties given as vectors of terms and integrates them into the current instance of the class.

Data Fields

ExternalAtomea
 Pointer to the external atom to which this property structure belongs to.
PluginAtompa
 Pointer to the plugin atom to which this property structure belongs to.
std::set< int > monotonicInputPredicates
 See ExtSourceProperties::isMonotonic.
std::set< int > antimonotonicInputPredicates
 See ExtSourceProperties::isAntiMonotonic.
std::set< int > predicateParameterNameIndependence
 See ExtSourceProperties::isIndependentOfPredicateParameterName.
std::set< int > finiteOutputDomain
 See ExtSourceProperties::hasFiniteDomain.
std::set< std::pair< int, int > > relativeFiniteOutputDomain
 See ExtSourceProperties::hasRelativeFiniteDomain.
bool functional
 See ExtSourceProperties::isFunctional.
int functionalStart
 See ExtSourceProperties::isFunctional.
bool supportSets
 See ExtSourceProperties::providesSupportSets.
bool onlySafeSupportSets
 All variables in non-ground support sets are bound by positive input atoms (i.e., atoms other than external replacement atoms).
bool completePositiveSupportSets
 See ExtSourceProperties::providesCompletePositiveSupportSets.
bool completeNegativeSupportSets
 See ExtSourceProperties::providesCompleteNegativeSupportSets.
bool variableOutputArity
 See ExtSourceProperties::hasVariableOutputArity.
bool caresAboutAssigned
 See ExtSourceProperties::doesCareAboutAssigned.
bool caresAboutChanged
 See ExtSourceProperties::doesCareAboutChanged.
bool atomlevellinear
 See ExtSourceProperties::isLinearOnAtomLevel.
bool tuplelevellinear
 See ExtSourceProperties::isLinearOnTupleLevel.
bool usesEnvironment
 See ExtSourceProperties::doesItUseEnvironment.
bool finiteFiber
 See ExtSourceProperties::hasFiniteFiber.
std::set< std::pair< int, int > > wellorderingStrlen
 See ExtSourceProperties::hasWellorderingStrlen.
std::set< std::pair< int, int > > wellorderingNatural
 See ExtSourceProperties::hasWellorderingNatural.
bool providesPartialAnswer
 See ExtSourceProperties::providesPartialAnswer.

Detailed Description

This struct is used to store sets of properties of an external atom.

Stores properties of an external source on one of two levels: 1. on the level of plugin atoms 2. on the level of individual external atoms

E.g. in &foo[n,m](X,Y)<monotonic n, antimonotonic m> we need to store two properties

  • one for "monotonic n"
  • one for "antimonotonic m"

Currently the following properties are supported:

  • MONOTONIC
  • ANTIMONOTONIC
  • FUNCTIONAL
  • ATOMLEVELLINEAR
  • TUPLELEVELLINEAR
  • USES_ENVIRONMENT
  • RELATIVEFINITEDOMAIN
  • FINITEDOMAIN
  • FINITEFIBER
  • WELLORDERINGSTRLEN
  • WELLORDERINGNATURAL
  • SUPPORTSETS
  • COMPLETEPOSITIVESUPPORTSETS
  • COMPLETENEGATIVESUPPORTSETS
  • VARIABLEOUTPUTARITY
  • CARESABOUTASSIGNED
  • CARESABOUTCHANGED

Definition at line 82 of file ExtSourceProperties.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 139 of file ExtSourceProperties.h.


Member Function Documentation

See ExtSourceProperties::isAntiMonotonic.

Definition at line 166 of file ExtSourceProperties.h.

void ExtSourceProperties::addRelativeFiniteOutputDomain ( int  index1,
int  index2 
) [inline]
void ExtSourceProperties::addWellorderingNatural ( int  index1,
int  index2 
) [inline]
void ExtSourceProperties::addWellorderingStrlen ( int  index1,
int  index2 
) [inline]

Checks if the external source is interested in the assigned atoms during evaluation.

If the external does not specify this property, then the method PluginAtom::retrieve might not receive the set of assignment atoms. This property is used for optimizing reasoning by excluding irrelevant data structures from updates.

Returns:
True if the external source wants to be informed about assigned atoms.

Definition at line 387 of file ExtSourceProperties.h.

Checks if the external source is interested in the atoms which possibly changed since the previous evaluation.

If the external does not specify this property, then the method PluginAtom::retrieve might not receive the set of changed atoms. This property is used for optimizing reasoning by excluding irrelevant data structures from updates.

Returns:
True if the external source wants to be informed about changed atoms.

Definition at line 398 of file ExtSourceProperties.h.

Referenced by GenuineGuessAndCheckModelGenerator::initializeHeuristics(), and GenuineGuessAndCheckModelGenerator::verifyExternalAtoms().

Checks if the external source uses the environment (see actionplugin).

Returns:
true If this Atom uses Environment.

Definition at line 294 of file ExtSourceProperties.h.

Checks if the external source provides a partial answer.

If the external atom provides a partial answer, it is expected to specify both true and unknown atoms wrt. partial input, whereas an external atom which does not provide partial answer should assume unassigned input atoms to be false (see PluginInterface).

Returns:
True if the external source provides partial answers.

Definition at line 408 of file ExtSourceProperties.h.

Referenced by ExternalLearningHelper::DefaultInputNogoodProvider::operator()().

bool ExtSourceProperties::hasFiniteDomain ( int  outputElement) const [inline]

Checks if the external source has a finite domain for a certain output element.

Parameters:
outputElement0-based index of an element of the output tuple.
Returns:
bool True if the specified output element has a finite domain

Definition at line 302 of file ExtSourceProperties.h.

Referenced by DLVHEX_NAMESPACE_BEGIN::FinitenessChecker::run().

bool ExtSourceProperties::hasFiniteFiber ( ) const [inline]

Checks if the external source has a finite fiber.

Finite fiber means that for a given output tuple there are only finitely many inputs which produce this output.

Returns:
True if the external atom has a finite fiber.

Definition at line 319 of file ExtSourceProperties.h.

Referenced by LiberalSafetyChecker::addBoundedVariable(), and DLVHEX_NAMESPACE_BEGIN::FiniteFiberChecker::run().

bool ExtSourceProperties::hasRelativeFiniteDomain ( int  outputElement,
int  inputElement 
) const [inline]

Checks if the external source has a finite domain for a certain output element relative to a given input.

Parameters:
outputElement0-based index of an element of the output tuple.
Returns:
bool True if the specified output element has a finite domain with respect to the given input vector and interpretation.

Definition at line 310 of file ExtSourceProperties.h.

Checks if the external source has a variable output arity.

Returns:
True if the external source has a variable output arity.

Definition at line 376 of file ExtSourceProperties.h.

Referenced by PluginAtom::checkOutputArity().

bool ExtSourceProperties::hasWellorderingNatural ( int  from,
int  to 
) const [inline]

Checks if the external source supports a wellordering with respect to natural numbers.

Such a wellordering is supported, whenever the output of the external source is numerically no greater than its input.

Parameters:
fromIndex of an input element.
fromIndex of an output element.
Returns:
True if the external atom has a well ordering concerning natural numbers between from and to, that is, output element to is no greater than input element from.

Definition at line 341 of file ExtSourceProperties.h.

Referenced by DLVHEX_NAMESPACE_BEGIN::BenignCycleChecker::identifyBenignCycles().

bool ExtSourceProperties::hasWellorderingStrlen ( int  from,
int  to 
) const [inline]

Checks if the external source supports a wellordering concerning string length.

Such a wellordering is supported, whenever the output of the external source is no longer than its input concerning string length.

Parameters:
fromIndex of an input element.
fromIndex of an output element.
Returns:
True if the external atom has a strlen well ordering between from and to, that is, output element to is no greater than input element from.

Definition at line 330 of file ExtSourceProperties.h.

Referenced by DLVHEX_NAMESPACE_BEGIN::BenignCycleChecker::identifyBenignCycles().

void ExtSourceProperties::interpretProperties ( RegistryPtr  reg,
const ExternalAtom atom,
const std::vector< std::vector< std::string > > &  props 
)

Parses external source properties given as vectors of terms and integrates them into the current instance of the class.

This allows for specifying external atom properties directly in the HEX-program using the syntax <prop1,...,propn>, where all propi are lists of (space-delimited) strings whose inner structures depend on the properties to be specified as defined in this method.

Parameters:
regRegistry used to interpret IDs.
atomExternal atom whose properties shall be parsed.
propsSet of property specifications, where each property is again specified as a set of strings.

Definition at line 116 of file ExtSourceProperties.cpp.

References ID::address, antimonotonicInputPredicates, atomlevellinear, caresAboutAssigned, caresAboutChanged, completeNegativeSupportSets, completePositiveSupportSets, DBGLOG, finiteFiber, finiteOutputDomain, functional, ID_FAIL(), ExternalAtom::inputs, ID::isIntegerTerm(), monotonicInputPredicates, onlySafeSupportSets, providesPartialAnswer, relativeFiniteOutputDomain, supportSets, ID::termFromInteger(), Atom::tuple, tuplelevellinear, usesEnvironment, variableOutputArity, wellorderingNatural, and wellorderingStrlen.

Referenced by sem< HexGrammarSemantics::externalAtom >::operator()(), and sem< FunctionParserModuleAtomSemantics::functionTermEval >::operator()().

bool ExtSourceProperties::isAntimonotonic ( int  parameterIndex) const [inline]

Checks if the external source is antimonotonic in a given parameter.

Parameters:
parameterIndex0-based index.
Returns:
Antimonotonicity on parameter level.

Definition at line 237 of file ExtSourceProperties.h.

bool ExtSourceProperties::isFunctional ( ) const [inline]

Checks if the external source is functional.

If an external source is functional, then there must not exist multiple output tuples simultanously; "functionalStart" defines the number of non-functional output terms before the functional output starts. That is: Suppose a source has a ternery output, such that the third element is unique for each pair of elements in the first and second position; Then functionalStart=2 and the source may generate e.g. (a,b,c), (b,b,d), (b,a,d) but not (a,b,c), (a,b,d).

Returns:
True if the source is functional.

Definition at line 257 of file ExtSourceProperties.h.

Referenced by PluginAtom::retrieveFacade().

bool ExtSourceProperties::isIndependentOfPredicateParameterName ( int  parameterIndex) const [inline]

Checks if the name of predicate parameter parameterIndex is relevant (otherwise only its extension is).

Parameters:
parameterIndexIndex of an input parameter.
Returns:
bool True if the name of the predicate parameter with the given index is irrelevant

Definition at line 287 of file ExtSourceProperties.h.

Referenced by PluginAtom::generalizeNogood().

Checks if the external source is linear on the atom level.

Linearity on atom level means that for input atoms a1, ..., an queries can be split such that for each atom a1, ..., an forms an independent sub-query and the union of the results to these sub-queries correspond to the result to the overall query.

Returns:
Linearity on atom level.

Definition at line 268 of file ExtSourceProperties.h.

Referenced by PluginAtom::splitQuery().

Checks if the external source is linear on the tuple level.

Linearity on tuple level means that for input predicates p1, ..., pn, queries can be split such that for each tuple of terms t, p1(t), ..., pn(t) forms an independent sub-query and the union of the results to these sub-queries correspond to the result to the overall query.

Returns:
Linearity on tuple level.

Definition at line 279 of file ExtSourceProperties.h.

Referenced by PluginAtom::splitQuery().

bool ExtSourceProperties::isMonotonic ( int  parameterIndex) const [inline]

Checks if the external source is monotonic in a given parameter.

Parameters:
parameterIndex0-based index.
Returns:
Monotonicity on parameter level.

Definition at line 229 of file ExtSourceProperties.h.

Checks if the external source is nonmonotonic.

Returns:
Overall nonmonotonicity.
overall nonmonotonicity

Definition at line 111 of file ExtSourceProperties.cpp.

References isMonotonic().

Referenced by ComponentGraph::calculateStratificationInfo(), ComponentGraph::computeCollapsedComponentInfos(), and DependencyGraph::createExternalPredicateInputDependencies().

bool ExtSourceProperties::isNonmonotonic ( int  parameterIndex) const [inline]

Checks if the external source is nonmonotonic (i.e., neither monotonic nor antimonotonic) in a given parameter.

Parameters:
parameterIndex0-based index.
Returns:
Nonmonotonicity on parameter level.

Definition at line 245 of file ExtSourceProperties.h.

Checks if the external source provides complete complete negative support sets.

Returns:
True if the external source provides complete positive negativesets.

Definition at line 369 of file ExtSourceProperties.h.

Referenced by UnfoundedSetChecker::isUnfoundedSet(), and GenuineGuessAndCheckModelGenerator::verifyExternalAtom().

Checks if the external source provides complete complete positive support sets.

Returns:
True if the external source provides complete positive support sets.

Definition at line 362 of file ExtSourceProperties.h.

Referenced by UnfoundedSetChecker::isUnfoundedSet(), GenuineGuessAndCheckModelGenerator::verifyExternalAtom(), and AnnotatedGroundProgram::verifyExternalAtomsUsingCompleteSupportSets().

Checks if the external source provides only safe support sets.

Returns:
True if the external source provides only safe support sets (complete or incomplete).

Definition at line 348 of file ExtSourceProperties.h.

Referenced by GenuineGuessAndCheckModelGenerator::inlineExternalAtoms().

Checks if the external source provides support sets.

Returns:
True if the external source provides support sets (complete or incomplete).

Definition at line 355 of file ExtSourceProperties.h.

Referenced by GenuineGuessAndCheckModelGenerator::inlineExternalAtoms(), GenuineGuessAndCheckModelGenerator::learnSupportSets(), PluginAtom::learnSupportSets(), and BaseModelGenerator::learnSupportSetsForExternalAtom().

void ExtSourceProperties::setFiniteFiber ( bool  value) [inline]
void ExtSourceProperties::setFunctional ( bool  value) [inline]

See ExtSourceProperties::isFunction.

Definition at line 174 of file ExtSourceProperties.h.

void ExtSourceProperties::setFunctionalStart ( int  value) [inline]

See ExtSourceProperties::isFunction.

Definition at line 176 of file ExtSourceProperties.h.

void ExtSourceProperties::setSupportSets ( bool  value) [inline]

Field Documentation

Pointer to the external atom to which this property structure belongs to.

Definition at line 86 of file ExtSourceProperties.h.

Referenced by ExternalAtom::ExternalAtom(), isAntimonotonic(), isMonotonic(), and ExternalAtom::operator=().

All variables in non-ground support sets are bound by positive input atoms (i.e., atoms other than external replacement atoms).

Definition at line 108 of file ExtSourceProperties.h.

Referenced by interpretProperties(), operator|=(), and TestASPQueryAtom::TestASPQueryAtom().

Pointer to the plugin atom to which this property structure belongs to.

Definition at line 88 of file ExtSourceProperties.h.

Referenced by isAntimonotonic(), and isMonotonic().


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