summaryrefslogtreecommitdiffstats
path: root/src/serialisation
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-12-29 20:34:32 +0000
committerDavid Robillard <d@drobilla.net>2012-12-29 20:34:32 +0000
commit79275fc579c0dbe1ce4ca109edb95f2c1e0802a5 (patch)
tree72bb18ea61f485c47514a511dd3067c57aa2fb4b /src/serialisation
parent9bdf223f830d3b430563e96d93efc073b1882e96 (diff)
downloadingen-79275fc579c0dbe1ce4ca109edb95f2c1e0802a5.tar.gz
ingen-79275fc579c0dbe1ce4ca109edb95f2c1e0802a5.tar.bz2
ingen-79275fc579c0dbe1ce4ca109edb95f2c1e0802a5.zip
"edge" => "arc".
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4897 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/serialisation')
-rw-r--r--src/serialisation/Parser.cpp54
-rw-r--r--src/serialisation/Serialiser.cpp42
2 files changed, 52 insertions, 44 deletions
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 0c15b0b4..3a283641 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -87,6 +87,7 @@ skip_property(const Sord::Node& predicate)
{
return (predicate.to_string() == "http://drobilla.net/ns/ingen#node"
|| predicate.to_string() == "http://drobilla.net/ns/ingen#edge"
+ || predicate.to_string() == "http://drobilla.net/ns/ingen#arc"
|| predicate.to_string() == LV2_CORE__port);
}
@@ -207,7 +208,7 @@ parse_properties(
boost::optional<Resource::Properties> data = boost::optional<Resource::Properties>());
static bool
-parse_edges(
+parse_arcs(
World* world,
Interface* target,
Sord::Model& model,
@@ -378,17 +379,17 @@ parse_graph(Ingen::World* world,
i->second.second);
}
- parse_edges(world, target, model, subject_node, graph_path);
+ parse_arcs(world, target, model, subject_node, graph_path);
return graph_path;
}
static bool
-parse_edge(Ingen::World* world,
- Ingen::Interface* target,
- Sord::Model& model,
- const Sord::Node& subject,
- const Raul::Path& graph)
+parse_arc(Ingen::World* world,
+ Ingen::Interface* target,
+ Sord::Model& model,
+ const Sord::Node& subject,
+ const Raul::Path& graph)
{
URIs& uris = world->uris();
@@ -402,32 +403,32 @@ parse_edge(Ingen::World* world,
const Glib::ustring& base_uri = model.base_uri().to_string();
if (t.end()) {
- world->log().error("Edge has no tail");
+ world->log().error("Arc has no tail");
return false;
} else if (h.end()) {
- world->log().error("Edge has no head");
+ world->log().error("Arc has no head");
return false;
}
const std::string tail_str = relative_uri(
base_uri, t.get_object().to_string(), true);
if (!Raul::Path::is_valid(tail_str)) {
- world->log().error("Edge tail has invalid URI");
+ world->log().error("Arc tail has invalid URI");
return false;
}
const std::string head_str = relative_uri(
base_uri, h.get_object().to_string(), true);
if (!Raul::Path::is_valid(head_str)) {
- world->log().error("Edge head has invalid URI");
+ world->log().error("Arc head has invalid URI");
return false;
}
if (!(++t).end()) {
- world->log().error("Edge has multiple tails");
+ world->log().error("Arc has multiple tails");
return false;
} else if (!(++h).end()) {
- world->log().error("Edge has multiple heads");
+ world->log().error("Arc has multiple heads");
return false;
}
@@ -438,17 +439,24 @@ parse_edge(Ingen::World* world,
}
static bool
-parse_edges(Ingen::World* world,
- Ingen::Interface* target,
- Sord::Model& model,
- const Sord::Node& subject,
- const Raul::Path& graph)
+parse_arcs(Ingen::World* world,
+ Ingen::Interface* target,
+ Sord::Model& model,
+ const Sord::Node& subject,
+ const Raul::Path& graph)
{
- const Sord::URI ingen_edge(*world->rdf_world(), world->uris().ingen_edge);
+ const Sord::URI ingen_arc(*world->rdf_world(), world->uris().ingen_arc);
const Sord::Node nil;
+ for (Sord::Iter i = model.find(subject, ingen_arc, nil); !i.end(); ++i) {
+ parse_arc(world, target, model, i.get_object(), graph);
+ }
+
+ // Backwards compatibility, support ingen:edge predicate
+ const Sord::URI ingen_edge(*world->rdf_world(),
+ "http://drobilla.net/ns/ingen#edge");
for (Sord::Iter i = model.find(subject, ingen_edge, nil); !i.end(); ++i) {
- parse_edge(world, target, model, i.get_object(), graph);
+ parse_arc(world, target, model, i.get_object(), graph);
}
return true;
@@ -487,7 +495,7 @@ parse(Ingen::World* world,
const Sord::URI graph_class (*world->rdf_world(), uris.ingen_Graph);
const Sord::URI block_class (*world->rdf_world(), uris.ingen_Block);
- const Sord::URI edge_class (*world->rdf_world(), uris.ingen_Edge);
+ const Sord::URI arc_class (*world->rdf_world(), uris.ingen_Arc);
const Sord::URI internal_class(*world->rdf_world(), uris.ingen_Internal);
const Sord::URI in_port_class (*world->rdf_world(), LV2_CORE__InputPort);
const Sord::URI out_port_class(*world->rdf_world(), LV2_CORE__OutputPort);
@@ -534,9 +542,9 @@ parse(Ingen::World* world,
parse_properties(
world, target, model, s, Node::path_to_uri(path), data);
ret = path;
- } else if (types.find(edge_class) != types.end()) {
+ } else if (types.find(arc_class) != types.end()) {
Raul::Path parent_path(parent ? parent.get() : Raul::Path("/"));
- parse_edge(world, target, model, s, parent_path);
+ parse_arc(world, target, model, s, parent_path);
} else {
world->log().error("Subject has no known types\n");
}
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index e3781a01..85ecbfb4 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -26,7 +26,7 @@
#include <glibmm/miscutils.h>
#include <glibmm/module.h>
-#include "ingen/Edge.hpp"
+#include "ingen/Arc.hpp"
#include "ingen/Interface.hpp"
#include "ingen/Log.hpp"
#include "ingen/Node.hpp"
@@ -89,8 +89,8 @@ struct Serialiser::Impl {
SharedPtr<const Node> graph,
const std::string& graph_symbol);
- void serialise_edge(const Sord::Node& parent,
- SharedPtr<const Edge> c)
+ void serialise_arc(const Sord::Node& parent,
+ SharedPtr<const Arc> a)
throw (std::logic_error);
std::string finish();
@@ -413,9 +413,9 @@ Serialiser::Impl::serialise_graph(SharedPtr<const Node> graph,
serialise_port(p, Resource::INTERNAL, port_id);
}
- for (Node::Edges::const_iterator c = graph->edges().begin();
- c != graph->edges().end(); ++c) {
- serialise_edge(graph_id, c->second);
+ for (Node::Arcs::const_iterator a = graph->arcs().begin();
+ a != graph->arcs().end(); ++a) {
+ serialise_arc(graph_id, a->second);
}
}
@@ -481,43 +481,43 @@ Serialiser::Impl::serialise_port(const Node* port,
}
void
-Serialiser::serialise_edge(const Sord::Node& parent,
- SharedPtr<const Edge> edge)
+Serialiser::serialise_arc(const Sord::Node& parent,
+ SharedPtr<const Arc> arc)
throw (std::logic_error)
{
- return me->serialise_edge(parent, edge);
+ return me->serialise_arc(parent, arc);
}
void
-Serialiser::Impl::serialise_edge(const Sord::Node& parent,
- SharedPtr<const Edge> edge)
+Serialiser::Impl::serialise_arc(const Sord::Node& parent,
+ SharedPtr<const Arc> arc)
throw (std::logic_error)
{
if (!_model)
throw std::logic_error(
- "serialise_edge called without serialisation in progress");
+ "serialise_arc called without serialisation in progress");
Sord::World& world = _model->world();
const URIs& uris = _world.uris();
- const Sord::Node src = path_rdf_node(edge->tail_path());
- const Sord::Node dst = path_rdf_node(edge->head_path());
- const Sord::Node edge_id = Sord::Node::blank_id(*_world.rdf_world());
- _model->add_statement(edge_id,
+ const Sord::Node src = path_rdf_node(arc->tail_path());
+ const Sord::Node dst = path_rdf_node(arc->head_path());
+ const Sord::Node arc_id = Sord::Node::blank_id(*_world.rdf_world());
+ _model->add_statement(arc_id,
Sord::URI(world, uris.ingen_tail),
src);
- _model->add_statement(edge_id,
+ _model->add_statement(arc_id,
Sord::URI(world, uris.ingen_head),
dst);
if (parent.is_valid()) {
_model->add_statement(parent,
- Sord::URI(world, uris.ingen_edge),
- edge_id);
+ Sord::URI(world, uris.ingen_arc),
+ arc_id);
} else {
- _model->add_statement(edge_id,
+ _model->add_statement(arc_id,
Sord::URI(world, uris.rdf_type),
- Sord::URI(world, uris.ingen_Edge));
+ Sord::URI(world, uris.ingen_Arc));
}
}