6 #include "knowrob/semweb/GraphRenaming.h"
7 #include "knowrob/Logger.h"
13 #define GRAPH_RENAMING_SETTING_FILE "file"
16 : renaming_(std::move(renaming)) {
29 }
catch (
const std::exception &e) {
30 KB_WARN(
"Error reading renaming from file {}: {}", *o_user, e.what());
38 std::ifstream file(filename);
41 while (std::getline(file, line)) {
42 std::istringstream iss(line);
45 if (!(iss >> key >> value)) {
46 KB_WARN(
"Error reading renaming from file {}: Unexpected file format.", filename);
80 if (triples->isMutable()) {
81 auto mutableTriples = std::static_pointer_cast<MutableTripleContainer>(triples);
82 for (
auto it = mutableTriples->begin(); it != mutableTriples->end(); ++it) {
86 KB_WARN(
"Input triples are not mutable which is currently required for renaming.");
#define GRAPH_RENAMING_SETTING_FILE
bool readFromFile(const std::string &filename)
void pushInputTriples(const TripleContainerPtr &triples) override
void finalizeTransformation() override
void initializeTransformation() override
std::string_view rename(const std::string_view &entity)
bool configure(const boost::property_tree::ptree &opts) override
GraphRenamingMap renaming_
void addRenaming(std::string_view from, std::string_view to)
virtual std::string_view valueAsString() const =0
virtual void setSubject(std::string_view subject)=0
virtual std::string_view subject() const =0
virtual std::string_view predicate() const =0
virtual void setObjectIRI(std::string_view object)=0
virtual void setPredicate(std::string_view predicate)=0
std::shared_ptr< TripleContainer > TripleContainerPtr
std::map< std::string, std::string, std::less<> > GraphRenamingMap