From 0bd203374d1bc3bb3f303705b37c7567e1ef673f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 16 Nov 2008 06:43:14 +0000 Subject: Track connecting over HTTP. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1724 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/HTTPClientSender.cpp | 42 ++++++++++++++++++++++++++++------------- src/serialisation/Parser.cpp | 9 +++------ 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/engine/HTTPClientSender.cpp b/src/engine/HTTPClientSender.cpp index 652bc1a7..bcbf8dd8 100644 --- a/src/engine/HTTPClientSender.cpp +++ b/src/engine/HTTPClientSender.cpp @@ -84,7 +84,14 @@ HTTPClientSender::patch_cleared(const std::string& patch_path) void HTTPClientSender::connect(const std::string& src_path, const std::string& dst_path) { - //send("/ingen/new_connection", "ss", src_path.c_str(), dst_path.c_str(), LO_ARGS_END); + string msg = string( + "@prefix rdf: .\n" + "@prefix ingen: .\n" + "@prefix lv2var: .\n\n<").append( + "<> ingen:connection [\n" + "\tingen:destination <").append(dst_path).append("> ;\n" + "\tingen:source <").append(src_path).append(">\n] .\n"); + send_chunk(msg); } @@ -99,7 +106,6 @@ void HTTPClientSender::set_variable(const std::string& path, const std::string& key, const Atom& value) { Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value); - string msg = string( "@prefix rdf: .\n" "@prefix ingenuity: .\n" @@ -107,7 +113,6 @@ HTTPClientSender::set_variable(const std::string& path, const std::string& key, path).append("> lv2var:variable [\n" "rdf:predicate ").append(key).append(" ;\n" "rdf:value ").append(node.to_string()).append("\n] .\n"); - send_chunk(msg); } @@ -115,21 +120,28 @@ HTTPClientSender::set_variable(const std::string& path, const std::string& key, void HTTPClientSender::set_property(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_property", m);*/ + Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value); + string msg = string( + "@prefix rdf: .\n" + "@prefix ingen: .\n" + "@prefix ingenuity: .\n" + "@prefix lv2var: .\n\n<").append( + path).append("> ingen:property [\n" + "rdf:predicate ").append(key).append(" ;\n" + "rdf:value ").append(node.to_string()).append("\n] .\n"); + send_chunk(msg); } void HTTPClientSender::set_port_value(const std::string& port_path, const Raul::Atom& value) { - /*lo_message m = lo_message_new(); - lo_message_add_string(m, port_path.c_str()); - Raul::AtomLiblo::lo_message_add_atom(m, value); - send_message("/ingen/set_port_value", m);*/ + Redland::Node node = AtomRDF::atom_to_node(*_engine.world()->rdf_world, value); + string msg = string( + "@prefix rdf: .\n" + "@prefix ingen: .\n\n<").append( + port_path).append("> ingen:value ").append(node.to_string()).append(" .\n"); + send_chunk(msg); } @@ -189,7 +201,11 @@ HTTPClientSender::new_patch(const std::string& path, uint32_t poly) void HTTPClientSender::object_renamed(const std::string& old_path, const std::string& new_path) { - //send("/ingen/object_renamed", "ss", old_path.c_str(), new_path.c_str(), LO_ARGS_END); + string msg = string( + "@prefix rdf: .\n" + "@prefix ingen: .\n\n<").append( + old_path).append("> rdf:subject <").append(new_path).append("> .\n"); + send_chunk(msg); } diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index ec30ff19..ac7332a7 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -94,8 +94,8 @@ Parser::parse_string( if (object_uri) cout << "Parsing " << object_uri.get() << " (base " << base_uri << ")" << endl; - else - cout << "Parsing all objects found in string (base " << base_uri << ")" << endl; + //else + // cout << "Parsing all objects found in string (base " << base_uri << ")" << endl; bool ret = parse(world, target, model, base_uri, engine_base, object_uri, symbol, data); if (ret) { @@ -149,15 +149,12 @@ Parser::parse( 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(); + parse_connections(world, target, model, base_uri, "", "/"); if (object_uri) query_str = Glib::ustring("SELECT DISTINCT ?class WHERE { <") + object_uri.get() + "> a ?class . }"; -- cgit v1.2.1