summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libs/serialisation/Parser.cpp32
-rw-r--r--src/libs/serialisation/Serialiser.cpp23
-rw-r--r--src/progs/ingen/main.cpp1
3 files changed, 33 insertions, 23 deletions
diff --git a/src/libs/serialisation/Parser.cpp b/src/libs/serialisation/Parser.cpp
index 2817766e..cc8b4e4b 100644
--- a/src/libs/serialisation/Parser.cpp
+++ b/src/libs/serialisation/Parser.cpp
@@ -247,12 +247,12 @@ Parser::parse_patch(
Redland::Query query(*world->rdf_world, Glib::ustring(
"SELECT DISTINCT ?name ?plugin ?varkey ?varval ?poly WHERE {\n") +
subject + " ingen:node ?node .\n"
- "?node ingen:symbol ?name ;\n"
+ "?node lv2:symbol ?name ;\n"
" ingen:plugin ?plugin ;\n"
" ingen:polyphonic ?poly .\n"
- "OPTIONAL { ?node ingen:variable ?variable .\n"
- " ?variable ingen:key ?varkey ;\n"
- " ingen:value ?varval .\n"
+ "OPTIONAL { ?node lv2var:variable ?variable .\n"
+ " ?variable rdf:predicate ?varkey ;\n"
+ " rdf:value ?varval .\n"
" }"
"}");
@@ -289,7 +289,7 @@ Parser::parse_patch(
"SELECT DISTINCT ?subpatch ?symbol WHERE {\n") +
subject + " ingen:node ?subpatch .\n"
"?subpatch a ingen:Patch ;\n"
- " ingen:symbol ?symbol .\n"
+ " lv2:symbol ?symbol .\n"
"}");
results = query.run(*world->rdf_world, model, base_uri);
@@ -315,9 +315,9 @@ Parser::parse_patch(
query = Redland::Query(*world->rdf_world, Glib::ustring(
"SELECT DISTINCT ?nodename ?portname ?portval WHERE {\n") +
subject + " ingen:node ?node .\n"
- "?node ingen:symbol ?nodename ;\n"
+ "?node lv2:symbol ?nodename ;\n"
" ingen:port ?port .\n"
- "?port ingen:symbol ?portname ;\n"
+ "?port lv2:symbol ?portname ;\n"
" ingen:value ?portval .\n"
"FILTER ( datatype(?portval) = xsd:decimal )\n"
"}");
@@ -341,13 +341,13 @@ Parser::parse_patch(
subject + " ingen:port ?port .\n"
"?port a ?type ;\n"
" a ?datatype ;\n"
- " ingen:symbol ?name .\n"
+ " lv2:symbol ?name .\n"
" FILTER (?type != ?datatype && ((?type = ingen:InputPort) || (?type = ingen:OutputPort)))\n"
"OPTIONAL { ?port ingen:value ?portval . \n"
" FILTER ( datatype(?portval) = xsd:decimal ) }\n"
- "OPTIONAL { ?port ingen:variable ?variable .\n"
- " ?variable ingen:key ?varkey ;\n"
- " ingen:value ?varval .\n"
+ "OPTIONAL { ?port lv2var:variable ?variable .\n"
+ " ?variable rdf:predicate ?varkey ;\n"
+ " rdf:value ?varval .\n"
" }"
"}");
@@ -525,9 +525,9 @@ Parser::parse_variables(
{
Redland::Query query(*world->rdf_world, Glib::ustring(
"SELECT DISTINCT ?varkey ?varval WHERE {\n") +
- subject + " ingen:variable ?variable .\n"
- "?variable ingen:key ?varkey ;\n"
- " ingen:value ?varval .\n"
+ subject + " lv2var:variable ?variable .\n"
+ "?variable rdf:predicate ?varkey ;\n"
+ " rdf:value ?varval .\n"
"}");
Redland::Query::Results results = query.run(*world->rdf_world, model, base_uri);
@@ -541,8 +541,8 @@ Parser::parse_variables(
query = Redland::Query(*world->rdf_world, Glib::ustring(
"SELECT DISTINCT ?key ?val WHERE {\n") +
subject + " ingen:property ?property .\n"
- "?property ingen:key ?key ;\n"
- " ingen:value ?val .\n"
+ "?property rdf:predicate ?key ;\n"
+ " rdf:value ?val .\n"
"}");
results = query.run(*world->rdf_world, model, base_uri);
diff --git a/src/libs/serialisation/Serialiser.cpp b/src/libs/serialisation/Serialiser.cpp
index 5f4c0cbf..2f0d9877 100644
--- a/src/libs/serialisation/Serialiser.cpp
+++ b/src/libs/serialisation/Serialiser.cpp
@@ -302,9 +302,15 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch)
"rdf:type",
Redland::Node(_model->world(), Redland::Node::RESOURCE, "http://drobilla.net/ns/ingen#Patch"));
- if (patch->path() != "/") {
+ GraphObject::Variables::const_iterator s = patch->variables().find("lv2:symbol");
+ // If symbol is stored as a variable, write that
+ if (s != patch->variables().end()) {
+ _model->add_statement(patch_id, "lv2:symbol",
+ Redland::Node(_model->world(), Redland::Node::LITERAL, s->second.get_string()));
+ // Otherwise take the one from our path (if possible)
+ } else if (patch->path() != "/") {
_model->add_statement(
- patch_id, "ingen:symbol",
+ patch_id, "lv2:symbol",
Redland::Node(_model->world(), Redland::Node::LITERAL, patch->path().name()));
}
@@ -379,7 +385,7 @@ Serialiser::serialise_node(SharedPtr<Shared::Node> node, const Redland::Node& no
_model->add_statement(
node_id,
- "ingen:symbol",
+ "lv2:symbol",
Redland::Node(_model->world(), Redland::Node::LITERAL, node->path().name()));
_model->add_statement(
@@ -419,8 +425,11 @@ Serialiser::serialise_port(const Port* port, const Redland::Node& port_id)
else
_model->add_statement(port_id, "rdf:type",
Redland::Node(_model->world(), Redland::Node::RESOURCE, "ingen:OutputPort"));
+
+ _model->add_statement(port_id, "lv2:index",
+ AtomRDF::atom_to_node(_model->world(), Atom((int)port->index())));
- _model->add_statement(port_id, "ingen:symbol",
+ _model->add_statement(port_id, "lv2:symbol",
Redland::Node(_model->world(), Redland::Node::LITERAL, port->path().name()));
_model->add_statement(port_id, "rdf:type",
@@ -471,9 +480,9 @@ Serialiser::serialise_variables(Redland::Node subject, const GraphObject::Variab
const Redland::Node key(_model->world(), Redland::Node::RESOURCE, v->first);
const Redland::Node value = AtomRDF::atom_to_node(_model->world(), v->second);
if (value) {
- _model->add_statement(subject, "ingen:variable", var_id);
- _model->add_statement(var_id, "ingen:key", key);
- _model->add_statement(var_id, "ingen:value", value);
+ _model->add_statement(subject, "lv2var:variable", var_id);
+ _model->add_statement(var_id, "rdf:predicate", key);
+ _model->add_statement(var_id, "rdf:value", value);
} else {
cerr << "Warning: can not serialise value: key '" << v->first << "', type "
<< (int)v->second.type() << endl;
diff --git a/src/progs/ingen/main.cpp b/src/progs/ingen/main.cpp
index 12257021..d0efb113 100644
--- a/src/progs/ingen/main.cpp
+++ b/src/progs/ingen/main.cpp
@@ -96,6 +96,7 @@ main(int argc, char** argv)
world->rdf_world->add_prefix("ingen", "http://drobilla.net/ns/ingen#");
world->rdf_world->add_prefix("ingenuity", "http://drobilla.net/ns/ingenuity#");
world->rdf_world->add_prefix("lv2", "http://lv2plug.in/ns/lv2core#");
+ world->rdf_world->add_prefix("lv2var", "http://lv2plug.in/ns/ext/instance-var#");
world->rdf_world->add_prefix("lv2_midi", "http://lv2plug.in/ns/ext/midi");
world->rdf_world->add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
world->rdf_world->add_prefix("doap", "http://usefulinc.com/ns/doap#");