knowrob
2.1.0
A Knowledge Base System for Cognition-enabled Robots
|
#include <QueryableStorage.h>
Public Member Functions | |
QueryableStorage (StorageFeatures features=StorageFeature::NothingSpecial) | |
~QueryableStorage () override=default | |
virtual bool | isPersistent () const =0 |
virtual void | foreach (const TripleVisitor &visitor) const |
virtual void | batch (const TripleHandler &callback) const =0 |
virtual void | batchOrigin (std::string_view origin, const TripleHandler &callback)=0 |
virtual bool | contains (const Triple &triple) |
virtual void | match (const TriplePattern &query, const TripleVisitor &visitor) |
virtual void | query (const GraphQueryPtr &query, const BindingsHandler &callback)=0 |
virtual void | count (const ResourceCounter &callback) const =0 |
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 bool | isPersistent () const =0 |
virtual void | foreach (const TripleVisitor &visitor) const |
virtual void | batch (const TripleHandler &callback) const =0 |
virtual void | batchOrigin (std::string_view origin, const TripleHandler &callback)=0 |
virtual bool | contains (const Triple &triple) |
virtual void | match (const TriplePattern &query, const TripleVisitor &visitor) |
virtual void | query (const GraphQueryPtr &query, const BindingsHandler &callback)=0 |
virtual void | count (const ResourceCounter &callback) const =0 |
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 |
virtual bool | insertOne (const Triple &triple)=0 |
virtual bool | insertAll (const TripleContainerPtr &triples)=0 |
virtual bool | removeOne (const Triple &triple)=0 |
virtual bool | removeAll (const TripleContainerPtr &triples)=0 |
virtual bool | removeAllWithOrigin (std::string_view origin)=0 |
virtual bool | initializeBackend (const PropertyTree &config)=0 |
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 |
virtual bool | insertOne (const Triple &triple)=0 |
virtual bool | insertAll (const TripleContainerPtr &triples)=0 |
virtual bool | removeOne (const Triple &triple)=0 |
virtual bool | removeAll (const TripleContainerPtr &triples)=0 |
virtual bool | removeAllWithOrigin (std::string_view origin)=0 |
virtual bool | initializeBackend (const PropertyTree &config)=0 |
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 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 Public Attributes | |
static AtomPtr | versionProperty = IRIAtom::Tabled("http://knowrob.org/kb/knowrob.owl#hasVersionOfOrigin") |
Additional Inherited Members | |
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_ |
A backend that can be queried.
Definition at line 25 of file QueryableStorage.h.
|
explicit |
Definition at line 20 of file QueryableStorage.cpp.
|
overridedefault |
|
explicit |
|
overridedefault |
|
pure virtual |
Iterate over all triples in the model.
callback | the callback to handle the triples. |
Implemented in knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, knowrob::PrologBackend, knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, and knowrob::PrologBackend.
|
pure virtual |
Iterate over all triples in the model.
callback | the callback to handle the triples. |
Implemented in knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, knowrob::PrologBackend, knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, and knowrob::PrologBackend.
|
pure virtual |
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. |
Implemented in knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, knowrob::PrologBackend, knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, and knowrob::PrologBackend.
|
pure virtual |
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. |
Implemented in knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, knowrob::PrologBackend, knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, and knowrob::PrologBackend.
|
virtual |
triple | a framed triple. |
Reimplemented in knowrob::RedlandModel, and knowrob::RedlandModel.
Definition at line 83 of file QueryableStorage.cpp.
|
virtual |
triple | a framed triple. |
Reimplemented in knowrob::RedlandModel, and knowrob::RedlandModel.
|
pure virtual |
callback | a function that is called for each resource and its count. |
Implemented in knowrob::SPARQLBackend, knowrob::MongoKnowledgeGraph, knowrob::PrologBackend, knowrob::SPARQLBackend, knowrob::MongoKnowledgeGraph, and knowrob::PrologBackend.
|
pure virtual |
callback | a function that is called for each resource and its count. |
Implemented in knowrob::SPARQLBackend, knowrob::MongoKnowledgeGraph, knowrob::PrologBackend, knowrob::SPARQLBackend, knowrob::MongoKnowledgeGraph, and knowrob::PrologBackend.
void QueryableStorage::dropSessionOrigins | ( | ) |
Delete triples that have been asserted from a "session" origin.
Definition at line 52 of file QueryableStorage.cpp.
void knowrob::QueryableStorage::dropSessionOrigins | ( | ) |
Delete triples that have been asserted from a "session" origin.
GraphQueryExpansionPtr QueryableStorage::expand | ( | const GraphQueryPtr & | q | ) |
Compute the expansion of a graph path query.
q | a graph path query. |
Definition at line 362 of file QueryableStorage.cpp.
GraphQueryExpansionPtr knowrob::QueryableStorage::expand | ( | const GraphQueryPtr & | q | ) |
Compute the expansion of a graph path query.
q | a graph path query. |
|
virtual |
Iterate over all triples in the model.
visitor | the callback to handle the triples. |
Reimplemented in knowrob::MongoKnowledgeGraph, and knowrob::MongoKnowledgeGraph.
Definition at line 91 of file QueryableStorage.cpp.
|
virtual |
Iterate over all triples in the model.
visitor | the callback to handle the triples. |
Reimplemented in knowrob::MongoKnowledgeGraph, and knowrob::MongoKnowledgeGraph.
std::vector< VersionedOriginPtr > QueryableStorage::getOrigins | ( | ) |
Definition at line 24 of file QueryableStorage.cpp.
std::vector<VersionedOriginPtr> knowrob::QueryableStorage::getOrigins | ( | ) |
std::optional< std::string > QueryableStorage::getVersionOfOrigin | ( | std::string_view | origin | ) |
origin | an origin string. |
Definition at line 44 of file QueryableStorage.cpp.
std::optional<std::string> knowrob::QueryableStorage::getVersionOfOrigin | ( | std::string_view | origin | ) |
origin | an origin string. |
|
pure virtual |
Implemented in knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, knowrob::PrologBackend, knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, and knowrob::PrologBackend.
|
pure virtual |
Implemented in knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, knowrob::PrologBackend, knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, and knowrob::PrologBackend.
|
virtual |
query | a framed triple pattern. |
visitor | a function that is called for each matching framed triple. |
Reimplemented in knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, knowrob::RedlandModel, and knowrob::MongoKnowledgeGraph.
Definition at line 68 of file QueryableStorage.cpp.
|
virtual |
query | a framed triple pattern. |
visitor | a function that is called for each matching framed triple. |
Reimplemented in knowrob::RedlandModel, knowrob::MongoKnowledgeGraph, knowrob::RedlandModel, and knowrob::MongoKnowledgeGraph.
|
static |
Generates a negative answer to a query.
q | a graph path query. |
Definition at line 137 of file QueryableStorage.cpp.
|
static |
Generates a negative answer to a query.
q | a graph path query. |
|
pure virtual |
Submits a graph query to this storage.
query | a graph query |
callback | a function that is called for each answer to the query. |
Implemented in knowrob::SPARQLBackend, knowrob::MongoKnowledgeGraph, knowrob::PrologBackend, knowrob::SPARQLBackend, knowrob::MongoKnowledgeGraph, and knowrob::PrologBackend.
|
pure virtual |
Submits a graph query to this storage.
query | a graph query |
callback | a function that is called for each answer to the query. |
Implemented in knowrob::SPARQLBackend, knowrob::MongoKnowledgeGraph, knowrob::PrologBackend, knowrob::SPARQLBackend, knowrob::MongoKnowledgeGraph, and knowrob::PrologBackend.
void QueryableStorage::setVersionOfOrigin | ( | std::string_view | origin, |
std::string_view | version | ||
) |
Set the version of an origin.
origin | an origin string. |
version | a version string. |
Definition at line 35 of file QueryableStorage.cpp.
void knowrob::QueryableStorage::setVersionOfOrigin | ( | std::string_view | origin, |
std::string_view | version | ||
) |
Set the version of an origin.
origin | an origin string. |
version | a version string. |
|
static |
Generates a positive answer to a query.
original | a graph path query. |
expansion | a graph query expansion. |
bindings | a set of bindings. |
Definition at line 99 of file QueryableStorage.cpp.
|
static |
Generates a positive answer to a query.
original | a graph path query. |
expansion | a graph query expansion. |
bindings | a set of bindings. |
|
static |
Definition at line 27 of file QueryableStorage.h.