knowrob
2.1.0
A Knowledge Base System for Cognition-enabled Robots
|
#include <PrologBackend.h>
Public Member Functions | |
PrologBackend () | |
~PrologBackend () override=default | |
bool | initializeBackend () |
bool | initializeBackend (const PropertyTree &cfg) override |
bool | insertOne (const Triple &triple) override |
bool | insertAll (const TripleContainerPtr &triples) override |
bool | removeOne (const Triple &triple) override |
bool | removeAll (const TripleContainerPtr &triples) override |
bool | removeAllWithOrigin (std::string_view origin) override |
bool | isPersistent () const override |
void | batch (const TripleHandler &callback) const override |
void | batchOrigin (std::string_view origin, const TripleHandler &callback) override |
void | query (const GraphQueryPtr &query, const BindingsHandler &callback) override |
void | count (const ResourceCounter &callback) const override |
PrologBackend () | |
~PrologBackend () override=default | |
bool | initializeBackend () |
bool | initializeBackend (const PropertyTree &cfg) override |
bool | insertOne (const Triple &triple) override |
bool | insertAll (const TripleContainerPtr &triples) override |
bool | removeOne (const Triple &triple) override |
bool | removeAll (const TripleContainerPtr &triples) override |
bool | removeAllWithOrigin (std::string_view origin) override |
bool | isPersistent () const override |
void | batch (const TripleHandler &callback) const override |
void | batchOrigin (std::string_view origin, const TripleHandler &callback) override |
void | query (const GraphQueryPtr &query, const BindingsHandler &callback) override |
void | count (const ResourceCounter &callback) const override |
Public Member Functions inherited from knowrob::QueryableStorage | |
QueryableStorage (StorageFeatures features=StorageFeature::NothingSpecial) | |
~QueryableStorage () override=default | |
virtual void | foreach (const TripleVisitor &visitor) const |
virtual bool | contains (const Triple &triple) |
virtual void | match (const TriplePattern &query, const TripleVisitor &visitor) |
std::vector< VersionedOriginPtr > | getOrigins () |
std::optional< std::string > | getVersionOfOrigin (std::string_view origin) |
void | setVersionOfOrigin (std::string_view origin, std::string_view version) |
void | dropSessionOrigins () |
GraphQueryExpansionPtr | expand (const GraphQueryPtr &q) |
QueryableStorage (StorageFeatures features=StorageFeature::NothingSpecial) | |
~QueryableStorage () override=default | |
virtual void | foreach (const TripleVisitor &visitor) const |
virtual bool | contains (const Triple &triple) |
virtual void | match (const TriplePattern &query, const TripleVisitor &visitor) |
std::vector< VersionedOriginPtr > | getOrigins () |
std::optional< std::string > | getVersionOfOrigin (std::string_view origin) |
void | setVersionOfOrigin (std::string_view origin, std::string_view version) |
void | dropSessionOrigins () |
GraphQueryExpansionPtr | expand (const GraphQueryPtr &q) |
Public Member Functions inherited from knowrob::Storage | |
Storage (StorageFeatures features=StorageFeature::NothingSpecial) | |
virtual | ~Storage ()=default |
PluginLanguage | storageLanguage () const |
const auto & | vocabulary () const |
void | setVocabulary (std::shared_ptr< Vocabulary > vocabulary) |
bool | supports (StorageFeature feature) const |
std::optional< std::string > | getVersionOfOrigin (std::string_view origin) const |
void | setVersionOfOrigin (std::string_view origin, std::optional< std::string_view > version) |
Storage (StorageFeatures features=StorageFeature::NothingSpecial) | |
virtual | ~Storage ()=default |
PluginLanguage | storageLanguage () const |
const auto & | vocabulary () const |
void | setVocabulary (std::shared_ptr< Vocabulary > vocabulary) |
bool | supports (StorageFeature feature) const |
std::optional< std::string > | getVersionOfOrigin (std::string_view origin) const |
void | setVersionOfOrigin (std::string_view origin, std::optional< std::string_view > version) |
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 |
Static Public Member Functions | |
static bool | removeAll () |
static bool | removeAll () |
Static Public Member Functions inherited from knowrob::QueryableStorage | |
static std::shared_ptr< AnswerYes > | yes (const GraphPathQueryPtr &original, const GraphQueryExpansionPtr &expansion, const BindingsPtr &bindings) |
static std::shared_ptr< AnswerNo > | no (const GraphPathQueryPtr &q) |
static std::shared_ptr< AnswerYes > | yes (const GraphPathQueryPtr &original, const GraphQueryExpansionPtr &expansion, const BindingsPtr &bindings) |
static std::shared_ptr< AnswerNo > | no (const GraphPathQueryPtr &q) |
Static Protected Member Functions | |
static PrologTerm | transaction (std::string_view rdf_functor, const TripleContainerPtr &triples) |
static PrologTerm | transaction (std::string_view rdf_functor, const TripleContainerPtr &triples) |
Additional Inherited Members | |
Static Public Attributes inherited from knowrob::QueryableStorage | |
static AtomPtr | versionProperty = IRIAtom::Tabled("http://knowrob.org/kb/knowrob.owl#hasVersionOfOrigin") |
Protected Member Functions inherited from knowrob::Storage | |
void | enableFeature (StorageFeature feature) |
void | setStorageLanguage (PluginLanguage storageLanguage) |
void | enableFeature (StorageFeature feature) |
void | setStorageLanguage (PluginLanguage storageLanguage) |
Protected Member Functions inherited from knowrob::DataSourceHandler | |
virtual bool | loadDataSourceWithUnknownFormat (const DataSourcePtr &) |
virtual bool | loadDataSourceWithUnknownFormat (const DataSourcePtr &) |
Protected Attributes inherited from knowrob::Storage | |
std::map< std::string, std::string > | originVersions_ |
std::shared_ptr< Vocabulary > | vocabulary_ |
StorageFeatures | features_ |
PluginLanguage | storageLanguage_ |
Protected Attributes inherited from knowrob::DataSourceHandler | |
std::map< std::string, DataSourceLoader > | dataSourceHandler_ |
The triple store backend for Prolog reasoners. The backend is a singleton, and it is not possible to have multiple instances of it. The reason is that Prolog reasoners do not support multiple EDBs due to limitations of the underlying Prolog "semweb" library which only has a global storage.
Definition at line 19 of file PrologBackend.h.
PrologBackend::PrologBackend | ( | ) |
Definition at line 26 of file PrologBackend.cpp.
|
overridedefault |
knowrob::PrologBackend::PrologBackend | ( | ) |
|
overridedefault |
|
overridevirtual |
Iterate over all triples in the model.
callback | the callback to handle the triples. |
Implements knowrob::QueryableStorage.
Definition at line 164 of file PrologBackend.cpp.
|
overridevirtual |
Iterate over all triples in the model.
callback | the callback to handle the triples. |
Implements knowrob::QueryableStorage.
|
overridevirtual |
Iterate over all triples in the model that have a given origin.
origin | the origin of the triples. |
callback | the callback to handle the triples. |
Implements knowrob::QueryableStorage.
Definition at line 169 of file PrologBackend.cpp.
|
overridevirtual |
Iterate over all triples in the model that have a given origin.
origin | the origin of the triples. |
callback | the callback to handle the triples. |
Implements knowrob::QueryableStorage.
|
overridevirtual |
callback | a function that is called for each resource and its count. |
Implements knowrob::QueryableStorage.
Definition at line 178 of file PrologBackend.cpp.
|
overridevirtual |
callback | a function that is called for each resource and its count. |
Implements knowrob::QueryableStorage.
bool PrologBackend::initializeBackend | ( | ) |
Definition at line 30 of file PrologBackend.cpp.
bool knowrob::PrologBackend::initializeBackend | ( | ) |
|
overridevirtual |
Initialize this backend from a property tree.
config | a property tree. |
Implements knowrob::Storage.
Definition at line 56 of file PrologBackend.cpp.
|
overridevirtual |
Initialize this backend from a property tree.
config | a property tree. |
Implements knowrob::Storage.
|
overridevirtual |
Add assertions to this backend.
triples | a set of triples. |
Implements knowrob::Storage.
Definition at line 80 of file PrologBackend.cpp.
|
overridevirtual |
Add assertions to this backend.
triples | a set of triples. |
Implements knowrob::Storage.
|
overridevirtual |
Add an assertion to this backend.
triple | a triple. |
Implements knowrob::Storage.
Definition at line 60 of file PrologBackend.cpp.
|
overridevirtual |
Add an assertion to this backend.
triple | a triple. |
Implements knowrob::Storage.
|
overridevirtual |
Implements knowrob::QueryableStorage.
Definition at line 99 of file PrologBackend.cpp.
|
overridevirtual |
Implements knowrob::QueryableStorage.
|
overridevirtual |
Submits a graph query to this storage.
query | a graph query |
callback | a function that is called for each answer to the query. |
Implements knowrob::QueryableStorage.
Definition at line 174 of file PrologBackend.cpp.
|
overridevirtual |
Submits a graph query to this storage.
query | a graph query |
callback | a function that is called for each answer to the query. |
Implements knowrob::QueryableStorage.
|
static |
Remove all triples from the storage.
Definition at line 75 of file PrologBackend.cpp.
|
static |
Remove all triples from the storage.
|
overridevirtual |
Delete all matching statements from this backend.
triples | a set of triples. |
Implements knowrob::Storage.
Definition at line 85 of file PrologBackend.cpp.
|
overridevirtual |
Delete all matching statements from this backend.
triples | a set of triples. |
Implements knowrob::Storage.
|
overridevirtual |
Delete all statements with a given origin from this backend.
origin | the origin of the statements to be deleted. |
Implements knowrob::Storage.
Definition at line 70 of file PrologBackend.cpp.
|
overridevirtual |
Delete all statements with a given origin from this backend.
origin | the origin of the statements to be deleted. |
Implements knowrob::Storage.
|
overridevirtual |
Delete the first matching statement from this backend.
triple | a triple. |
Implements knowrob::Storage.
Definition at line 65 of file PrologBackend.cpp.
|
overridevirtual |
Delete the first matching statement from this backend.
triple | a triple. |
Implements knowrob::Storage.
|
staticprotected |
Definition at line 90 of file PrologBackend.cpp.
|
staticprotected |