summaryrefslogtreecommitdiffstats
path: root/src/serialisation
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-16 06:27:22 +0000
committerDavid Robillard <d@drobilla.net>2008-11-16 06:27:22 +0000
commit18a76e65f5a40c2dd8f01050ab41390b8a74ce01 (patch)
tree99f4397e176330592b4a05e3ba01049b991dcfbe /src/serialisation
parent0fd3c583e032a3cd5af877902d4561a45179a232 (diff)
downloadingen-18a76e65f5a40c2dd8f01050ab41390b8a74ce01.tar.gz
ingen-18a76e65f5a40c2dd8f01050ab41390b8a74ce01.tar.bz2
ingen-18a76e65f5a40c2dd8f01050ab41390b8a74ce01.zip
Monitoring deletion and variable setting (e.g. moving stuff on the canvas) via HTTP.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1723 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/serialisation')
-rw-r--r--src/serialisation/Parser.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 00034554..ec30ff19 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -123,14 +123,49 @@ Parser::parse(
Glib::ustring query_str;
if (object_uri && object_uri.get()[0] == '/')
object_uri = object_uri.get().substr(1);
+
+ // Delete anything explicitly declared to not exist
+ query_str = Glib::ustring("SELECT DISTINCT ?o WHERE { ?o a owl:Nothing }");
+ Redland::Query query(*world->rdf_world, query_str);
+ Redland::Query::Results results = query.run(*world->rdf_world, model, base_uri);
+
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ const Redland::Node& object = (*i)["o"];
+ target->destroy(object.to_string());
+ }
+
+ // 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"
+ "}");
+
+ results = Redland::Query::Results(query.run(*world->rdf_world, model, base_uri));
+ world->rdf_world->mutex().lock();
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ 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"];
+
+ cout << "VALUE: " << val_node.to_string() << endl;
+ cout << "TYPE: " << AtomRDF::node_to_atom(val_node).type() << endl;
+ cout << "ATOM: " << AtomRDF::node_to_atom(val_node).get_float() << endl;
+
+ if (key != "")
+ target->set_variable(obj_path, key, AtomRDF::node_to_atom(val_node));
+ }
+ world->rdf_world->mutex().unlock();
+
if (object_uri)
query_str = Glib::ustring("SELECT DISTINCT ?class WHERE { <") + object_uri.get() + "> a ?class . }";
else
query_str = Glib::ustring("SELECT DISTINCT ?subject ?class WHERE { ?subject a ?class . }");
- Redland::Query query(*world->rdf_world, query_str);
- Redland::Query::Results results = query.run(*world->rdf_world, model, base_uri);
+ query = Redland::Query(*world->rdf_world, query_str);
+ results = Redland::Query::Results(query.run(*world->rdf_world, model, base_uri));
const Redland::Node patch_class(*world->rdf_world, res, NS_INGEN "Patch");
const Redland::Node node_class(*world->rdf_world, res, NS_INGEN "Node");
@@ -277,6 +312,7 @@ Parser::parse_patch(
//if (patch_path != "/")
target->new_patch(patch_path, patch_poly);
+
/* Plugin nodes */
Redland::Query query(*world->rdf_world, Glib::ustring(