diff options
author | David Robillard <d@drobilla.net> | 2011-02-15 23:30:14 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-02-15 23:30:14 +0000 |
commit | e58d64653df9b8520f789587b5547fb36bc0788a (patch) | |
tree | d2b83f54ddd0e85c5ba347163ffdd32e57e39fde | |
parent | 570f1c791858aa62afa8278f4823719aa22501c5 (diff) | |
download | ingen-e58d64653df9b8520f789587b5547fb36bc0788a.tar.gz ingen-e58d64653df9b8520f789587b5547fb36bc0788a.tar.bz2 ingen-e58d64653df9b8520f789587b5547fb36bc0788a.zip |
Remove fuzzy lack of distinction between URIs and CURIEs.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2954 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/client/HTTPEngineSender.cpp | 2 | ||||
-rw-r--r-- | src/client/PluginModel.cpp | 3 | ||||
-rw-r--r-- | src/engine/HTTPClientSender.cpp | 2 | ||||
-rw-r--r-- | src/gui/PropertiesWindow.cpp | 4 | ||||
-rw-r--r-- | src/serialisation/Parser.cpp | 7 | ||||
-rw-r--r-- | src/serialisation/Serialiser.cpp | 173 |
6 files changed, 132 insertions, 59 deletions
diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp index 7f41dca0..cc0d31a0 100644 --- a/src/client/HTTPEngineSender.cpp +++ b/src/client/HTTPEngineSender.cpp @@ -125,7 +125,7 @@ HTTPEngineSender::put(const URI& uri, for (Resource::Properties::const_iterator i = properties.begin(); i != properties.end(); ++i) model.add_statement( Redland::Resource(_world, path), - i->first.str(), + AtomRDF::atom_to_node(model, i->first), AtomRDF::atom_to_node(model, i->second)); const string str = model.serialise_to_string("turtle"); diff --git a/src/client/PluginModel.cpp b/src/client/PluginModel.cpp index 7515e997..08e9dad6 100644 --- a/src/client/PluginModel.cpp +++ b/src/client/PluginModel.cpp @@ -100,8 +100,7 @@ PluginModel::get_property(const URI& key) const #ifdef HAVE_SLV2 if (_slv2_plugin) { boost::optional<Raul::Atom&> ret; - SLV2Value lv2_pred = slv2_value_new_uri(_slv2_world, - _rdf_world->expand_uri(key.str()).c_str()); + SLV2Value lv2_pred = slv2_value_new_uri(_slv2_world, key.str().c_str()); SLV2Values values = slv2_plugin_get_value(_slv2_plugin, lv2_pred); slv2_value_free(lv2_pred); for (unsigned i = 0; i < slv2_values_size(values); ++i) { diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp index 4f2a8ebd..79f64cc1 100644 --- a/src/engine/HTTPClientSender.cpp +++ b/src/engine/HTTPClientSender.cpp @@ -63,7 +63,7 @@ HTTPClientSender::put(const URI& uri, for (Resource::Properties::const_iterator i = properties.begin(); i != properties.end(); ++i) model.add_statement( Redland::Resource(*_engine.world()->rdf_world(), path), - i->first.str(), + AtomRDF::atom_to_node(model, i->first.str()), AtomRDF::atom_to_node(model, i->second)); const string str = model.serialise_to_string("turtle"); diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index 3e4f8907..d6a7d86d 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -99,7 +99,9 @@ PropertiesWindow::set_object(SharedPtr<ObjectModel> model) const Raul::Atom& value = i->second; // Column 0: Property - Gtk::Label* lab = manage(new Gtk::Label(world->rdf_world()->qualify(i->first.str()), 0.0, 0.5)); + Gtk::Label* lab = manage( + new Gtk::Label(world->rdf_world()->prefixes().qualify(i->first.str()), + 0.0, 0.5)); _table->attach(*lab, 0, 1, n_rows, n_rows + 1, Gtk::FILL|Gtk::SHRINK, Gtk::SHRINK); // Column 1: Type diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index d67f94f7..df97fb78 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -581,10 +581,11 @@ Parser::parse_node( return boost::optional<Path>(); } - const string plugin_uri = world->rdf_world()->expand_uri(plugin_node.to_c_string()); Resource::Properties props; - props.insert(make_pair(uris.rdf_type, Raul::URI(uris.ingen_Node))); - props.insert(make_pair(uris.rdf_instanceOf, Raul::Atom(Raul::Atom::URI, plugin_uri))); + props.insert(make_pair(uris.rdf_type, + Raul::URI(uris.ingen_Node))); + props.insert(make_pair(uris.rdf_instanceOf, + AtomRDF::node_to_atom(model, plugin_node))); target->put(path, props); parse_properties(world, target, model, subject, path, data); diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index b3541bd3..99e8bdc4 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -111,13 +111,21 @@ Serialiser::write_manifest(const std::string& bundle_uri, if (patch) { const std::string filename = uri_to_symbol(i->uri) + INGEN_PATCH_FILE_EXT; const Redland::Resource subject(_model->world(), filename); - _model->add_statement(subject, "rdf:type", + _model->add_statement( + subject, + Redland::Curie(_model->world(), "rdf:type"), Redland::Resource(_model->world(), "ingen:Patch")); - _model->add_statement(subject, "rdf:type", + _model->add_statement( + subject, + Redland::Curie(_model->world(), "rdf:type"), Redland::Resource(_model->world(), "lv2:Plugin")); - _model->add_statement(subject, "rdfs:seeAlso", + _model->add_statement( + subject, + Redland::Curie(_model->world(), "rdfs:seeAlso"), Redland::Resource(_model->world(), filename)); - _model->add_statement(subject, "lv2:binary", + _model->add_statement( + subject, + Redland::Curie(_model->world(), "lv2:binary"), Redland::Resource(_model->world(), Glib::Module::build_path("", "ingen_lv2"))); symlink(Glib::Module::build_path(INGEN_MODULE_DIR, "ingen_lv2").c_str(), @@ -161,8 +169,10 @@ Serialiser::to_string(SharedPtr<GraphObject> 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.str(), - AtomRDF::atom_to_node(*_model, v->second)); + _model->add_statement( + base_rdf_node, + AtomRDF::atom_to_node(*_model, v->first), + AtomRDF::atom_to_node(*_model, v->second)); } else { LOG(warn) << "Not serialising extra RDF with key '" << v->first << "'" << endl; } @@ -310,11 +320,15 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node& { assert(_model); - _model->add_statement(patch_id, "rdf:type", - Redland::Resource(_model->world(), "ingen:Patch")); + _model->add_statement( + patch_id, + Redland::Curie(_model->world(), "rdf:type"), + Redland::Resource(_model->world(), "ingen:Patch")); - _model->add_statement(patch_id, "rdf:type", - Redland::Resource(_model->world(), "lv2:Plugin")); + _model->add_statement( + patch_id, + Redland::Curie(_model->world(), "rdf:type"), + Redland::Resource(_model->world(), "lv2:Plugin")); const LV2URIMap& uris = *_world.uris().get(); @@ -326,7 +340,9 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node& || !Symbol::is_valid(s->second.get_string())) { symbol = Glib::path_get_basename(Glib::filename_from_uri(_model->base_uri().to_c_string())); symbol = Symbol::symbolify(symbol.substr(0, symbol.find('.'))); - _model->add_statement(patch_id, uris.lv2_symbol.c_str(), + _model->add_statement( + patch_id, + AtomRDF::atom_to_node(*_model, uris.lv2_symbol.c_str()), Redland::Literal(_model->world(), symbol)); } else { symbol = s->second.get_string(); @@ -334,8 +350,10 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node& // If the patch has no doap:name (required by LV2), use the symbol if (patch->meta().properties().find(uris.doap_name) == patch->meta().properties().end()) - _model->add_statement(patch_id, uris.doap_name.c_str(), - Redland::Literal(_model->world(), symbol)); + _model->add_statement( + patch_id, + AtomRDF::atom_to_node(*_model, uris.doap_name), + Redland::Literal(_model->world(), symbol)); serialise_properties(patch_id, NULL, patch->meta().properties()); @@ -351,13 +369,19 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node& const Redland::Resource class_id(_model->world(), string(META_PREFIX) + subpatch->path().chop_start("/")); const Redland::Node node_id(instance_rdf_node(n->second->path())); - _model->add_statement(patch_id, "ingen:node", node_id); + _model->add_statement( + patch_id, + Redland::Curie(_model->world(), "ingen:node"), + node_id); serialise_patch(subpatch, class_id); serialise_node(subpatch, class_id, node_id); } else if (node) { 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); + _model->add_statement( + patch_id, + Redland::Curie(_model->world(), "ingen:node"), + node_id); serialise_node(node, class_id, node_id); } } @@ -374,7 +398,10 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch, const Redland::Node& if (p->properties().find("http://lv2plug.in/ns/lv2core#name") == p->properties().end()) p->set_property("http://lv2plug.in/ns/lv2core#name", Atom(p->symbol().c_str())); - _model->add_statement(patch_id, "http://lv2plug.in/ns/lv2core#port", port_id); + _model->add_statement( + patch_id, + Redland::Resource(_model->world(), "http://lv2plug.in/ns/lv2core#port"), + port_id); serialise_port_meta(p, port_id); if (root) serialise_properties(port_id, &p->meta(), p->properties()); @@ -394,7 +421,9 @@ Serialiser::serialise_plugin(const Shared::Plugin& plugin) const Redland::Node plugin_id = Redland::Resource(_model->world(), plugin.uri().str()); - _model->add_statement(plugin_id, "rdf:type", + _model->add_statement( + plugin_id, + Redland::Curie(_model->world(), "rdf:type"), Redland::Resource(_model->world(), plugin.type_uri().str())); } @@ -403,12 +432,18 @@ void Serialiser::serialise_node(SharedPtr<Shared::Node> node, const Redland::Node& class_id, const Redland::Node& node_id) { - _model->add_statement(node_id, "rdf:type", - Redland::Resource(_model->world(), "ingen:Node")); - _model->add_statement(node_id, "rdf:instanceOf", - class_id); - _model->add_statement(node_id, "lv2:symbol", - Redland::Literal(_model->world(), node->path().symbol())); + _model->add_statement( + node_id, + Redland::Curie(_model->world(), "rdf:type"), + Redland::Resource(_model->world(), "ingen:Node")); + _model->add_statement( + node_id, + Redland::Curie(_model->world(), "rdf:instanceOf"), + class_id); + _model->add_statement( + node_id, + Redland::Curie(_model->world(), "lv2:symbol"), + Redland::Literal(_model->world(), node->path().symbol())); serialise_properties(node_id, &node->meta(), node->properties()); @@ -416,7 +451,10 @@ Serialiser::serialise_node(SharedPtr<Shared::Node> node, Port* p = node->port(i); const Redland::Node port_id = instance_rdf_node(p->path()); serialise_port(p, port_id); - _model->add_statement(node_id, "lv2:port", port_id); + _model->add_statement( + node_id, + Redland::Curie(_model->world(), "lv2:port"), + port_id); } } @@ -426,23 +464,33 @@ void Serialiser::serialise_port(const Port* port, const Redland::Node& port_id) { if (port->is_input()) - _model->add_statement(port_id, "rdf:type", - Redland::Resource(_model->world(), "lv2:InputPort")); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "rdf:type"), + Redland::Resource(_model->world(), "lv2:InputPort")); else - _model->add_statement(port_id, "rdf:type", - Redland::Resource(_model->world(), "lv2:OutputPort")); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "rdf:type"), + Redland::Resource(_model->world(), "lv2:OutputPort")); for (Port::PortTypes::const_iterator i = port->types().begin(); i != port->types().end(); ++i) - _model->add_statement(port_id, "rdf:type", - Redland::Resource(_model->world(), i->uri().str())); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "rdf:type"), + Redland::Resource(_model->world(), i->uri().str())); if (dynamic_cast<Patch*>(port->graph_parent())) - _model->add_statement(port_id, "rdf:instanceOf", - class_rdf_node(port->path())); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "rdf:instanceOf"), + class_rdf_node(port->path())); - _model->add_statement(port_id, "lv2:symbol", - Redland::Literal(_model->world(), port->path().symbol())); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "lv2:symbol"), + Redland::Literal(_model->world(), port->path().symbol())); serialise_properties(port_id, &port->meta(), port->properties()); } @@ -453,28 +501,40 @@ void Serialiser::serialise_port_meta(const Port* port, const Redland::Node& port_id) { if (port->is_input()) - _model->add_statement(port_id, "rdf:type", - Redland::Resource(_model->world(), "lv2:InputPort")); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "rdf:type"), + Redland::Resource(_model->world(), "lv2:InputPort")); else - _model->add_statement(port_id, "rdf:type", - Redland::Resource(_model->world(), "lv2:OutputPort")); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "rdf:type"), + Redland::Resource(_model->world(), "lv2:OutputPort")); for (Port::PortTypes::const_iterator i = port->types().begin(); i != port->types().end(); ++i) - _model->add_statement(port_id, "rdf:type", - Redland::Resource(_model->world(), i->uri().str())); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "rdf:type"), + Redland::Resource(_model->world(), i->uri().str())); - _model->add_statement(port_id, "lv2:index", - AtomRDF::atom_to_node(*_model, Atom((int)port->index()))); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "lv2:index"), + AtomRDF::atom_to_node(*_model, Atom((int)port->index()))); - _model->add_statement(port_id, "lv2:symbol", - Redland::Literal(_model->world(), port->path().symbol())); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "lv2:symbol"), + Redland::Literal(_model->world(), port->path().symbol())); if (!port->get_property("http://lv2plug.in/ns/lv2core#default").is_valid()) { if (port->is_input()) { if (port->value().is_valid()) { - _model->add_statement(port_id, "lv2:default", - AtomRDF::atom_to_node(*_model, Atom(port->value()))); + _model->add_statement( + port_id, + Redland::Curie(_model->world(), "lv2:default"), + AtomRDF::atom_to_node(*_model, Atom(port->value()))); } else if (port->is_a(PortType::CONTROL)) { LOG(warn) << "Port " << port->path() << " has no lv2:default" << endl; } @@ -501,14 +561,25 @@ Serialiser::serialise_connection(SharedPtr<GraphObject> parent, : class_rdf_node(connection->dst_port_path()); const Redland::Node connection_node = Redland::Node::blank_id(*_world.rdf_world()); - _model->add_statement(connection_node, "ingen:source", src_node); - _model->add_statement(connection_node, "ingen:destination", dst_node); + _model->add_statement( + connection_node, + Redland::Curie(_model->world(), "ingen:source"), + src_node); + _model->add_statement( + connection_node, + Redland::Curie(_model->world(), "ingen:destination"), + dst_node); if (parent) { const Redland::Node parent_node = class_rdf_node(parent->path()); - _model->add_statement(parent_node, "ingen:connection", connection_node); + _model->add_statement( + parent_node, + Redland::Curie(_model->world(), "ingen:connection"), + connection_node); } else { - _model->add_statement(connection_node, "rdf:type", - Redland::Resource(_model->world(), "ingen:Connection")); + _model->add_statement( + connection_node, + Redland::Curie(_model->world(), "rdf:type"), + Redland::Resource(_model->world(), "ingen:Connection")); } } |