summaryrefslogtreecommitdiffstats
path: root/src/libs/serialisation
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-11-30 07:38:42 +0000
committerDavid Robillard <d@drobilla.net>2007-11-30 07:38:42 +0000
commit58af61933fe938c404b8fcd916b3939257663cdd (patch)
treed8dc1d63966756cc652178359f2b00982109a29f /src/libs/serialisation
parent61e1e6e1442e97365db33b6071f8710a68987d64 (diff)
downloadingen-58af61933fe938c404b8fcd916b3939257663cdd.tar.gz
ingen-58af61933fe938c404b8fcd916b3939257663cdd.tar.bz2
ingen-58af61933fe938c404b8fcd916b3939257663cdd.zip
Split redland C++ wrappers out from Raul.
git-svn-id: http://svn.drobilla.net/lad/ingen@927 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/serialisation')
-rw-r--r--src/libs/serialisation/Loader.cpp76
-rw-r--r--src/libs/serialisation/Loader.hpp6
-rw-r--r--src/libs/serialisation/Makefile.am3
-rw-r--r--src/libs/serialisation/Serialiser.cpp82
-rw-r--r--src/libs/serialisation/Serialiser.hpp22
5 files changed, 96 insertions, 93 deletions
diff --git a/src/libs/serialisation/Loader.cpp b/src/libs/serialisation/Loader.cpp
index 1e2497fb..0aa9bb74 100644
--- a/src/libs/serialisation/Loader.cpp
+++ b/src/libs/serialisation/Loader.cpp
@@ -19,10 +19,10 @@
#include <set>
#include <locale.h>
#include <glibmm/ustring.h>
-#include <raul/RDFModel.hpp>
-#include <raul/RDFQuery.hpp>
+#include <redlandmm/Model.hpp>
+#include <redlandmm/Query.hpp>
#include <raul/TableImpl.hpp>
-#include <raul/AtomRedland.hpp>
+#include <raul/Atom.hpp>
#include "interface/EngineInterface.hpp"
#include "Loader.hpp"
@@ -42,7 +42,7 @@ namespace Serialisation {
*/
bool
Loader::load(SharedPtr<EngineInterface> engine,
- Raul::RDF::World* rdf_world,
+ Redland::World* rdf_world,
const Glib::ustring& document_uri,
boost::optional<Path> parent,
string patch_name,
@@ -55,7 +55,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
std::set<Path> created;
- RDF::Model model(*rdf_world, document_uri);
+ Redland::Model model(*rdf_world, document_uri);
if (patch_uri == "")
patch_uri = string("<") + document_uri + ">";
@@ -74,18 +74,18 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* Get polyphony from file (mandatory if not specified in parameters) */
} else {
// FIXME: polyphony datatype?
- RDF::Query query(*rdf_world, Glib::ustring(
+ Redland::Query query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?poly WHERE {\n") +
patch_uri + " ingen:polyphony ?poly\n }");
- RDF::Query::Results results = query.run(*rdf_world, model);
+ Redland::Query::Results results = query.run(*rdf_world, model);
if (results.size() == 0) {
cerr << "[Loader] ERROR: No polyphony found!" << endl;
return false;
}
- const RDF::Node& poly_node = (*results.begin())["poly"];
+ const Redland::Node& poly_node = (*results.begin())["poly"];
assert(poly_node.is_int());
patch_poly = static_cast<size_t>(poly_node.to_int());
}
@@ -97,11 +97,11 @@ Loader::load(SharedPtr<EngineInterface> engine,
if (patch_name.substr(patch_name.length()-10) == ".ingen.ttl")
patch_name = patch_name.substr(0, patch_name.length()-10);
- RDF::Query query(*rdf_world, Glib::ustring(
+ Redland::Query query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?name WHERE {\n") +
patch_uri + " ingen:name ?name\n}");
- RDF::Query::Results results = query.run(*rdf_world, model);
+ Redland::Query::Results results = query.run(*rdf_world, model);
if (results.size() > 0)
patch_name = (*results.begin())["name"].to_string();
@@ -115,7 +115,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* Load (plugin) nodes */
- RDF::Query query(*rdf_world, Glib::ustring(
+ Redland::Query query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?name ?plugin ?varkey ?varval ?poly WHERE {\n") +
patch_uri + " ingen:node ?node .\n"
"?node ingen:name ?name ;\n"
@@ -127,13 +127,13 @@ Loader::load(SharedPtr<EngineInterface> engine,
" }"
"}");
- RDF::Query::Results results = query.run(*rdf_world, model);
+ Redland::Query::Results results = query.run(*rdf_world, model);
map<const string, const Atom> variable;
rdf_world->mutex().lock();
- for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
const string node_name = (*i)["name"].to_string();
const Path node_path = patch_path.base() + node_name;
@@ -142,7 +142,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
const string node_plugin = rdf_world->qualify((*i)["plugin"].to_string());
bool node_polyphonic = false;
- RDF::Node poly_node = (*i)["poly"];
+ Redland::Node poly_node = (*i)["poly"];
if (poly_node.is_bool() && poly_node.to_bool() == true)
node_polyphonic = true;
@@ -151,10 +151,10 @@ Loader::load(SharedPtr<EngineInterface> engine,
}
const string key = rdf_world->prefixes().qualify((*i)["varkey"].to_string());
- RDF::Node val_node = (*i)["varval"];
+ Redland::Node val_node = (*i)["varval"];
if (key != "")
- engine->set_variable(node_path, key, AtomRedland::rdf_node_to_atom(val_node));
+ engine->set_variable(node_path, key, Atom(val_node));
}
rdf_world->mutex().unlock();
@@ -162,7 +162,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* Load subpatches */
- query = RDF::Query(*rdf_world, Glib::ustring(
+ query = Redland::Query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?patch ?name WHERE {\n") +
patch_uri + " ingen:node ?patch .\n"
"?patch a ingen:Patch ;\n"
@@ -171,7 +171,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
results = query.run(*rdf_world, model);
- for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
const string name = (*i)["name"].to_string();
const string patch = (*i)["patch"].to_string();
@@ -189,7 +189,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* Set node port control values */
- query = RDF::Query(*rdf_world, Glib::ustring(
+ query = Redland::Query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?nodename ?portname ?portval WHERE {\n") +
patch_uri + " ingen:node ?node .\n"
"?node ingen:name ?nodename ;\n"
@@ -201,7 +201,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
results = query.run(*rdf_world, model);
- for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
const string node_name = (*i)["nodename"].to_string();
const string port_name = (*i)["portname"].to_string();
@@ -215,7 +215,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* Load this patch's ports */
- query = RDF::Query(*rdf_world, Glib::ustring(
+ query = Redland::Query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?port ?type ?name ?datatype ?varkey ?varval ?portval WHERE {\n") +
patch_uri + " ingen:port ?port .\n"
"?port a ?type ;\n"
@@ -232,7 +232,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
results = query.run(*rdf_world, model);
- for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
const string name = (*i)["name"].to_string();
const string type = rdf_world->qualify((*i)["type"].to_string());
const string datatype = rdf_world->qualify((*i)["datatype"].to_string());
@@ -245,17 +245,17 @@ Loader::load(SharedPtr<EngineInterface> engine,
created.insert(port_path);
}
- const RDF::Node val_node = (*i)["portval"];
+ const Redland::Node val_node = (*i)["portval"];
if (val_node.is_float()) {
const float val = val_node.to_float();
engine->set_port_value(patch_path.base() + name, "ingen:control", sizeof(float), &val);
}
const string key = rdf_world->prefixes().qualify((*i)["varkey"].to_string());
- const RDF::Node var_val_node = (*i)["varval"];
+ const Redland::Node var_val_node = (*i)["varval"];
if (key != "")
- engine->set_variable(patch_path.base() + name, key, AtomRedland::rdf_node_to_atom(var_val_node));
+ engine->set_variable(patch_path.base() + name, key, Atom(var_val_node));
}
created.clear();
@@ -263,7 +263,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* Node -> Node connections */
- query = RDF::Query(*rdf_world, Glib::ustring(
+ query = Redland::Query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?srcnodename ?srcname ?dstnodename ?dstname WHERE {\n") +
patch_uri + "ingen:node ?srcnode ;\n"
" ingen:node ?dstnode .\n"
@@ -278,7 +278,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
results = query.run(*rdf_world, model);
- for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
Path src_node = patch_path.base() + (*i)["srcnodename"].to_string();
Path src_port = src_node.base() + (*i)["srcname"].to_string();
Path dst_node = patch_path.base() + (*i)["dstnodename"].to_string();
@@ -292,7 +292,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* This Patch -> Node connections */
- query = RDF::Query(*rdf_world, Glib::ustring(
+ query = Redland::Query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?srcname ?dstnodename ?dstname WHERE {\n") +
patch_uri + " ingen:port ?src ;\n"
" ingen:node ?dstnode .\n"
@@ -305,7 +305,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
results = query.run(*rdf_world, model);
- for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
Path src_port = patch_path.base() + (*i)["srcname"].to_string();
Path dst_node = patch_path.base() + (*i)["dstnodename"].to_string();
Path dst_port = dst_node.base() + (*i)["dstname"].to_string();
@@ -318,7 +318,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* Node -> This Patch connections */
- query = RDF::Query(*rdf_world, Glib::ustring(
+ query = Redland::Query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?srcnodename ?srcname ?dstname WHERE {\n") +
patch_uri + " ingen:port ?dst ;\n"
" ingen:node ?srcnode .\n"
@@ -331,7 +331,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
results = query.run(*rdf_world, model);
- for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
Path dst_port = patch_path.base() + (*i)["dstname"].to_string();
Path src_node = patch_path.base() + (*i)["srcnodename"].to_string();
Path src_port = src_node.base() + (*i)["srcname"].to_string();
@@ -344,7 +344,7 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* Load variables */
- query = RDF::Query(*rdf_world, Glib::ustring(
+ query = Redland::Query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?varkey ?varval WHERE {\n") +
patch_uri + " ingen:variable ?variable .\n"
"?variable ingen:key ?varkey ;\n"
@@ -353,13 +353,13 @@ Loader::load(SharedPtr<EngineInterface> engine,
results = query.run(*rdf_world, model);
- for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
const string key = rdf_world->prefixes().qualify((*i)["varkey"].to_string());
- RDF::Node val_node = (*i)["varval"];
+ Redland::Node val_node = (*i)["varval"];
if (key != "")
- engine->set_variable(patch_path, key, AtomRedland::rdf_node_to_atom(val_node));
+ engine->set_variable(patch_path, key, Atom(val_node));
}
@@ -370,16 +370,16 @@ Loader::load(SharedPtr<EngineInterface> engine,
/* Enable */
- query = RDF::Query(*rdf_world, Glib::ustring(
+ query = Redland::Query(*rdf_world, Glib::ustring(
"SELECT DISTINCT ?enabled WHERE {\n") +
patch_uri + " ingen:enabled ?enabled .\n"
"}");
results = query.run(*rdf_world, model);
- for (RDF::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
+ for (Redland::Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
- RDF::Node enabled_node = (*i)["enabled"];
+ Redland::Node enabled_node = (*i)["enabled"];
if (enabled_node.is_bool() && enabled_node.to_bool()) {
engine->enable_patch(patch_path);
diff --git a/src/libs/serialisation/Loader.hpp b/src/libs/serialisation/Loader.hpp
index e81fba4c..a1d4e302 100644
--- a/src/libs/serialisation/Loader.hpp
+++ b/src/libs/serialisation/Loader.hpp
@@ -26,7 +26,7 @@
#include <raul/Table.hpp>
#include "interface/GraphObject.hpp"
-namespace Raul { namespace RDF { class World; } }
+namespace Redland { class World; }
namespace Ingen { namespace Shared { class EngineInterface; } }
using namespace Ingen::Shared;
@@ -41,12 +41,12 @@ public:
virtual bool
load(SharedPtr<Ingen::Shared::EngineInterface> engine,
- Raul::RDF::World* world,
+ Redland::World* world,
const Glib::ustring& uri,
boost::optional<Raul::Path> parent,
std::string patch_name,
Glib::ustring patch_uri = "",
- GraphObject::Variables data = GraphObject::Variables());
+ GraphObject::Variables data = GraphObject::Variables());
};
diff --git a/src/libs/serialisation/Makefile.am b/src/libs/serialisation/Makefile.am
index 0f5df646..3121cec3 100644
--- a/src/libs/serialisation/Makefile.am
+++ b/src/libs/serialisation/Makefile.am
@@ -6,12 +6,13 @@ module_LTLIBRARIES = libingen_serialisation.la
libingen_serialisation_la_CXXFLAGS = \
@INGEN_CFLAGS@ \
+ @REDLANDMM_CFLAGS@ \
@RAUL_CFLAGS@ \
@GLIBMM_CFLAGS@ \
@SLV2_CFLAGS@
libingen_serialisation_la_LDFLAGS = -no-undefined -module -avoid-version
-libingen_serialisation_la_LIBADD = @RAUL_LIBS@ @GLIBMM_LIBS@ @SLV2_LIBS@
+libingen_serialisation_la_LIBADD = @RAUL_LIBS@ @REDLANDMM_LIBS@ @GLIBMM_LIBS@ @SLV2_LIBS@
libingen_serialisation_la_SOURCES = \
Loader.cpp \
diff --git a/src/libs/serialisation/Serialiser.cpp b/src/libs/serialisation/Serialiser.cpp
index 223093a0..b8195d34 100644
--- a/src/libs/serialisation/Serialiser.cpp
+++ b/src/libs/serialisation/Serialiser.cpp
@@ -44,7 +44,7 @@
using namespace std;
using namespace Raul;
-using namespace Raul::RDF;
+using namespace Redland;
using namespace Ingen;
using namespace Ingen::Shared;
@@ -52,7 +52,7 @@ namespace Ingen {
namespace Serialisation {
-Serialiser::Serialiser(Raul::RDF::World& world)
+Serialiser::Serialiser(Redland::World& world)
: _world(world)
{
}
@@ -77,10 +77,10 @@ Serialiser::to_string(SharedPtr<GraphObject> object,
start_to_string(base_uri);
serialise(object);
- RDF::Node base_rdf_node(_model->world(), RDF::Node::RESOURCE, base_uri);
+ Redland::Node base_rdf_node(_model->world(), Redland::Node::RESOURCE, base_uri);
for (GraphObject::Variables::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, v->second);
+ _model->add_statement(base_rdf_node, v->first, v->second.to_rdf_node(_model->world()));
} else {
cerr << "Warning: not serialising extra RDF with key '" << v->first << "'" << endl;
}
@@ -100,7 +100,7 @@ Serialiser::start_to_filename(const string& filename)
setlocale(LC_NUMERIC, "C");
_base_uri = "file://" + filename;
- _model = new RDF::Model(_world);
+ _model = new Redland::Model(_world);
_mode = TO_FILE;
}
@@ -118,7 +118,7 @@ Serialiser::start_to_string(const string& base_uri)
setlocale(LC_NUMERIC, "C");
_base_uri = base_uri;
- _model = new RDF::Model(_world);
+ _model = new Redland::Model(_world);
_mode = TO_STRING;
}
@@ -147,7 +147,7 @@ Serialiser::finish()
/** Convert a path to an RDF blank node ID for serializing.
*/
-RDF::Node
+Redland::Node
Serialiser::path_to_node_id(const Path& path)
{
assert(_model);
@@ -158,7 +158,7 @@ Serialiser::path_to_node_id(const Path& path)
ret[i] = '_';
}
- return RDF::Node(Node::BLANK, ret);
+ return Redland::Node(Node::BLANK, ret);
*/
NodeMap::iterator i = _node_map.find(path);
@@ -167,7 +167,7 @@ Serialiser::path_to_node_id(const Path& path)
assert(i->second.get_node());
return i->second;
} else {
- RDF::Node id = _world.blank_id(path.name());
+ Redland::Node id = _world.blank_id(path.name());
assert(id);
_node_map[path] = id;
return id;
@@ -255,14 +255,14 @@ Serialiser::serialise(SharedPtr<GraphObject> object) throw (std::logic_error)
}
-RDF::Node
+Redland::Node
Serialiser::patch_path_to_rdf_id(const Path& path)
{
if (path == _root_object->path()) {
- return RDF::Node(_model->world(), RDF::Node::RESOURCE, _base_uri);
+ return Redland::Node(_model->world(), Redland::Node::RESOURCE, _base_uri);
} else {
assert(path.length() > _root_object->path().length());
- return RDF::Node(_model->world(), RDF::Node::RESOURCE,
+ return Redland::Node(_model->world(), Redland::Node::RESOURCE,
_base_uri + string("#") + path.substr(_root_object->path().length()));
}
}
@@ -273,28 +273,28 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch)
{
assert(_model);
- const RDF::Node patch_id = patch_path_to_rdf_id(patch->path());
+ const Redland::Node patch_id = patch_path_to_rdf_id(patch->path());
_model->add_statement(
patch_id,
"rdf:type",
- RDF::Node(_model->world(), RDF::Node::RESOURCE, "http://drobilla.net/ns/ingen#Patch"));
+ Redland::Node(_model->world(), Redland::Node::RESOURCE, "http://drobilla.net/ns/ingen#Patch"));
if (patch->path().name().length() > 0) {
_model->add_statement(
patch_id, "ingen:name",
- Atom(patch->path().name().c_str()));
+ Redland::Node(_model->world(), Redland::Node::LITERAL, patch->path().name()));
}
_model->add_statement(
patch_id,
"ingen:polyphony",
- Atom((int)patch->internal_polyphony()));
+ Atom((int)patch->internal_polyphony()).to_rdf_node(_model->world()));
_model->add_statement(
patch_id,
"ingen:enabled",
- Atom(patch->enabled()));
+ Atom(patch->enabled()).to_rdf_node(_model->world()));
serialise_variables(patch_id, patch->variables());
@@ -309,7 +309,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch)
_model->add_statement(patch_id, "ingen:node", patch_path_to_rdf_id(patch->path()));
serialise_patch(patch);
} else if (node) {
- const RDF::Node node_id = path_to_node_id(n->second->path());
+ const Redland::Node node_id = path_to_node_id(n->second->path());
_model->add_statement(patch_id, "ingen:node", node_id);
serialise_node(node, node_id);
}
@@ -317,7 +317,7 @@ Serialiser::serialise_patch(SharedPtr<Shared::Patch> patch)
for (uint32_t i=0; i < patch->num_ports(); ++i) {
Port* p = patch->port(i);
- const RDF::Node port_id = path_to_node_id(p->path());
+ const Redland::Node port_id = path_to_node_id(p->path());
_model->add_statement(patch_id, "ingen:port", port_id);
serialise_port(p, port_id);
}
@@ -334,30 +334,30 @@ Serialiser::serialise_plugin(SharedPtr<Shared::Plugin> plugin)
{
assert(_model);
- const RDF::Node plugin_id = RDF::Node(_model->world(), RDF::Node::RESOURCE, plugin->uri());
+ const Redland::Node plugin_id = Redland::Node(_model->world(), Redland::Node::RESOURCE, plugin->uri());
_model->add_statement(
plugin_id,
"rdf:type",
- RDF::Node(_model->world(), RDF::Node::RESOURCE, plugin->type_uri()));
+ Redland::Node(_model->world(), Redland::Node::RESOURCE, plugin->type_uri()));
}
void
-Serialiser::serialise_node(SharedPtr<Shared::Node> node, const RDF::Node& node_id)
+Serialiser::serialise_node(SharedPtr<Shared::Node> node, const Redland::Node& node_id)
{
- const RDF::Node plugin_id
- = RDF::Node(_model->world(), RDF::Node::RESOURCE, node->plugin()->uri());
+ const Redland::Node plugin_id
+ = Redland::Node(_model->world(), Redland::Node::RESOURCE, node->plugin()->uri());
_model->add_statement(
node_id,
"rdf:type",
- RDF::Node(_model->world(), RDF::Node::RESOURCE, "ingen:Node"));
+ Redland::Node(_model->world(), Redland::Node::RESOURCE, "ingen:Node"));
_model->add_statement(
node_id,
"ingen:name",
- node->path().name());
+ Atom(node->path().name()).to_rdf_node(_model->world()));
_model->add_statement(
node_id,
@@ -367,14 +367,14 @@ Serialiser::serialise_node(SharedPtr<Shared::Node> node, const RDF::Node& node_i
_model->add_statement(
node_id,
"ingen:polyphonic",
- node->polyphonic());
+ Atom(node->polyphonic()).to_rdf_node(_model->world()));
//serialise_plugin(node->plugin());
for (uint32_t i=0; i < node->num_ports(); ++i) {
Port* p = node->port(i);
assert(p);
- const RDF::Node port_id = path_to_node_id(p->path());
+ const Redland::Node port_id = path_to_node_id(p->path());
serialise_port(p, port_id);
_model->add_statement(node_id, "ingen:port", port_id);
}
@@ -388,22 +388,24 @@ Serialiser::serialise_node(SharedPtr<Shared::Node> node, const RDF::Node& node_i
* Audio output ports with no variable will not be written, for example.
*/
void
-Serialiser::serialise_port(const Port* port, const RDF::Node& port_id)
+Serialiser::serialise_port(const Port* port, const Redland::Node& port_id)
{
if (port->is_input())
_model->add_statement(port_id, "rdf:type",
- RDF::Node(_model->world(), RDF::Node::RESOURCE, "ingen:InputPort"));
+ Redland::Node(_model->world(), Redland::Node::RESOURCE, "ingen:InputPort"));
else
_model->add_statement(port_id, "rdf:type",
- RDF::Node(_model->world(), RDF::Node::RESOURCE, "ingen:OutputPort"));
+ Redland::Node(_model->world(), Redland::Node::RESOURCE, "ingen:OutputPort"));
- _model->add_statement(port_id, "ingen:name", Atom(port->path().name().c_str()));
+ _model->add_statement(port_id, "ingen:name",
+ Atom(port->path().name().c_str()).to_rdf_node(_model->world()));
_model->add_statement(port_id, "rdf:type",
- RDF::Node(_model->world(), RDF::Node::RESOURCE, port->type().uri()));
+ Redland::Node(_model->world(), Redland::Node::RESOURCE, port->type().uri()));
if (port->type() == DataType::CONTROL && port->is_input())
- _model->add_statement(port_id, "ingen:value", port->value());
+ _model->add_statement(port_id, "ingen:value",
+ Atom(port->value()).to_rdf_node(_model->world()));
serialise_variables(port_id, port->variables());
}
@@ -415,23 +417,23 @@ Serialiser::serialise_connection(SharedPtr<Connection> connection) throw (std::l
if (!_model)
throw std::logic_error("serialise_connection called without serialization in progress");
- const RDF::Node src_node = path_to_node_id(connection->src_port_path());
- const RDF::Node dst_node = path_to_node_id(connection->dst_port_path());
+ const Redland::Node src_node = path_to_node_id(connection->src_port_path());
+ const Redland::Node dst_node = path_to_node_id(connection->dst_port_path());
_model->add_statement(dst_node, "ingen:connectedTo", src_node);
}
void
-Serialiser::serialise_variables(RDF::Node subject, const GraphObject::Variables& variables)
+Serialiser::serialise_variables(Redland::Node subject, const GraphObject::Variables& variables)
{
for (GraphObject::Variables::const_iterator v = variables.begin(); v != variables.end(); ++v) {
if (v->first.find(":") != string::npos) {
- const RDF::Node var_id = _world.blank_id();
- const RDF::Node key(_model->world(), RDF::Node::RESOURCE, v->first);
+ const Redland::Node var_id = _world.blank_id();
+ const Redland::Node key(_model->world(), Redland::Node::RESOURCE, v->first);
_model->add_statement(subject, "ingen:variable", var_id);
_model->add_statement(var_id, "ingen:key", key);
- _model->add_statement(var_id, "ingen:value", v->second);
+ _model->add_statement(var_id, "ingen:value", v->second.to_rdf_node(_model->world()));
} else {
cerr << "Warning: not serialising variable with key '" << v->first << "'" << endl;
}
diff --git a/src/libs/serialisation/Serialiser.hpp b/src/libs/serialisation/Serialiser.hpp
index fc15cd1a..e14560b7 100644
--- a/src/libs/serialisation/Serialiser.hpp
+++ b/src/libs/serialisation/Serialiser.hpp
@@ -26,8 +26,8 @@
#include <raul/SharedPtr.hpp>
#include <raul/Path.hpp>
#include <raul/Atom.hpp>
-#include <raul/RDFWorld.hpp>
-#include <raul/RDFModel.hpp>
+#include <redlandmm/World.hpp>
+#include <redlandmm/Model.hpp>
#include "interface/GraphObject.hpp"
using namespace Raul;
@@ -54,7 +54,7 @@ namespace Serialisation {
class Serialiser
{
public:
- Serialiser(Raul::RDF::World& world);
+ Serialiser(Redland::World& world);
void to_file(SharedPtr<GraphObject> object, const string& filename);
@@ -77,22 +77,22 @@ private:
void serialise_plugin(SharedPtr<Shared::Plugin> p);
void serialise_patch(SharedPtr<Shared::Patch> p);
- void serialise_node(SharedPtr<Shared::Node> n, const Raul::RDF::Node& id);
- void serialise_port(const Shared::Port* p, const Raul::RDF::Node& id);
+ void serialise_node(SharedPtr<Shared::Node> n, const Redland::Node& id);
+ void serialise_port(const Shared::Port* p, const Redland::Node& id);
- void serialise_variables(RDF::Node subject, const GraphObject::Variables& variables);
+ void serialise_variables(Redland::Node subject, const GraphObject::Variables& variables);
- Raul::RDF::Node path_to_node_id(const Path& path);
- Raul::RDF::Node patch_path_to_rdf_id(const Path& path);
+ Redland::Node path_to_node_id(const Path& path);
+ Redland::Node patch_path_to_rdf_id(const Path& path);
- typedef std::map<Raul::Path, Raul::RDF::Node> NodeMap;
+ typedef std::map<Raul::Path, Redland::Node> NodeMap;
SharedPtr<GraphObject> _root_object;
Mode _mode;
NodeMap _node_map;
string _base_uri;
- Raul::RDF::World& _world;
- Raul::RDF::Model* _model;
+ Redland::World& _world;
+ Redland::Model* _model;
};