knowrob
2.1.0
A Knowledge Base System for Cognition-enabled Robots
|
#include <DataDrivenReasoner.h>
Public Types | |
enum | Feature { NothingSpecial = 1 << 0 , UpdatesItself = 1 << 1 , InvalidatesItself = 1 << 2 , NothingSpecial = 1 << 0 , UpdatesItself = 1 << 1 , InvalidatesItself = 1 << 2 } |
enum | Feature { NothingSpecial = 1 << 0 , UpdatesItself = 1 << 1 , InvalidatesItself = 1 << 2 , NothingSpecial = 1 << 0 , UpdatesItself = 1 << 1 , InvalidatesItself = 1 << 2 } |
Public Member Functions | |
DataDrivenReasoner () | |
void | enableFeature (Feature feature) |
bool | hasFeature (Feature feature) const |
void | setUpdateInterval (double intervalInSeconds) |
auto | updateInterval () const |
void | emit (const std::shared_ptr< reasoner::Event > &event) |
void | observe (const std::shared_ptr< GraphQuery > &query, const BindingsHandler &handler) |
void | observe (const std::string &queryString, const BindingsHandler &handler) |
virtual void | update ()=0 |
virtual void | start () |
virtual void | stop () |
DataDrivenReasoner () | |
void | enableFeature (Feature feature) |
bool | hasFeature (Feature feature) const |
void | setUpdateInterval (double intervalInSeconds) |
auto | updateInterval () const |
void | emit (const std::shared_ptr< reasoner::Event > &event) |
void | observe (const std::shared_ptr< GraphQuery > &query, const BindingsHandler &handler) |
void | observe (const std::string &queryString, const BindingsHandler &handler) |
virtual void | update ()=0 |
virtual void | start () |
virtual void | stop () |
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 Member Functions | |
void | processAssertion (const std::vector< TriplePtr > &triples) |
void | processRetraction (const std::vector< TriplePtr > &triples) |
void | processReplacement (const std::vector< TriplePtr > &triples) |
void | processInvalidation () |
void | setReasonerOrigin (const std::vector< TriplePtr > &triples) |
void | doUpdate () |
void | queueUpdate () |
void | processAssertion (const std::vector< TriplePtr > &triples) |
void | processRetraction (const std::vector< TriplePtr > &triples) |
void | processReplacement (const std::vector< TriplePtr > &triples) |
void | processInvalidation () |
void | setReasonerOrigin (const std::vector< TriplePtr > &triples) |
void | doUpdate () |
void | queueUpdate () |
Protected Member Functions inherited from knowrob::DataSourceHandler | |
virtual bool | loadDataSourceWithUnknownFormat (const DataSourcePtr &) |
virtual bool | loadDataSourceWithUnknownFormat (const DataSourcePtr &) |
Protected Attributes | |
bool | isUpdateQueued_ = false |
bool | isRunning_ = false |
bool | isInvalidated_ = true |
std::chrono::duration< double > | updateInterval_ = std::chrono::seconds(1) |
uint32_t | features_ = NothingSpecial |
std::set< TriplePtr > | inferredTriples_ |
std::shared_ptr< ThreadPool::Runner > | updateRunner_ |
std::chrono::time_point< std::chrono::high_resolution_clock > | lastUpdate_ |
Protected Attributes inherited from knowrob::DataSourceHandler | |
std::map< std::string, DataSourceLoader > | dataSourceHandler_ |
A reasoner that is driven by data, i.e., it starts with the data and infers additional knowledge e.g. by applying rules to the data. This is in contrast to a goal-driven reasoner, which is driven by queries. The data is taken from a data backend, which is associated with the reasoner before the reasoner is started.
Definition at line 20 of file DataDrivenReasoner.h.
Features of the reasoner.
Enumerator | |
---|---|
NothingSpecial | |
UpdatesItself | |
InvalidatesItself | |
NothingSpecial | |
UpdatesItself | |
InvalidatesItself |
Definition at line 25 of file DataDrivenReasoner.h.
Features of the reasoner.
Enumerator | |
---|---|
NothingSpecial | |
UpdatesItself | |
InvalidatesItself | |
NothingSpecial | |
UpdatesItself | |
InvalidatesItself |
Definition at line 25 of file DataDrivenReasoner.h.
DataDrivenReasoner::DataDrivenReasoner | ( | ) |
Definition at line 15 of file DataDrivenReasoner.cpp.
knowrob::DataDrivenReasoner::DataDrivenReasoner | ( | ) |
|
protected |
Definition at line 43 of file DataDrivenReasoner.cpp.
|
protected |
void DataDrivenReasoner::emit | ( | const std::shared_ptr< reasoner::Event > & | event | ) |
Trigger a reasoner event. This is the main way how the reasoner informs the rest of the system about its result and state.
event | a reasoner event. |
Definition at line 104 of file DataDrivenReasoner.cpp.
void knowrob::DataDrivenReasoner::emit | ( | const std::shared_ptr< reasoner::Event > & | event | ) |
Trigger a reasoner event. This is the main way how the reasoner informs the rest of the system about its result and state.
event | a reasoner event. |
void DataDrivenReasoner::enableFeature | ( | Feature | feature | ) |
Enable a feature of the reasoner.
feature | a feature. |
Definition at line 21 of file DataDrivenReasoner.cpp.
void knowrob::DataDrivenReasoner::enableFeature | ( | Feature | feature | ) |
Enable a feature of the reasoner.
feature | a feature. |
bool DataDrivenReasoner::hasFeature | ( | Feature | feature | ) | const |
Definition at line 25 of file DataDrivenReasoner.cpp.
bool knowrob::DataDrivenReasoner::hasFeature | ( | Feature | feature | ) | const |
void DataDrivenReasoner::observe | ( | const std::shared_ptr< GraphQuery > & | query, |
const BindingsHandler & | handler | ||
) |
Observe a graph query. The reasoner will observe the query and call the handler whenever the query's result changes.
query | a graph query. |
handler | a bindings handler. |
Definition at line 121 of file DataDrivenReasoner.cpp.
void knowrob::DataDrivenReasoner::observe | ( | const std::shared_ptr< GraphQuery > & | query, |
const BindingsHandler & | handler | ||
) |
Observe a graph query. The reasoner will observe the query and call the handler whenever the query's result changes.
query | a graph query. |
handler | a bindings handler. |
void DataDrivenReasoner::observe | ( | const std::string & | queryString, |
const BindingsHandler & | handler | ||
) |
Observe a graph query. The reasoner will observe the query and call the handler whenever the query's result changes.
queryString | a graph query string. |
handler | a bindings handler. |
Definition at line 125 of file DataDrivenReasoner.cpp.
void knowrob::DataDrivenReasoner::observe | ( | const std::string & | queryString, |
const BindingsHandler & | handler | ||
) |
Observe a graph query. The reasoner will observe the query and call the handler whenever the query's result changes.
queryString | a graph query string. |
handler | a bindings handler. |
|
protected |
Definition at line 148 of file DataDrivenReasoner.cpp.
|
protected |
|
protected |
Definition at line 131 of file DataDrivenReasoner.cpp.
|
protected |
|
protected |
Definition at line 158 of file DataDrivenReasoner.cpp.
|
protected |
|
protected |
Definition at line 153 of file DataDrivenReasoner.cpp.
|
protected |
|
protected |
Definition at line 33 of file DataDrivenReasoner.cpp.
|
protected |
|
protected |
Definition at line 142 of file DataDrivenReasoner.cpp.
|
protected |
void DataDrivenReasoner::setUpdateInterval | ( | double | intervalInSeconds | ) |
Set the update rate of the reasoner. Only used if update is called externally.
intervalInSeconds | the update interval in seconds. |
Definition at line 29 of file DataDrivenReasoner.cpp.
void knowrob::DataDrivenReasoner::setUpdateInterval | ( | double | intervalInSeconds | ) |
Set the update rate of the reasoner. Only used if update is called externally.
intervalInSeconds | the update interval in seconds. |
|
virtual |
Start calling the update function periodically.
Definition at line 83 of file DataDrivenReasoner.cpp.
|
virtual |
Start calling the update function periodically.
|
virtual |
|
virtual |
Stop calling the update function.
|
pure virtual |
Update the reasoner. This function is called periodically to update the reasoner's state in case the reasoner does not update itself (see enableFeature
).
|
pure virtual |
Update the reasoner. This function is called periodically to update the reasoner's state in case the reasoner does not update itself (see enableFeature
).
|
inline |
|
inline |
|
protected |
Definition at line 106 of file DataDrivenReasoner.h.
|
protected |
Definition at line 107 of file DataDrivenReasoner.h.
|
protected |
Definition at line 104 of file DataDrivenReasoner.h.
|
protected |
Definition at line 103 of file DataDrivenReasoner.h.
|
protected |
Definition at line 102 of file DataDrivenReasoner.h.
|
protected |
Definition at line 109 of file DataDrivenReasoner.h.
|
protected |
Definition at line 105 of file DataDrivenReasoner.h.
|
protected |
Definition at line 108 of file DataDrivenReasoner.h.