summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client/HTTPClientReceiver.cpp1
-rw-r--r--src/engine/HTTPClientSender.cpp21
-rw-r--r--src/ingen/main.cpp1
-rw-r--r--src/serialisation/Parser.cpp40
-rw-r--r--src/shared/HTTPSender.cpp2
5 files changed, 53 insertions, 12 deletions
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp
index b314a7b7..dcb105b0 100644
--- a/src/client/HTTPClientReceiver.cpp
+++ b/src/client/HTTPClientReceiver.cpp
@@ -97,7 +97,6 @@ HTTPClientReceiver::Listener::Listener(HTTPClientReceiver* receiver, const std::
void
HTTPClientReceiver::update(const std::string& str)
{
- cout << "UPDATE: " << str << endl;
cout << _parser->parse_string(_world, _target.get(), str, "/", "/");
}
diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp
index 413dfe7f..652bc1a7 100644
--- a/src/engine/HTTPClientSender.cpp
+++ b/src/engine/HTTPClientSender.cpp
@@ -17,6 +17,7 @@
#include <string>
#include "raul/Atom.hpp"
+#include "raul/AtomRDF.hpp"
#include "serialisation/Serialiser.hpp"
#include "module/World.hpp"
#include "HTTPClientSender.hpp"
@@ -69,8 +70,7 @@ void
HTTPClientSender::destroy(const std::string& path)
{
assert(path != "/");
-
- //send("/ingen/destroyed", "s", path.c_str(), LO_ARGS_END);
+ send_chunk(string("<").append(path).append("> a <http://www.w3.org/2002/07/owl#Nothing> ."));
}
@@ -78,7 +78,6 @@ void
HTTPClientSender::patch_cleared(const std::string& patch_path)
{
send_chunk(string("<").append(patch_path).append("> ingen:empty true ."));
- //send("/ingen/patch_cleared", "s", patch_path.c_str(), LO_ARGS_END);
}
@@ -99,11 +98,17 @@ HTTPClientSender::disconnect(const std::string& src_path, const std::string& dst
void
HTTPClientSender::set_variable(const std::string& path, const std::string& key, const Atom& value)
{
- /*lo_message m = lo_message_new();
- lo_message_add_string(m, path.c_str());
- lo_message_add_string(m, key.c_str());
- Raul::AtomLiblo::lo_message_add_atom(m, value);
- send_message("/ingen/set_variable", m);*/
+ Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value);
+
+ string msg = string(
+ "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .\n"
+ "@prefix ingenuity: <http://drobilla.net/ns/ingenuity#> .\n"
+ "@prefix lv2var: <http://lv2plug.in/ns/ext/instance-var#> .\n\n<").append(
+ path).append("> lv2var:variable [\n"
+ "rdf:predicate ").append(key).append(" ;\n"
+ "rdf:value ").append(node.to_string()).append("\n] .\n");
+
+ send_chunk(msg);
}
diff --git a/src/ingen/main.cpp b/src/ingen/main.cpp
index 4c73f1de..f167ed36 100644
--- a/src/ingen/main.cpp
+++ b/src/ingen/main.cpp
@@ -117,6 +117,7 @@ main(int argc, char** argv)
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("owl", "http://www.w3.org/2002/07/owl#");
world->rdf_world->add_prefix("doap", "http://usefulinc.com/ns/doap#");
world->rdf_world->add_prefix("dc", "http://purl.org/dc/elements/1.1/");
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(
diff --git a/src/shared/HTTPSender.cpp b/src/shared/HTTPSender.cpp
index 1b38f97f..e5cd80dc 100644
--- a/src/shared/HTTPSender.cpp
+++ b/src/shared/HTTPSender.cpp
@@ -109,7 +109,7 @@ HTTPSender::_run()
_signal.wait(_mutex);
write(_client_sock, _transfer.c_str(), _transfer.length());
- write(_client_sock, "\n\n\n", 2);
+ write(_client_sock, "\n\n\n", 3);
_signal.broadcast();
_mutex.unlock();