6 #ifndef KNOWROB_KNOWLEDGE_BASE_H
7 #define KNOWROB_KNOWLEDGE_BASE_H
10 #include <boost/property_tree/ptree.hpp>
12 #include "knowrob/queries/QueryContext.h"
13 #include "knowrob/storage/QueryableStorage.h"
14 #include "knowrob/storage/StorageManager.h"
15 #include "knowrob/storage/StorageInterface.h"
16 #include "knowrob/semweb/GraphPathQuery.h"
17 #include "knowrob/semweb/OntologySource.h"
18 #include "knowrob/formulas/SimpleConjunction.h"
19 #include "knowrob/queries/ConjunctiveQuery.h"
20 #include "knowrob/storage/Observer.h"
21 #include "knowrob/storage/ObserverManager.h"
25 class ReasonerManager;
32 class KnowledgeBase :
public std::enable_shared_from_this<KnowledgeBase> {
38 static std::shared_ptr<KnowledgeBase>
create(
const boost::property_tree::ptree &config);
44 static std::shared_ptr<KnowledgeBase>
create(std::string_view config);
49 static std::shared_ptr<KnowledgeBase>
create();
184 std::shared_ptr<StorageInterface>
edb_;
197 void configure(
const boost::property_tree::ptree &config);
219 std::vector<std::shared_ptr<NamedBackend>>
220 prepareLoad(std::string_view origin, std::string_view newVersion)
const;
223 finishLoad(
const std::shared_ptr<OntologySource> &source, std::string_view origin, std::string_view newVersion);
230 std::string_view origin)
const;
KnowledgeBase(std::string_view config)
ObserverPtr observe(const GraphQueryPtr &query, const BindingsHandler &callback)
bool removeOne(const Triple &triple)
bool insertAll(const TripleContainerPtr &triples)
static void configurePrefixes(const boost::property_tree::ptree &config)
bool loadDataSource(const DataSourcePtr &source)
bool loadNonOntologySource(const DataSourcePtr &source) const
auto & backendManager() const
KnowledgeBase(const boost::property_tree::ptree &config)
bool removeAllWithOrigin(std::string_view origin)
std::optional< std::string > getVersionOfOrigin(const std::shared_ptr< NamedBackend > &definedBackend, std::string_view origin) const
void finishLoad(const std::shared_ptr< OntologySource > &source, std::string_view origin, std::string_view newVersion)
bool removeAll(const std::vector< TriplePtr > &triples)
bool loadOntologySource(const std::shared_ptr< OntologySource > &source)
std::shared_ptr< StorageManager > backendManager_
bool removeAll(const TripleContainerPtr &triples)
std::shared_ptr< ReasonerManager > reasonerManager_
QueryableBackendPtr getBackendForQuery() const
static std::shared_ptr< KnowledgeBase > create(const boost::property_tree::ptree &config)
void configureReasoner(const boost::property_tree::ptree &config)
TokenBufferPtr submitQuery(const FirstOrderLiteralPtr &query, const QueryContextPtr &ctx)
std::vector< std::shared_ptr< NamedBackend > > prepareLoad(std::string_view origin, std::string_view newVersion) const
static std::shared_ptr< KnowledgeBase > create()
void synchronizeBackends()
TokenBufferPtr submitQuery(const ConjunctiveQueryPtr &conjunctiveQuery)
auto & vocabulary() const
static std::shared_ptr< KnowledgeBase > create(std::string_view config)
std::shared_ptr< NamedBackend > findSourceBackend(const Triple &triple)
std::shared_ptr< StorageInterface > edb_
void synchronizeObservers()
std::shared_ptr< Vocabulary > vocabulary_
void configure(const boost::property_tree::ptree &config)
void configureBackends(const boost::property_tree::ptree &config)
auto & reasonerManager() const
bool insertOne(const Triple &triple)
void configureDataSources(const boost::property_tree::ptree &config)
void setDefaultGraph(std::string_view origin)
bool insertAll(const std::vector< TriplePtr > &triples)
TokenBufferPtr submitQuery(const FormulaPtr &query, const QueryContextPtr &ctx)
std::shared_ptr< ObserverManager > observerManager_
std::shared_ptr< KnowledgeBase > KnowledgeBasePtr
std::shared_ptr< TripleContainer > TripleContainerPtr
std::shared_ptr< Observer > ObserverPtr
std::shared_ptr< Formula > FormulaPtr
std::shared_ptr< ConjunctiveQuery > ConjunctiveQueryPtr
std::shared_ptr< TokenBuffer > TokenBufferPtr
std::function< void(const BindingsPtr &)> BindingsHandler
std::shared_ptr< const QueryContext > QueryContextPtr
std::shared_ptr< GraphQuery > GraphQueryPtr
std::shared_ptr< QueryableStorage > QueryableBackendPtr
std::shared_ptr< DataSource > DataSourcePtr
std::shared_ptr< FirstOrderLiteral > FirstOrderLiteralPtr