knowrob
2.1.0
A Knowledge Base System for Cognition-enabled Robots
|
#include <GoalDrivenReasoner.h>
Public Member Functions | |
GoalDrivenReasoner () | |
bool | hasFeature (GoalDrivenReasonerFeature feature) const |
void | enableFeature (GoalDrivenReasonerFeature feature) |
bool | isRelationDefined (const PredicateIndicator &indicator) |
bool | isClassDefined (const std::string_view &iri) |
void | defineRelation (const PredicateIndicator &indicator) |
void | defineRelation (const IRIAtomPtr &iri) |
void | undefineRelation (const PredicateIndicator &indicator) |
void | defineClass (const IRIAtomPtr &iri) |
void | undefineClass (const IRIAtomPtr &iri) |
const auto & | definedRelations () const |
const auto & | definedClasses () const |
virtual bool | evaluate (GoalPtr query)=0 |
GoalDrivenReasoner () | |
bool | hasFeature (GoalDrivenReasonerFeature feature) const |
void | enableFeature (GoalDrivenReasonerFeature feature) |
bool | isRelationDefined (const PredicateIndicator &indicator) |
bool | isClassDefined (const std::string_view &iri) |
void | defineRelation (const PredicateIndicator &indicator) |
void | defineRelation (const IRIAtomPtr &iri) |
void | undefineRelation (const PredicateIndicator &indicator) |
void | defineClass (const IRIAtomPtr &iri) |
void | undefineClass (const IRIAtomPtr &iri) |
const auto & | definedRelations () const |
const auto & | definedClasses () const |
virtual bool | evaluate (GoalPtr query)=0 |
Public Member Functions inherited from knowrob::Reasoner | |
Reasoner () | |
virtual | ~Reasoner ()=default |
auto & | reasonerName () const |
auto | reasonerLanguage () const |
auto | storage () const |
template<class T > | |
std::shared_ptr< T > | getTypedStorage () const |
ReasonerManager & | reasonerManager () const |
void | pushWork (const std::function< void(void)> &fn) |
void | setStorage (const StoragePtr &storage) |
virtual bool | initializeReasoner (const PropertyTree &ptree)=0 |
virtual void | unload () |
Reasoner () | |
virtual | ~Reasoner ()=default |
auto & | reasonerName () const |
auto | reasonerLanguage () const |
auto | storage () const |
template<class T > | |
std::shared_ptr< T > | getTypedStorage () const |
ReasonerManager & | reasonerManager () const |
void | pushWork (const std::function< void(void)> &fn) |
void | setStorage (const StoragePtr &storage) |
virtual bool | initializeReasoner (const PropertyTree &ptree)=0 |
virtual void | unload () |
Public Member Functions inherited from knowrob::DataSourceHandler | |
DataSourceHandler ()=default | |
virtual | ~DataSourceHandler ()=default |
void | addDataHandler (const std::string &format, const DataSourceLoader &fn) |
bool | loadDataSource (const DataSourcePtr &dataSource) |
bool | hasDataHandler (const DataSourcePtr &dataSource) const |
DataSourceHandler ()=default | |
virtual | ~DataSourceHandler ()=default |
void | addDataHandler (const std::string &format, const DataSourceLoader &fn) |
bool | loadDataSource (const DataSourcePtr &dataSource) |
bool | hasDataHandler (const DataSourcePtr &dataSource) const |
Protected Attributes | |
std::set< PredicateIndicator > | definedRelations_ |
std::set< PredicateIndicator > | definedClasses_ |
int | features_ |
Protected Attributes inherited from knowrob::DataSourceHandler | |
std::map< std::string, DataSourceLoader > | dataSourceHandler_ |
Additional Inherited Members | |
Protected Member Functions inherited from knowrob::DataSourceHandler | |
virtual bool | loadDataSourceWithUnknownFormat (const DataSourcePtr &) |
virtual bool | loadDataSourceWithUnknownFormat (const DataSourcePtr &) |
A reasoner that supports goal-driven reasoning. Goal-driven reasoning is a form of reasoning where the reasoner is asked to evaluate a query. This is in contrast to data-driven reasoning, where the reasoner is started and then infers additional knowledge from the data.
Definition at line 40 of file GoalDrivenReasoner.h.
|
inline |
Definition at line 42 of file GoalDrivenReasoner.h.
|
inline |
Definition at line 42 of file GoalDrivenReasoner.h.
void GoalDrivenReasoner::defineClass | ( | const IRIAtomPtr & | iri | ) |
Add a defined class to the reasoner.
iri | an IRI of a RDF class. |
Definition at line 47 of file GoalDrivenReasoner.cpp.
void knowrob::GoalDrivenReasoner::defineClass | ( | const IRIAtomPtr & | iri | ) |
Add a defined class to the reasoner.
iri | an IRI of a RDF class. |
|
inline |
|
inline |
|
inline |
Definition at line 105 of file GoalDrivenReasoner.h.
|
inline |
void GoalDrivenReasoner::defineRelation | ( | const IRIAtomPtr & | iri | ) |
Add a defined relation to the reasoner.
iri | an IRI of a RDF predicate. |
Definition at line 35 of file GoalDrivenReasoner.cpp.
void knowrob::GoalDrivenReasoner::defineRelation | ( | const IRIAtomPtr & | iri | ) |
Add a defined relation to the reasoner.
iri | an IRI of a RDF predicate. |
void GoalDrivenReasoner::defineRelation | ( | const PredicateIndicator & | indicator | ) |
Add a defined relation to the reasoner.
indicator | a predicate indicator. |
Definition at line 29 of file GoalDrivenReasoner.cpp.
void knowrob::GoalDrivenReasoner::defineRelation | ( | const PredicateIndicator & | indicator | ) |
Add a defined relation to the reasoner.
indicator | a predicate indicator. |
void GoalDrivenReasoner::enableFeature | ( | GoalDrivenReasonerFeature | feature | ) |
Enable a specific feature of the reasoner.
Definition at line 17 of file GoalDrivenReasoner.cpp.
void knowrob::GoalDrivenReasoner::enableFeature | ( | GoalDrivenReasonerFeature | feature | ) |
Enable a specific feature of the reasoner.
|
pure virtual |
Evaluate a query with a reasoner. The query is represented by a formula, a context and an answer queue where results of the reasoning process can be added. The evaluation of the query must be performed synchronously, i.e. the answer queue must be filled before the function returns. A reasoner may instead throw an exception if the query cannot be evaluated, or return false to also indicate an error status.
query | the query to evaluate. |
Implemented in knowrob::RDFGoalReasoner, knowrob::PrologReasoner, knowrob::RDFGoalReasoner, and knowrob::PrologReasoner.
|
pure virtual |
Evaluate a query with a reasoner. The query is represented by a formula, a context and an answer queue where results of the reasoning process can be added. The evaluation of the query must be performed synchronously, i.e. the answer queue must be filled before the function returns. A reasoner may instead throw an exception if the query cannot be evaluated, or return false to also indicate an error status.
query | the query to evaluate. |
Implemented in knowrob::RDFGoalReasoner, knowrob::PrologReasoner, knowrob::RDFGoalReasoner, and knowrob::PrologReasoner.
bool GoalDrivenReasoner::hasFeature | ( | GoalDrivenReasonerFeature | feature | ) | const |
Definition at line 13 of file GoalDrivenReasoner.cpp.
bool knowrob::GoalDrivenReasoner::hasFeature | ( | GoalDrivenReasonerFeature | feature | ) | const |
bool GoalDrivenReasoner::isClassDefined | ( | const std::string_view & | iri | ) |
Find out if the class is defined by this reasoner. A defined class is a class that is known to the reasoner, and for which the reasoner can provide additional groundings when being queried.
iri | a class IRI. |
Definition at line 25 of file GoalDrivenReasoner.cpp.
bool knowrob::GoalDrivenReasoner::isClassDefined | ( | const std::string_view & | iri | ) |
Find out if the class is defined by this reasoner. A defined class is a class that is known to the reasoner, and for which the reasoner can provide additional groundings when being queried.
iri | a class IRI. |
bool GoalDrivenReasoner::isRelationDefined | ( | const PredicateIndicator & | indicator | ) |
Find out if the relation is defined by this reasoner. A defined relation is a relation that is known to the reasoner, and for which the reasoner can provide additional groundings when being queried.
indicator | a predicate indicator. |
Definition at line 21 of file GoalDrivenReasoner.cpp.
bool knowrob::GoalDrivenReasoner::isRelationDefined | ( | const PredicateIndicator & | indicator | ) |
Find out if the relation is defined by this reasoner. A defined relation is a relation that is known to the reasoner, and for which the reasoner can provide additional groundings when being queried.
indicator | a predicate indicator. |
void GoalDrivenReasoner::undefineClass | ( | const IRIAtomPtr & | iri | ) |
Remove a defined class from the reasoner.
iri | an IRI of a RDF class. |
Definition at line 53 of file GoalDrivenReasoner.cpp.
void knowrob::GoalDrivenReasoner::undefineClass | ( | const IRIAtomPtr & | iri | ) |
Remove a defined class from the reasoner.
iri | an IRI of a RDF class. |
void GoalDrivenReasoner::undefineRelation | ( | const PredicateIndicator & | indicator | ) |
Remove a defined relation from the reasoner.
indicator | a predicate indicator. |
Definition at line 41 of file GoalDrivenReasoner.cpp.
void knowrob::GoalDrivenReasoner::undefineRelation | ( | const PredicateIndicator & | indicator | ) |
Remove a defined relation from the reasoner.
indicator | a predicate indicator. |
|
protected |
Definition at line 127 of file GoalDrivenReasoner.h.
|
protected |
Definition at line 126 of file GoalDrivenReasoner.h.
|
protected |
Definition at line 128 of file GoalDrivenReasoner.h.