Inter4ql  5.2
Public Member Functions | Protected Attributes | List of all members
Inter4ql::ModuleLocal Class Reference

Implementation of ModuleGeneric for modules with reasoning. More...

#include <ModuleLocal.h>

Inheritance diagram for Inter4ql::ModuleLocal:
Inter4ql::ModuleGeneric Inter4ql::ModuleSum

Public Member Functions

 ModuleLocal (std::string a_name, Constraints *_constraints, std::vector< Domain *> *_domains, std::vector< Relation *> *_relations, std::vector< Rule *> *_rules, std::vector< Fact *> *_facts)
 constructor More...
 
 ~ModuleLocal ()
 destructor More...
 
logic_type::type ask_for_ground_fact (Fact *instance) const
 
Relationget_relation (std::string s) const
 getter for a relation More...
 
virtual std::vector< Domain * > * get_domains () const override
 getter for domains More...
 
std::vector< Relation * > * get_relations () const
 getter for module relations More...
 
std::vector< Rule * > * get_rules () const
 
std::vector< Fact * > * get_facts () const
 
std::string get_name () const
 getter for a name of module More...
 
std::string print ()
 function that returns string with module information More...
 
module_type::type get_module_type () const
 getter for module type More...
 
void generate_facts ()
 
void reason ()
 performs reasoning More...
 
void reason_with_rules (std::vector< Rule *> *rules)
 performs reasing with additional Rules added More...
 
Result ask_for_result (Fact *term) const
 provides valuations matching given Fact More...
 
variable_type::type get_domain_type (std::string name)
 method gives type of a domain inside module More...
 
void add_domain (Domain *d)
 method adds Domain into Domain vector More...
 
void add_relation (Relation *r)
 method adds Relation into Relation vector More...
 
void add_fact (Fact *r)
 method adds Fact into Fact vector More...
 
void add_rule (Rule *r)
 method adds Rule into Rule vector More...
 
Constraintsget_constraints () const override
 getter for constraints More...
 
virtual database * get_wsm_database ()
 fetches a database of facts from well-supported model (for summing purposes) More...
 
bool check_constraints_local (bool check_rigid, bool check_flexible) const override
 allows for disabling constraints check More...
 
void set_disable_constraints (bool value) const override
 allows for disabling constraints check More...
 
bool constraints_violated () override
 checks whether constraints are violated More...
 
- Public Member Functions inherited from Inter4ql::ModuleGeneric
 ModuleGeneric ()
 default constructor
 
virtual ~ModuleGeneric ()
 default destructor
 
virtual Result evaluate_expression (Expression *expr) const
 provides valuations matching given Expression More...
 
virtual Result evaluate_expression_bf (Expression *expr) const
 provides bel-free valuations matching given Expression More...
 
virtual std::vector< std::string > get_references (Fact *term)
 provides a list of Module references is term (useful when e.g. term is a shadowed Bel) More...
 
virtual void set_modules (std::vector< ModuleGeneric *> *_modules)
 setter for modules needed in this module More...
 
virtual bool contains_domain (Domain *d) const
 check if module contains domain More...
 
virtual bool contains_relation (Relation *d) const
 check if module contains relation (ignoring module name) More...
 
virtual database * get_add_database ()
 fetches a database of facts which were added by actions to this module More...
 
virtual database * get_remove_database ()
 fetches a database of facts which were removed by actions from this module More...
 
virtual void set_add_database (database *db)
 overrides a database of facts which were added by actions to this module More...
 
virtual void set_remove_database (database *db)
 overrides a database of facts which were removed by actions from this module More...
 

Protected Attributes

Inter4ql::database database_
 
- Protected Attributes inherited from Inter4ql::ModuleGeneric
Inter4ql::database * database_to_add
 
Inter4ql::database * database_to_remove
 

Detailed Description

Implementation of ModuleGeneric for modules with reasoning.

Constructor & Destructor Documentation

◆ ModuleLocal()

Inter4ql::ModuleLocal::ModuleLocal ( std::string  a_name,
Constraints _constraints,
std::vector< Domain *> *  _domains,
std::vector< Relation *> *  _relations,
std::vector< Rule *> *  _rules,
std::vector< Fact *> *  _facts 
)

constructor

Parameters
a_namename of a module
_constraintsmodule constraints
_domainsinitial vector of domains
_relationsinitial vector of relations
_rulesinitial vector of rules
_factsinitial vector of facts

◆ ~ModuleLocal()

Inter4ql::ModuleLocal::~ModuleLocal ( )

destructor

Member Function Documentation

◆ add_domain()

void Inter4ql::ModuleLocal::add_domain ( Domain d)

method adds Domain into Domain vector

Parameters
dpointer to a Domain instance

◆ add_fact()

void Inter4ql::ModuleLocal::add_fact ( Fact r)

method adds Fact into Fact vector

Parameters
rpointer to a Fact instance

◆ add_relation()

void Inter4ql::ModuleLocal::add_relation ( Relation r)

method adds Relation into Relation vector

Parameters
rpointer to a Relation instance

◆ add_rule()

void Inter4ql::ModuleLocal::add_rule ( Rule r)

method adds Rule into Rule vector

Parameters
rpointer to a Rule instance

◆ ask_for_result()

Result Inter4ql::ModuleLocal::ask_for_result ( Fact term) const
virtual

provides valuations matching given Fact

Parameters
termquery to find in database
Returns
possible valuations of term

Implements Inter4ql::ModuleGeneric.

◆ check_constraints_local()

bool Inter4ql::ModuleLocal::check_constraints_local ( bool  check_rigid,
bool  check_flexible 
) const
overridevirtual

allows for disabling constraints check

Parameters
valuevalue to be set

Reimplemented from Inter4ql::ModuleGeneric.

◆ constraints_violated()

bool Inter4ql::ModuleLocal::constraints_violated ( )
overridevirtual

checks whether constraints are violated

Returns
true if constraints are vioilated, false otherwise

Reimplemented from Inter4ql::ModuleGeneric.

◆ get_constraints()

Constraints* Inter4ql::ModuleLocal::get_constraints ( ) const
inlineoverridevirtual

getter for constraints

Returns
list of constraints

Reimplemented from Inter4ql::ModuleGeneric.

◆ get_domain_type()

variable_type::type Inter4ql::ModuleLocal::get_domain_type ( std::string  name)

method gives type of a domain inside module

Parameters
namename of a domain
Returns
domain type

◆ get_domains()

std::vector< Domain * > * Inter4ql::ModuleLocal::get_domains ( ) const
overridevirtual

getter for domains

Returns
list of domains

Reimplemented from Inter4ql::ModuleGeneric.

◆ get_module_type()

module_type::type Inter4ql::ModuleLocal::get_module_type ( ) const
virtual

getter for module type

Returns
module type

Reimplemented from Inter4ql::ModuleGeneric.

◆ get_name()

std::string Inter4ql::ModuleLocal::get_name ( ) const
virtual

getter for a name of module

Returns
module name

Reimplemented from Inter4ql::ModuleGeneric.

◆ get_relation()

Relation * Inter4ql::ModuleLocal::get_relation ( std::string  s) const
virtual

getter for a relation

Parameters
sname of a relation
Returns
relation with name s inside module

Reimplemented from Inter4ql::ModuleGeneric.

◆ get_relations()

std::vector< Relation * > * Inter4ql::ModuleLocal::get_relations ( ) const
virtual

getter for module relations

Returns
module relations

Reimplemented from Inter4ql::ModuleGeneric.

◆ get_wsm_database()

virtual database* Inter4ql::ModuleLocal::get_wsm_database ( )
inlinevirtual

fetches a database of facts from well-supported model (for summing purposes)

Returns
database of wsm facts

Reimplemented from Inter4ql::ModuleGeneric.

Reimplemented in Inter4ql::ModuleSum.

◆ print()

std::string Inter4ql::ModuleLocal::print ( )
virtual

function that returns string with module information

Returns
module information packed in a std::string

Reimplemented from Inter4ql::ModuleGeneric.

◆ reason()

void Inter4ql::ModuleLocal::reason ( )
virtual

performs reasoning

Implements Inter4ql::ModuleGeneric.

◆ reason_with_rules()

void Inter4ql::ModuleLocal::reason_with_rules ( std::vector< Rule *> *  rules)
virtual

performs reasing with additional Rules added

Parameters
ruleslist of Rules to be added before reasoning

Reimplemented from Inter4ql::ModuleGeneric.

◆ set_disable_constraints()

void Inter4ql::ModuleLocal::set_disable_constraints ( bool  value) const
inlineoverridevirtual

allows for disabling constraints check

Parameters
valuevalue to be set

Reimplemented from Inter4ql::ModuleGeneric.


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