knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
GraphRenaming.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_GRAPH_RENAMING_H
7 #define KNOWROB_GRAPH_RENAMING_H
8 
9 #include "string"
10 #include "map"
11 #include "GraphTransformation.h"
12 #include "knowrob/semweb/Triple.h"
13 
14 namespace knowrob {
18  using GraphRenamingMap = std::map<std::string, std::string, std::less<>>;
19 
23  class GraphRenaming : public GraphTransformation {
24  public:
25  GraphRenaming() = default;
26 
31  explicit GraphRenaming(GraphRenamingMap renaming);
32 
38  std::string_view rename(const std::string_view &entity);
39 
44  void rename(Triple &triple);
45 
51  void addRenaming(std::string_view from, std::string_view to);
52 
53  // override GraphTransformation
54  bool configure(const boost::property_tree::ptree &opts) override;
55 
56  protected:
58 
59  bool readFromFile(const std::string &filename);
60 
61  // override GraphTransformation
62  void initializeTransformation() override;
63 
64  // override GraphTransformation
65  void finalizeTransformation() override;
66 
67  // override GraphTransformation
68  void pushInputTriples(const TripleContainerPtr &triples) override;
69  };
70 
71 } // knowrob
72 
73 #endif //KNOWROB_GRAPH_RENAMING_H
void pushInputTriples(const TripleContainerPtr &triples) override
void initializeTransformation() override
bool configure(const boost::property_tree::ptree &opts) override
void addRenaming(std::string_view from, std::string_view to)
void rename(Triple &triple)
void finalizeTransformation() override
std::string_view rename(const std::string_view &entity)
GraphRenaming(GraphRenamingMap renaming)
bool readFromFile(const std::string &filename)
GraphRenamingMap renaming_
Definition: GraphRenaming.h:57
TermRule & string()
Definition: terms.cpp:63
std::shared_ptr< TripleContainer > TripleContainerPtr
std::map< std::string, std::string, std::less<> > GraphRenamingMap
Definition: GraphRenaming.h:18