summaryrefslogtreecommitdiffstats
path: root/src/serialisation
diff options
context:
space:
mode:
Diffstat (limited to 'src/serialisation')
-rw-r--r--src/serialisation/Parser.cpp15
-rw-r--r--src/serialisation/Serialiser.cpp15
-rw-r--r--src/serialisation/Serialiser.hpp2
3 files changed, 17 insertions, 15 deletions
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 24da2567..835057bc 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -26,6 +26,7 @@
#include "raul/Atom.hpp"
#include "raul/AtomRDF.hpp"
#include "interface/EngineInterface.hpp"
+#include "shared/LV2URIMap.hpp"
#include "Parser.hpp"
#define LOG(s) s << "[Parser] "
@@ -208,7 +209,7 @@ Parser::parse_update(
const string obj_path = (*i)["path"].to_string();
const Redland::Node& val_node = (*i)["value"];
const Atom a(AtomRDF::node_to_atom(val_node));
- target->set_property(obj_path, "ingen:value", a);
+ target->set_property(obj_path, world->uris->ingen_value, a);
}
return parse(world, target, model, base_uri, data_path, parent, symbol, data);
@@ -279,8 +280,8 @@ Parser::parse(
}
string path = (parent && symbol)
- ? parent->base() + *symbol
- : (parent ? parent->base() : "/") + path_str.substr(path_str.find("/")+1);
+ ? parent->child(*symbol).str()
+ : (parent ? *parent : Path("/")).child(path_str.substr(path_str.find("/")+1)).str();
if (!Path::is_valid(path)) {
LOG(warn) << "Invalid path '" << path << "' transformed to /" << endl;
@@ -307,7 +308,7 @@ Parser::parse(
string subject_str = subject.to_string();
if (URI::is_valid(subject_str)) {
if (subject == document_uri)
- subject_str = Path::root_uri;
+ subject_str = Path::root.str();
parse_properties(world, target, model, subject, subject_str);
}
}
@@ -364,7 +365,7 @@ Parser::parse_patch(
string symbol;
if (a_symbol) {
- symbol = *a_symbol;
+ symbol = a_symbol->c_str();
} else { // Guess symbol from base URI (filename) if we need to
symbol = base_uri.substr(base_uri.find_last_of("/") + 1);
symbol = symbol.substr(0, symbol.find("."));
@@ -470,7 +471,7 @@ Parser::parse_patch(
Resources::iterator res_i = resources.find(type_i->second);
if (res_i == resources.end())
continue;
- parse_patch(world, target, model, res_i->second, patch_path, Symbol(node_path.name()));
+ parse_patch(world, target, model, res_i->second, patch_path, Symbol(node_path.symbol()));
Glib::Mutex::Lock lock(world->rdf_world->mutex());
target->put(node_path, i->second);
}
@@ -513,7 +514,7 @@ Parser::parse_patch(
const Path node_path(relative_uri(base_uri, node_uri, true));
const Symbol port_sym = port_uri.substr(node_uri.length() + 1);
- const Path port_path = node_path.base() + port_sym;
+ const Path port_path = node_path.child(port_sym);
const string key = world->rdf_world->qualify((*i)["key"].to_string());
p->second.insert(make_pair(key, AtomRDF::node_to_atom((*i)["val"])));
}
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index 97b84e4e..86264900 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -45,6 +45,7 @@
#include "interface/Port.hpp"
#include "interface/Connection.hpp"
#include "shared/ResourceImpl.hpp"
+#include "shared/LV2URIMap.hpp"
#include "Serialiser.hpp"
#define LOG(s) s << "[Serialiser] "
@@ -65,7 +66,7 @@ namespace Serialisation {
Serialiser::Serialiser(Shared::World& world, SharedPtr<Shared::Store> store)
: _root_path("/")
, _store(store)
- , _world(*world.rdf_world)
+ , _world(world)
{
}
@@ -176,7 +177,7 @@ Serialiser::start_to_filename(const string& filename)
_base_uri = "file://" + filename;
else
_base_uri = filename;
- _model = new Redland::Model(_world);
+ _model = new Redland::Model(*_world.rdf_world);
_model->set_base_uri(_base_uri);
_mode = TO_FILE;
}
@@ -199,7 +200,7 @@ Serialiser::start_to_string(const Raul::Path& root, const string& base_uri)
_root_path = root;
_base_uri = base_uri;
- _model = new Redland::Model(_world);
+ _model = new Redland::Model(*_world.rdf_world);
_model->set_base_uri(base_uri);
_mode = TO_STRING;
}
@@ -314,7 +315,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node&
// Otherwise take the one from our path (if possible)
} else if (!patch->path().is_root()) {
_model->add_statement(patch_id, "lv2:symbol",
- Redland::Literal(_model->world(), patch->path().name()));
+ Redland::Literal(_model->world(), patch->path().symbol()));
} else {
LOG(warn) << "Patch has no lv2:symbol" << endl;
}
@@ -354,7 +355,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node&
// Ensure lv2:name always exists so Patch is a valid LV2 plugin
if (p->properties().find("lv2:name") == p->properties().end())
- p->set_property("lv2:name", Atom(Atom::STRING, p->symbol()));
+ p->set_property("lv2:name", Atom(p->symbol().c_str()));
_model->add_statement(patch_id, "lv2:port", port_id);
serialise_port_meta(p, port_id);
@@ -390,7 +391,7 @@ Serialiser::serialise_node(SharedPtr<Shared::Node> node,
_model->add_statement(node_id, "rdf:instanceOf",
class_id);
_model->add_statement(node_id, "lv2:symbol",
- Redland::Literal(_model->world(), node->path().name()));
+ Redland::Literal(_model->world(), node->path().symbol()));
serialise_properties(node_id, &node->meta(), node->properties());
@@ -476,7 +477,7 @@ Serialiser::serialise_connection(SharedPtr<GraphObject> parent,
? instance_rdf_node(connection->dst_port_path())
: class_rdf_node(connection->dst_port_path());
- const Redland::Node connection_node = _world.blank_id();
+ const Redland::Node connection_node = _world.rdf_world->blank_id();
_model->add_statement(connection_node, "ingen:source", src_node);
_model->add_statement(connection_node, "ingen:destination", dst_node);
if (parent) {
diff --git a/src/serialisation/Serialiser.hpp b/src/serialisation/Serialiser.hpp
index b4e148e1..757f5efb 100644
--- a/src/serialisation/Serialiser.hpp
+++ b/src/serialisation/Serialiser.hpp
@@ -112,7 +112,7 @@ private:
SharedPtr<Shared::Store> _store;
Mode _mode;
std::string _base_uri;
- Redland::World& _world;
+ Shared::World& _world;
Redland::Model* _model;
#ifdef USE_BLANK_NODES