knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
PrologBackend.h
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #ifndef KNOWROB_PROLOG_BACKEND_H
7 #define KNOWROB_PROLOG_BACKEND_H
8 
9 #include "knowrob/storage/QueryableStorage.h"
10 #include "PrologTerm.h"
11 
12 namespace knowrob {
19  class PrologBackend : public QueryableStorage {
20  public:
22 
23  ~PrologBackend() override = default;
24 
29  static bool removeAll();
30 
32 
33  // override DataBackend
34  bool initializeBackend(const PropertyTree &cfg) override;
35 
36  // override DataBackend
37  bool insertOne(const Triple &triple) override;
38 
39  // override DataBackend
40  bool insertAll(const TripleContainerPtr &triples) override;
41 
42  // override DataBackend
43  bool removeOne(const Triple &triple) override;
44 
45  // override DataBackend
46  bool removeAll(const TripleContainerPtr &triples) override;
47 
48  // override DataBackend
49  bool removeAllWithOrigin(std::string_view origin) override;
50 
51  // override QueryableBackend
52  bool isPersistent() const override;
53 
54  // override QueryableBackend
55  void batch(const TripleHandler &callback) const override;
56 
57  // override QueryableBackend
58  void batchOrigin(std::string_view origin, const TripleHandler &callback) override;
59 
60  // override QueryableBackend
61  void query(const GraphQueryPtr &query, const BindingsHandler &callback) override;
62 
63  // override QueryableBackend
64  void count(const ResourceCounter &callback) const override;
65 
66  protected:
67  static PrologTerm transaction(std::string_view rdf_functor, const TripleContainerPtr &triples);
68  };
69 
70 } // knowrob
71 
72 #endif //KNOWROB_PROLOG_BACKEND_H
bool initializeBackend(const PropertyTree &cfg) override
void count(const ResourceCounter &callback) const override
~PrologBackend() override=default
void query(const GraphQueryPtr &query, const BindingsHandler &callback) override
bool removeOne(const Triple &triple) override
bool insertOne(const Triple &triple) override
void query(const GraphQueryPtr &query, const BindingsHandler &callback) override
static PrologTerm transaction(std::string_view rdf_functor, const TripleContainerPtr &triples)
void batch(const TripleHandler &callback) const override
bool removeAll(const TripleContainerPtr &triples) override
static bool removeAll()
void batchOrigin(std::string_view origin, const TripleHandler &callback) override
bool insertAll(const TripleContainerPtr &triples) override
bool removeAllWithOrigin(std::string_view origin) override
bool isPersistent() const override
std::shared_ptr< TripleContainer > TripleContainerPtr
std::function< void(std::string_view, uint64_t)> ResourceCounter
std::function< void(const BindingsPtr &)> BindingsHandler
Definition: Bindings.h:152
std::function< void(const TripleContainerPtr &)> TripleHandler
std::shared_ptr< GraphQuery > GraphQueryPtr
Definition: GraphQuery.h:65