diff options
Diffstat (limited to 'src/serialisation')
-rw-r--r-- | src/serialisation/Parser.cpp | 40 | ||||
-rw-r--r-- | src/serialisation/Parser.hpp | 2 | ||||
-rw-r--r-- | src/serialisation/Serialiser.cpp | 22 | ||||
-rw-r--r-- | src/serialisation/Serialiser.hpp | 6 |
4 files changed, 36 insertions, 34 deletions
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index 3b1e2d47..d1e16664 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -158,7 +158,7 @@ Parser::parse_document( = parse(world, target, model, document_uri, data_path, parent, symbol, data); if (parsed_path) { - target->set_variable(*parsed_path, "ingen:document", Atom(document_uri.c_str())); + target->set_property(*parsed_path, "ingen:document", Atom(document_uri.c_str())); } else { cerr << "WARNING: document URI lost" << endl; } @@ -218,22 +218,20 @@ Parser::parse_update( // Variable settings query = Redland::Query(*world->rdf_world, - "SELECT DISTINCT ?path ?varkey ?varval WHERE {\n" - "?path lv2var:variable ?variable .\n" - "?variable rdf:predicate ?varkey ;\n" - " rdf:value ?varval .\n" + "SELECT DISTINCT ?s ?p ?o WHERE {\n" + "?s ?p ?o .\n" "}"); results = Redland::Query::Results(query.run(*world->rdf_world, model, base_uri)); for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) { Glib::Mutex::Lock lock(world->rdf_world->mutex()); - const string obj_path = (*i)["path"].to_string(); - const string key = world->rdf_world->prefixes().qualify((*i)["varkey"].to_string()); - const Redland::Node& val_node = (*i)["varval"]; - const Atom a(AtomRDF::node_to_atom(val_node)); + const string obj_uri((*i)["s"].to_string()); + const string key(world->rdf_world->prefixes().qualify((*i)["p"].to_string())); + const Redland::Node& val_node((*i)["o"]); + const Atom a(AtomRDF::node_to_atom(val_node)); if (key != "") - target->set_variable(obj_path, key, a); + target->set_property(obj_uri, key, a); } @@ -514,7 +512,7 @@ Parser::parse_patch( Glib::Mutex::Lock lock(world->rdf_world->mutex()); for (Properties::iterator j = i->second.begin(); j != i->second.end(); ++j) { const string key = world->rdf_world->prefixes().qualify(j->first); - target->set_variable(node_path, key, AtomRDF::node_to_atom(j->second)); + target->set_property(node_path, key, AtomRDF::node_to_atom(j->second)); } } @@ -531,7 +529,7 @@ Parser::parse_patch( Glib::Mutex::Lock lock(world->rdf_world->mutex()); for (Properties::iterator j = i->second.begin(); j != i->second.end(); ++j) { const string key = world->rdf_world->prefixes().qualify(j->first); - target->set_variable(node_path, key, AtomRDF::node_to_atom(j->second)); + target->set_property(node_path, key, AtomRDF::node_to_atom(j->second)); } } @@ -560,7 +558,7 @@ Parser::parse_patch( if (key == "ingen:value") { target->set_port_value(port_path, AtomRDF::node_to_atom((*i)["val"])); } else { - target->set_variable(port_path, key, AtomRDF::node_to_atom((*i)["val"])); + target->set_property(port_path, key, AtomRDF::node_to_atom((*i)["val"])); } } @@ -637,7 +635,7 @@ Parser::parse_patch( } parse_connections(world, target, model, subject, "/"); - parse_variables(world, target, model, subject_node, patch_path, data); + parse_properties(world, target, model, subject_node, patch_path, data); /* Enable */ @@ -651,7 +649,7 @@ Parser::parse_patch( Glib::Mutex::Lock lock(world->rdf_world->mutex()); const Redland::Node& enabled_node = (*i)["enabled"]; if (enabled_node.is_bool() && enabled_node) { - target->set_variable(patch_path, "ingen:enabled", (bool)true); + target->set_property(patch_path, "ingen:enabled", (bool)true); break; } else { cerr << "WARNING: Unknown type for ingen:enabled" << endl; @@ -696,7 +694,7 @@ Parser::parse_node( props.insert(make_pair("rdf:instanceOf", Raul::Atom(Raul::Atom::URI, plugin_uri))); target->put(path, props); - parse_variables(world, target, model, subject, path, data); + parse_properties(world, target, model, subject, path, data); return path; } @@ -737,7 +735,7 @@ Parser::parse_port( target->set_port_value(path, AtomRDF::node_to_atom(val_node)); } - parse_variables(world, target, model, subject_node, path, data); + parse_properties(world, target, model, subject_node, path, data); return path; #endif cerr << "PARSE PORT" << endl; @@ -780,7 +778,7 @@ Parser::parse_connections( bool -Parser::parse_variables( +Parser::parse_properties( Ingen::Shared::World* world, Ingen::Shared::CommonInterface* target, Redland::Model& model, @@ -801,14 +799,14 @@ Parser::parse_variables( const string key = world->rdf_world->prefixes().qualify(string((*i)["key"])); const Redland::Node& val = (*i)["val"]; if (key != "") - target->set_variable(path, key, AtomRDF::node_to_atom(val)); + target->set_property(path, key, AtomRDF::node_to_atom(val)); } - // Set passed variables last to override any loaded values + // Set passed properties last to override any loaded values if (data) for (GraphObject::Properties::const_iterator i = data.get().begin(); i != data.get().end(); ++i) - target->set_variable(path, i->first, i->second); + target->set_property(path, i->first, i->second); return true; } diff --git a/src/serialisation/Parser.hpp b/src/serialisation/Parser.hpp index 61281339..b980a4fc 100644 --- a/src/serialisation/Parser.hpp +++ b/src/serialisation/Parser.hpp @@ -103,7 +103,7 @@ private: const Raul::Path& path, boost::optional<Properties> data=boost::optional<Properties>()); - bool parse_variables( + bool parse_properties( Ingen::Shared::World* world, Ingen::Shared::CommonInterface* target, Redland::Model& model, diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index ac18455e..231d19fa 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -316,7 +316,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node& cerr << "WARNING: Patch has no lv2:symbol" << endl; } - serialise_properties(patch_id, patch->properties()); + serialise_meta_properties(patch_id, patch->properties()); for (GraphObject::const_iterator n = _store->children_begin(patch); n != _store->children_end(patch); ++n) { @@ -354,7 +354,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node& p->set_property("lv2:name", Atom(Atom::STRING, p->symbol())); _model->add_statement(patch_id, "lv2:port", port_id); - serialise_port_class(p, port_id); + serialise_port_meta(p, port_id); } for (Shared::Patch::Connections::const_iterator c = patch->connections().begin(); @@ -394,7 +394,7 @@ Serialiser::serialise_node(SharedPtr<Shared::Node> node, _model->add_statement(node_id, "lv2:port", port_id); } - serialise_variables(node_id, node->variables()); + serialise_properties(node_id, node->properties()); } @@ -420,13 +420,13 @@ Serialiser::serialise_port(const Port* port, const Redland::Node& port_id) _model->add_statement(port_id, "ingen:value", AtomRDF::atom_to_node(_model->world(), Atom(port->value()))); - serialise_variables(port_id, port->variables()); + serialise_properties(port_id, port->properties()); } /** Serialise a port on a Patch */ void -Serialiser::serialise_port_class(const Port* port, const Redland::Node& port_id) +Serialiser::serialise_port_meta(const Port* port, const Redland::Node& port_id) { if (port->is_input()) _model->add_statement(port_id, "rdf:type", @@ -452,7 +452,7 @@ Serialiser::serialise_port_class(const Port* port, const Redland::Node& port_id) } } - serialise_properties(port_id, port->properties()); + serialise_meta_properties(port_id, port->properties()); } @@ -480,7 +480,9 @@ Serialiser::serialise_connection(SharedPtr<GraphObject> parent, void -Serialiser::serialise_properties(Redland::Node subject, const GraphObject::Properties& properties) +Serialiser::serialise_meta_properties( + Redland::Node subject, + const GraphObject::Properties& properties) { for (GraphObject::Properties::const_iterator v = properties.begin(); v != properties.end(); ++v) { if (v->first.find(":") && v->second.is_valid()) { @@ -494,9 +496,11 @@ Serialiser::serialise_properties(Redland::Node subject, const GraphObject::Prope void -Serialiser::serialise_variables(Redland::Node subject, const GraphObject::Properties& variables) +Serialiser::serialise_properties( + Redland::Node subject, + const GraphObject::Properties& properties) { - for (GraphObject::Properties::const_iterator v = variables.begin(); v != variables.end(); ++v) { + for (GraphObject::Properties::const_iterator v = properties.begin(); v != properties.end(); ++v) { if (v->first.find(":") && v->first.str() != "ingen:document") { if (v->second.is_valid()) { const Redland::Resource key(_model->world(), v->first.str()); diff --git a/src/serialisation/Serialiser.hpp b/src/serialisation/Serialiser.hpp index 6ecfec46..4264f05e 100644 --- a/src/serialisation/Serialiser.hpp +++ b/src/serialisation/Serialiser.hpp @@ -97,10 +97,10 @@ private: void serialise_node(SharedPtr<Shared::Node> n, const Redland::Node& class_id, const Redland::Node& id); void serialise_port(const Shared::Port* p, const Redland::Node& id); - void serialise_port_class(const Shared::Port* p, const Redland::Node& id); + void serialise_port_meta(const Shared::Port* p, const Redland::Node& id); - void serialise_properties(Redland::Node subject, const Properties& properties); - void serialise_variables(Redland::Node subject, const Properties& variables); + void serialise_meta_properties(Redland::Node subject, const Properties& properties); + void serialise_properties(Redland::Node subject, const Properties& variables); Redland::Node instance_rdf_node(const Raul::Path& path); Redland::Node class_rdf_node(const Raul::Path& path); |