From 19928bb583e72802746b89e322f71ecc0fcb7427 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 13 May 2009 04:05:32 +0000 Subject: The great ID refactoring of 2009. Path is now actually URI (scheme path: for now). Therefore ingen nodes and such live in the same namespace as ... well, everything. Including plugins. Thar be profit, laddies. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1992 a436a847-0d15-0410-975c-d299462d15a1 --- src/serialisation/Serialiser.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/serialisation/Serialiser.cpp') diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index a1f4f902..cb598eb7 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -145,7 +145,7 @@ Serialiser::to_string(SharedPtr object, Redland::Resource base_rdf_node(_model->world(), base_uri); for (GraphObject::Properties::const_iterator v = extra_rdf.begin(); v != extra_rdf.end(); ++v) { if (v->first.find(":") != string::npos) { - _model->add_statement(base_rdf_node, v->first, + _model->add_statement(base_rdf_node, v->first.str(), AtomRDF::atom_to_node(_model->world(), v->second)); } else { cerr << "Warning: not serialising extra RDF with key '" << v->first << "'" << endl; @@ -227,7 +227,7 @@ Redland::Node Serialiser::instance_rdf_node(const Path& path) { assert(_model); - assert(path.substr(0, _root_path.length()) == _root_path); + assert(path.is_child_of(_root_path)); if (path == _root_path) return Redland::Resource(_model->world(), _base_uri); @@ -241,7 +241,7 @@ Redland::Node Serialiser::class_rdf_node(const Path& path) { assert(_model); - assert(path.substr(0, _root_path.length()) == _root_path); + assert(path.is_child_of(_root_path)); if (path == _root_path) return Redland::Resource(_model->world(), _base_uri); @@ -272,7 +272,7 @@ Serialiser::serialise(SharedPtr object) throw (std::logic_error) SharedPtr node = PtrCast(object); if (node) { - const Redland::Resource plugin_id(_model->world(), node->plugin()->uri()); + const Redland::Resource plugin_id(_model->world(), node->plugin()->uri().str()); serialise_node(node, plugin_id, instance_rdf_node(node->path())); return; } @@ -305,7 +305,7 @@ Serialiser::serialise_patch(SharedPtr patch, const Redland::Node& _model->add_statement(patch_id, "lv2:symbol", Redland::Literal(_model->world(), s->second.get_string())); // Otherwise take the one from our path (if possible) - } else if (patch->path() != "/") { + } else if (!patch->path().is_root()) { _model->add_statement(patch_id, "lv2:symbol", Redland::Literal(_model->world(), patch->path().name())); } else { @@ -329,7 +329,7 @@ Serialiser::serialise_patch(SharedPtr patch, const Redland::Node& serialise_patch(patch, class_id); serialise_node(patch, class_id, node_id); } else if (node) { - const Redland::Resource class_id(_model->world(), node->plugin()->uri()); + const Redland::Resource class_id(_model->world(), node->plugin()->uri().str()); const Redland::Node node_id(instance_rdf_node(n->second->path())); _model->add_statement(patch_id, "ingen:node", node_id); serialise_node(node, class_id, node_id); @@ -364,7 +364,7 @@ Serialiser::serialise_plugin(const Shared::Plugin& plugin) { assert(_model); - const Redland::Node plugin_id = Redland::Resource(_model->world(), plugin.uri()); + const Redland::Node plugin_id = Redland::Resource(_model->world(), plugin.uri().str()); _model->add_statement(plugin_id, "rdf:type", Redland::Resource(_model->world(), plugin.type_uri())); @@ -480,7 +480,7 @@ Serialiser::serialise_properties(Redland::Node subject, const GraphObject::Prope for (GraphObject::Properties::const_iterator v = properties.begin(); v != properties.end(); ++v) { if (v->first.find(":") && v->second.is_valid()) { const Redland::Node value = AtomRDF::atom_to_node(_model->world(), v->second); - _model->add_statement(subject, v->first, value); + _model->add_statement(subject, v->first.str(), value); } else { cerr << "Warning: unable to serialize property \'" << v->first << "\'" << endl; } @@ -492,9 +492,9 @@ void Serialiser::serialise_variables(Redland::Node subject, const GraphObject::Properties& variables) { for (GraphObject::Properties::const_iterator v = variables.begin(); v != variables.end(); ++v) { - if (v->first.find(":") && v->first != "ingen:document") { + if (v->first.find(":") && v->first.str() != "ingen:document") { if (v->second.is_valid()) { - const Redland::Resource key(_model->world(), v->first); + const Redland::Resource key(_model->world(), v->first.str()); const Redland::Node value = AtomRDF::atom_to_node(_model->world(), v->second); if (value.is_valid()) { _model->add_statement(subject, key, value); -- cgit v1.2.1