diff options
-rw-r--r-- | bundles/ingen.lv2/ingen.ttl | 38 | ||||
-rw-r--r-- | src/serialisation/Parser.cpp | 56 | ||||
-rw-r--r-- | src/serialisation/Serialiser.cpp | 6 |
3 files changed, 54 insertions, 46 deletions
diff --git a/bundles/ingen.lv2/ingen.ttl b/bundles/ingen.lv2/ingen.ttl index 9a708f4c..2a1c0dce 100644 --- a/bundles/ingen.lv2/ingen.ttl +++ b/bundles/ingen.lv2/ingen.ttl @@ -24,7 +24,7 @@ ingen:Plugin rdfs:label "Plugin" ; rdfs:comment """ A class which can be instantiated into a ingen:Node. A plugin has a set of input -and output "ports". In practise this class is semantically equivalent to +and output "ports". In practice this class is semantically equivalent to lv2:Plugin, it only exists to allow the ingen ontology to be useful for "plugins" that aren't semantically LV2 plugins. See the LV2 specification for details about the required properties (rdf:type, doap:name, doap:license, @@ -122,25 +122,33 @@ documentation for details. Ports inherit properties from the Port on their parent's Plugin in the exact way Nodes inherit properties from their Plugin. """ . -ingen:Connection +ingen:Edge a owl:Class ; - rdfs:label "Connection" ; + rdfs:label "Edge" ; rdfs:comment """ -A connection between two ports. Patches have a set of connections which -define how its component nodes and ports are connected. A Connection MUST -have exactly one :source property and exactly one :destination property. +A connection between two ports. Patches have a set of edges which +define how its component nodes and ports are connected. An Edge MUST +have exactly one ingen:tail and exactly one ingen:head property. """ . -ingen:source +ingen:edge a owl:ObjectProperty ; - rdfs:domain ingen:Connection ; + rdfs:domain ingen:Patch ; + rdfs:range ingen:Edge ; + rdfs:comment "An edge contained in this patch." . + +ingen:tail + a owl:ObjectProperty , + owl:FunctionalProperty ; + rdfs:domain ingen:Edge ; rdfs:range ingen:Port ; - rdfs:label "Source" ; - rdfs:comment "The source/sending port of this connection" . + rdfs:label "tail" ; + rdfs:comment "The source/sending port of this edge" . -ingen:destination - a owl:ObjectProperty ; - rdfs:domain ingen:Connection ; +ingen:head + a owl:ObjectProperty , + owl:FunctionalProperty ; + rdfs:domain ingen:Edge ; rdfs:range ingen:Port ; - rdfs:label "Destination" ; - rdfs:comment "The destination/receiving/sink port of this connection" . + rdfs:label "head" ; + rdfs:comment "The destination/receiving/sink port of this edge" . diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index edc0e534..c2e8be4d 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -89,7 +89,7 @@ static bool skip_property(const Sord::Node& predicate) { return (predicate.to_string() == "http://drobilla.net/ns/ingen#node" - || predicate.to_string() == "http://drobilla.net/ns/ingen#connection" + || predicate.to_string() == "http://drobilla.net/ns/ingen#edge" || predicate.to_string() == "http://lv2plug.in/ns/lv2core#port"); } @@ -207,7 +207,7 @@ parse_properties( boost::optional<Resource::Properties> data = boost::optional<Resource::Properties>()); static bool -parse_connections( +parse_edges( Shared::World* world, Interface* target, Sord::Model& model, @@ -388,55 +388,55 @@ parse_patch(Ingen::Shared::World* world, target->put(i->second.first, i->second.second); } - parse_connections(world, target, model, subject_node, patch_path); + parse_edges(world, target, model, subject_node, patch_path); return patch_path; } static bool -parse_connections(Ingen::Shared::World* world, - Ingen::Interface* target, - Sord::Model& model, - const Sord::Node& subject, - const Raul::Path& parent) +parse_edges(Ingen::Shared::World* world, + Ingen::Interface* target, + Sord::Model& model, + const Sord::Node& subject, + const Raul::Path& parent) { - Sord::URI ingen_connection(*world->rdf_world(), NS_INGEN "connection"); - Sord::URI ingen_source(*world->rdf_world(), NS_INGEN "source"); - Sord::URI ingen_destination(*world->rdf_world(), NS_INGEN "destination"); + Sord::URI ingen_edge(*world->rdf_world(), NS_INGEN "edge"); + Sord::URI ingen_tail(*world->rdf_world(), NS_INGEN "tail"); + Sord::URI ingen_head(*world->rdf_world(), NS_INGEN "head"); const Glib::ustring& base_uri = model.base_uri().to_string(); RDFNodes connections; - for (Sord::Iter i = model.find(subject, ingen_connection, nil); !i.end(); ++i) { + for (Sord::Iter i = model.find(subject, ingen_edge, nil); !i.end(); ++i) { connections.insert(i.get_object()); } for (RDFNodes::const_iterator i = connections.begin(); i != connections.end(); ++i) { - Sord::Iter s = model.find(*i, ingen_source, nil); - Sord::Iter d = model.find(*i, ingen_destination, nil); + Sord::Iter t = model.find(*i, ingen_tail, nil); + Sord::Iter h = model.find(*i, ingen_head, nil); - if (s.end()) { - LOG(error) << "Connection has no source" << endl; + if (t.end()) { + LOG(error) << "Edge has no tail" << endl; return false; - } else if (d.end()) { - LOG(error) << "Connection has no destination" << endl; + } else if (h.end()) { + LOG(error) << "Edge has no head" << endl; return false; } - const Path src_path( - parent.child(relative_uri(base_uri, s.get_object().to_string(), false))); - const Path dst_path( - parent.child(relative_uri(base_uri, d.get_object().to_string(), false))); + const Path tail_path( + parent.child(relative_uri(base_uri, t.get_object().to_string(), false))); + const Path head_path( + parent.child(relative_uri(base_uri, h.get_object().to_string(), false))); - if (!(++s).end()) { - LOG(error) << "Connection has multiple sources" << endl; + if (!(++t).end()) { + LOG(error) << "Edge has multiple tails" << endl; return false; - } else if (!(++d).end()) { - LOG(error) << "Connection has multiple destinations" << endl; + } else if (!(++h).end()) { + LOG(error) << "Edge has multiple heads" << endl; return false; } - target->connect(src_path, dst_path); + target->connect(tail_path, head_path); } return true; @@ -621,7 +621,7 @@ Parser::parse_string(Ingen::Shared::World* world, bool ret = parse(world, target, model, base_uri, parent, symbol, data); Sord::URI subject(*world->rdf_world(), base_uri); - parse_connections(world, target, model, subject, parent ? *parent : "/"); + parse_edges(world, target, model, subject, parent ? *parent : "/"); return ret; } diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index 8225009e..f0062860 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -518,14 +518,14 @@ Serialiser::Impl::serialise_connection(const Sord::Node& parent, const Sord::Node dst = path_rdf_node(connection->dst_port_path()); const Sord::Node connection_id = Sord::Node::blank_id(*_world.rdf_world()); _model->add_statement(connection_id, - Sord::Curie(world, "ingen:source"), + Sord::Curie(world, "ingen:tail"), src); _model->add_statement(connection_id, - Sord::Curie(world, "ingen:destination"), + Sord::Curie(world, "ingen:head"), dst); _model->add_statement(parent, - Sord::Curie(world, "ingen:connection"), + Sord::Curie(world, "ingen:edge"), connection_id); } |