knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
OntologySource.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_ONTOLOGY_SOURCE_H
7 #define KNOWROB_ONTOLOGY_SOURCE_H
8 
9 #include "knowrob/DataSource.h"
10 #include "knowrob/semweb/GraphSelector.h"
11 #include "knowrob/semweb/TripleContainer.h"
12 
13 namespace knowrob {
17  class OntologySource : public DataSource {
18  public:
19  OntologySource(const URI &uri, std::string_view format)
22 
23  virtual ~OntologySource() = default;
24 
26 
27  const auto &frame() const { return frame_; }
28 
34 
38  auto &parentOrigin() const { return parentOrigin_; }
39 
43  std::string_view origin() const { return origin_; }
44 
50  virtual bool load(const TripleHandler &callback) = 0;
51 
55  const auto &imports() const { return imports_; }
56 
60  void setImports(const std::vector<std::string> &imports) { imports_ = imports; }
61 
62  protected:
64  std::optional<std::string> parentOrigin_;
66  std::vector<std::string> imports_;
67  };
68 
69 } // knowrob
70 
71 #endif //KNOWROB_ONTOLOGY_SOURCE_H
static std::string getNameFromURI(const std::string &uriString)
Definition: DataSource.cpp:36
const auto & format() const
Definition: DataSource.h:49
const auto & uri() const
Definition: DataSource.h:39
std::optional< std::string > parentOrigin_
void setFrame(const GraphSelectorPtr &frame)
void setParentOrigin(std::string_view parentOrigin)
GraphSelectorPtr frame_
OntologySource(const URI &uri, std::string_view format)
virtual ~OntologySource()=default
virtual bool load(const TripleHandler &callback)=0
const auto & frame() const
std::string_view origin() const
void setImports(const std::vector< std::string > &imports)
const auto & imports() const
auto & parentOrigin() const
std::vector< std::string > imports_
TermRule & string()
Definition: terms.cpp:63
DataSourceType
Definition: DataSource.h:17
std::shared_ptr< const GraphSelector > GraphSelectorPtr
Definition: GraphSelector.h:76
std::function< void(const TripleContainerPtr &)> TripleHandler