From ec8939dd7ef5267b43bd8ae3590e783495f0cfc9 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 18 Jan 2014 06:25:36 +0000 Subject: Consolidate URIs. Add missing definition to ontology. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5317 a436a847-0d15-0410-975c-d299462d15a1 --- bundles/ingen.lv2/ingen.ttl | 45 ++++++++++++++++++++++++++++--- ingen/Plugin.hpp | 7 ++--- ingen/Resource.hpp | 19 +++++++------- ingen/URIs.hpp | 11 +++----- ingen/ingen.h | 46 ++++++++++++++++++++++++++++++++ src/Configuration.cpp | 9 +++---- src/Resource.cpp | 7 ++--- src/URIs.cpp | 57 +++++++++++++++++++--------------------- src/World.cpp | 5 ++-- src/client/ClientStore.cpp | 11 ++++---- src/gui/App.cpp | 2 +- src/gui/GraphBox.cpp | 6 ++--- src/gui/GraphCanvas.cpp | 5 ++-- src/gui/GraphPortModule.cpp | 4 +-- src/gui/NodeModule.cpp | 4 +-- src/gui/ObjectMenu.cpp | 8 +++--- src/gui/PortMenu.cpp | 2 +- src/gui/SubgraphModule.cpp | 4 +-- src/gui/ingen_gui_lv2.cpp | 3 ++- src/serialisation/Parser.cpp | 21 +++++---------- src/serialisation/Serialiser.cpp | 3 ++- 21 files changed, 178 insertions(+), 101 deletions(-) create mode 100644 ingen/ingen.h diff --git a/bundles/ingen.lv2/ingen.ttl b/bundles/ingen.lv2/ingen.ttl index bd19f0d9..42055471 100644 --- a/bundles/ingen.lv2/ingen.ttl +++ b/bundles/ingen.lv2/ingen.ttl @@ -40,6 +40,13 @@ A collection of Blocks connected together. A Graph can itself be a Block within a parent Graph, and so on. """ . +ingen:file + a owl:DatatypeProperty ; + rdfs:domain ingen:Graph ; + rdfs:range xsd:anyURI ; + rdfs:label "file" ; + rdfs:comment "The file a Graph was loaded from." . + ingen:canvasX a owl:DatatypeProperty ; rdfs:range xsd:decimal ; @@ -79,6 +86,12 @@ ingen:value rdfs:label "value" ; rdfs:comment "The current value of a port." . +ingen:Internal + a owl:Class ; + rdfs:subClassOf ingen:Plugin ; + rdfs:label "Internal" ; + rdfs:comment "An internal 'plugin'" . + ingen:Node a owl:Class ; rdfs:label "Node" ; @@ -90,9 +103,35 @@ components, so the symbol of a Node may be inferred from its URI if no explicit lv2:symbol property is given. """ . +ingen:uiEmbedded + a owl:DatatypeProperty ; + rdfs:range xsd:boolean ; + rdfs:label "UI embedded" ; + rdfs:comment "Whether or not the block's GUI is embedded." . + lv2:Port + a rdfs:Class ; rdfs:subClassOf ingen:Node . +ingen:activity + a owl:DatatypeProperty ; + rdfs:domain lv2:Port ; + rdfs:label "activity" ; + rdfs:comment """ +Transient activity. This property is used in the protocol to communicate +activity at ports, such as MIDI events or audio peaks. It should never be +stored in persistent data. +""" . + +ingen:broadcast + a owl:DatatypeProperty ; + rdfs:domain lv2:Port ; + rdfs:range xsd:boolean ; + rdfs:label "broadcast" ; + rdfs:comment """ +Whether or not the port's value or activity should be broadcast to clients. +""" . + ingen:polyphonic a owl:DatatypeProperty ; rdfs:range xsd:boolean ; @@ -104,15 +143,15 @@ ingen:polyphony property of the containing graph. This is a boolean property which defines whether the parent can access each voice individually: All nodes within a graph are either polyphonic or not from their parent's perspective. An Node may itself have "internal" polyphony but not be polyphonic according to -this property, if those voices are mixed down. """ . +this property, if those voices are mixed down. +""" . ingen:Block a owl:Class ; rdfs:subClassOf ingen:Node , lv2:PluginBase ; rdfs:label "Block" ; - rdfs:comment """ - + rdfs:comment """ A signal processing block, which is typically either a plugin instance, or a graph. A block MUST have at least one ingen:prototype property which is a subclass of diff --git a/ingen/Plugin.hpp b/ingen/Plugin.hpp index bc8220da..b69c17c4 100644 --- a/ingen/Plugin.hpp +++ b/ingen/Plugin.hpp @@ -20,6 +20,7 @@ #include "raul/URI.hpp" #include "ingen/Resource.hpp" +#include "ingen/ingen.h" #include "lv2/lv2plug.in/ns/lv2core/lv2.h" @@ -41,10 +42,10 @@ public: static inline const Raul::URI& type_uri(Type type) { static const Raul::URI uris[] = { - Raul::URI("http://drobilla.net/ns/ingen#nil"), + Raul::URI("http://www.w3.org/2002/07/owl#Nothing"), Raul::URI(LV2_CORE__Plugin), - Raul::URI("http://drobilla.net/ns/ingen#Internal"), - Raul::URI("http://drobilla.net/ns/ingen#Graph") + Raul::URI(INGEN__Internal), + Raul::URI(INGEN__Graph) }; return uris[type]; diff --git a/ingen/Resource.hpp b/ingen/Resource.hpp index 3c937463..4bf3a22e 100644 --- a/ingen/Resource.hpp +++ b/ingen/Resource.hpp @@ -22,11 +22,10 @@ #include "ingen/Atom.hpp" #include "ingen/URIs.hpp" +#include "ingen/ingen.h" #include "raul/Deletable.hpp" #include "raul/URI.hpp" -#define NS_INGEN "http://drobilla.net/ns/ingen#" - namespace Ingen { /** An object with a URI described by properties. @@ -48,15 +47,15 @@ public: static Raul::URI graph_to_uri(Graph g) { switch (g) { - case Graph::DEFAULT: return Raul::URI(NS_INGEN "defaultContext"); - case Graph::EXTERNAL: return Raul::URI(NS_INGEN "externalContext"); - case Graph::INTERNAL: return Raul::URI(NS_INGEN "internalContext"); + case Graph::DEFAULT: return Raul::URI(INGEN_NS "defaultContext"); + case Graph::EXTERNAL: return Raul::URI(INGEN_NS "externalContext"); + case Graph::INTERNAL: return Raul::URI(INGEN_NS "internalContext"); } } static Graph uri_to_graph(const char* uri) { - const char* suffix = uri + sizeof(NS_INGEN) - 1; - if (strncmp(uri, NS_INGEN, sizeof(NS_INGEN) - 1)) { + const char* suffix = uri + sizeof(INGEN_NS) - 1; + if (strncmp(uri, INGEN_NS, sizeof(INGEN_NS) - 1)) { return Graph::DEFAULT; } else if (!strcmp(suffix, "defaultContext")) { return Graph::DEFAULT; @@ -117,7 +116,7 @@ public: /** Remove a property. * - * If @p value is ingen:wildcard then any property with @p uri for a + * If @p value is patch:wildcard then any property with @p uri for a * predicate will be removed. */ virtual void remove_property(const Raul::URI& uri, @@ -141,7 +140,7 @@ public: /** Remove several properties at once. * * This removes all matching properties (both key and value), or all - * properties with a matching key if the value in @p is ingen:wildcard. + * properties with a matching key if the value in @p is patch:wildcard. */ void remove_properties(const Properties& p); @@ -154,7 +153,7 @@ public: /** Hook called whenever a property value is removed. * - * If all values of a given key are removed, then value will be the wildcard. + * If all values for a key are removed, then value will be the wildcard. * * This can be used by derived classes to implement special behaviour for * particular properties (e.g. ingen:value for ports). diff --git a/ingen/URIs.hpp b/ingen/URIs.hpp index 05bfc3e1..c0e7f79f 100644 --- a/ingen/URIs.hpp +++ b/ingen/URIs.hpp @@ -84,18 +84,13 @@ public: const Quark ingen_broadcast; const Quark ingen_canvasX; const Quark ingen_canvasY; - const Quark ingen_controlBinding; - const Quark ingen_document; const Quark ingen_enabled; - const Quark ingen_engine; + const Quark ingen_file; const Quark ingen_head; const Quark ingen_incidentTo; - const Quark ingen_nil; const Quark ingen_polyphonic; const Quark ingen_polyphony; const Quark ingen_prototype; - const Quark ingen_sampleRate; - const Quark ingen_status; const Quark ingen_tail; const Quark ingen_uiEmbedded; const Quark ingen_value; @@ -130,9 +125,11 @@ public: const Quark midi_Controller; const Quark midi_MidiEvent; const Quark midi_NoteOn; + const Quark midi_binding; const Quark midi_controllerNumber; const Quark midi_noteNumber; const Quark morph_currentType; + const Quark param_sampleRate; const Quark patch_Delete; const Quark patch_Get; const Quark patch_Move; @@ -148,6 +145,7 @@ public: const Quark patch_request; const Quark patch_subject; const Quark patch_value; + const Quark patch_wildcard; const Quark pprops_logarithmic; const Quark rdf_type; const Quark rdfs_seeAlso; @@ -160,7 +158,6 @@ public: const Quark time_beatsPerMinute; const Quark time_frame; const Quark time_speed; - const Quark wildcard; }; } // namespace Ingen diff --git a/ingen/ingen.h b/ingen/ingen.h new file mode 100644 index 00000000..c3662c18 --- /dev/null +++ b/ingen/ingen.h @@ -0,0 +1,46 @@ +/* + This file is part of Ingen. + Copyright 2014 David Robillard + + Ingen is free software: you can redistribute it and/or modify it under the + terms of the GNU Affero General Public License as published by the Free + Software Foundation, either version 3 of the License, or any later version. + + Ingen is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. + + You should have received a copy of the GNU Affero General Public License + along with Ingen. If not, see . +*/ + +#ifndef INGEN_H +#define INGEN_H + +#define INGEN_NS "http://drobilla.net/ns/ingen#" + +#define INGEN__Arc INGEN_NS "Arc" +#define INGEN__Block INGEN_NS "Block" +#define INGEN__Graph INGEN_NS "Graph" +#define INGEN__GraphPrototype INGEN_NS "GraphPrototype" +#define INGEN__Internal INGEN_NS "Internal" +#define INGEN__Node INGEN_NS "Node" +#define INGEN__Plugin INGEN_NS "Plugin" +#define INGEN__activity INGEN_NS "activity" +#define INGEN__arc INGEN_NS "arc" +#define INGEN__block INGEN_NS "block" +#define INGEN__broadcast INGEN_NS "broadcast" +#define INGEN__canvasX INGEN_NS "canvasX" +#define INGEN__canvasY INGEN_NS "canvasY" +#define INGEN__enabled INGEN_NS "enabled" +#define INGEN__file INGEN_NS "file" +#define INGEN__head INGEN_NS "head" +#define INGEN__incidentTo INGEN_NS "incidentTo" +#define INGEN__polyphonic INGEN_NS "polyphonic" +#define INGEN__polyphony INGEN_NS "polyphony" +#define INGEN__prototype INGEN_NS "prototype" +#define INGEN__tail INGEN_NS "tail" +#define INGEN__uiEmbedded INGEN_NS "uiEmbedded" +#define INGEN__value INGEN_NS "value" + +#endif // INGEN_H diff --git a/src/Configuration.cpp b/src/Configuration.cpp index ad4ab09a..67899d9a 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -25,11 +25,10 @@ #include "ingen/Configuration.hpp" #include "ingen/Log.hpp" +#include "ingen/ingen.h" #include "sord/sordmm.hpp" #include "sratom/sratom.h" -#define NS_INGEN "http://drobilla.net/ns/ingen#" - namespace Ingen { Configuration::Configuration(Forge& forge) @@ -209,8 +208,8 @@ Configuration::load(const std::string& path) for (Sord::Iter i = model.find(nodemm, nil, nil); !i.end(); ++i) { const Sord::Node& pred = i.get_predicate(); const Sord::Node& obj = i.get_object(); - if (pred.to_string().substr(0, sizeof(NS_INGEN) - 1) == NS_INGEN) { - const std::string key = pred.to_string().substr(sizeof(NS_INGEN) - 1); + if (pred.to_string().substr(0, sizeof(INGEN_NS) - 1) == INGEN_NS) { + const std::string key = pred.to_string().substr(sizeof(INGEN_NS) - 1); const Keys::iterator k = _keys.find(key); if (k != _keys.end() && obj.type() == Sord::Node::LITERAL) { set_value_from_string(_options.find(k->second)->second, @@ -259,7 +258,7 @@ Configuration::save(URIMap& uri_map, // Create environment with ingen prefix SerdEnv* env = serd_env_new(&base); serd_env_set_prefix_from_strings( - env, (const uint8_t*)"ingen", (const uint8_t*)NS_INGEN); + env, (const uint8_t*)"ingen", (const uint8_t*)INGEN_NS); // Create Turtle writer SerdWriter* writer = serd_writer_new( diff --git a/src/Resource.cpp b/src/Resource.cpp index aa6adf07..79f998a0 100644 --- a/src/Resource.cpp +++ b/src/Resource.cpp @@ -53,8 +53,9 @@ Resource::set_property(const Raul::URI& uri, Properties::iterator next = i; ++next; if (i->second.context() == ctx) { + const Atom value(i->second); _properties.erase(i); - on_property_removed(uri, i->second); + on_property_removed(uri, value); } i = next; } @@ -68,7 +69,7 @@ Resource::set_property(const Raul::URI& uri, void Resource::remove_property(const Raul::URI& uri, const Atom& value) { - if (value == _uris.wildcard) { + if (value == _uris.patch_wildcard) { _properties.erase(uri); } else { for (Properties::iterator i = _properties.find(uri); @@ -163,7 +164,7 @@ Resource::set_properties(const Properties& props) // Erase existing properties with matching keys for (const auto& p : props) { _properties.erase(p.first); - on_property_removed(p.first, _uris.wildcard); + on_property_removed(p.first, _uris.patch_wildcard); } // Set new properties diff --git a/src/URIs.cpp b/src/URIs.cpp index 02e03a70..b810259b 100644 --- a/src/URIs.cpp +++ b/src/URIs.cpp @@ -16,11 +16,13 @@ #include "ingen/URIMap.hpp" #include "ingen/URIs.hpp" +#include "ingen/ingen.h" #include "lv2/lv2plug.in/ns/ext/atom/atom.h" #include "lv2/lv2plug.in/ns/ext/buf-size/buf-size.h" #include "lv2/lv2plug.in/ns/ext/log/log.h" #include "lv2/lv2plug.in/ns/ext/midi/midi.h" #include "lv2/lv2plug.in/ns/ext/morph/morph.h" +#include "lv2/lv2plug.in/ns/ext/parameters/parameters.h" #include "lv2/lv2plug.in/ns/ext/patch/patch.h" #include "lv2/lv2plug.in/ns/ext/port-props/port-props.h" #include "lv2/lv2plug.in/ns/ext/resize-port/resize-port.h" @@ -36,7 +38,6 @@ URIs::Quark::Quark(Forge& forge, URIMap* map, const char* c_str) { } -#define NS_INGEN "http://drobilla.net/ns/ingen#" #define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" #define NS_RDFS "http://www.w3.org/2000/01/rdf-schema#" @@ -62,32 +63,27 @@ URIs::URIs(Forge& f, URIMap* map) , bufsz_minBlockLength (forge, map, LV2_BUF_SIZE__minBlockLength) , bufsz_sequenceSize (forge, map, LV2_BUF_SIZE__sequenceSize) , doap_name (forge, map, "http://usefulinc.com/ns/doap#name") - , ingen_Arc (forge, map, NS_INGEN "Arc") - , ingen_Block (forge, map, NS_INGEN "Block") - , ingen_Graph (forge, map, NS_INGEN "Graph") - , ingen_GraphPrototype (forge, map, NS_INGEN "GraphPrototype") - , ingen_Internal (forge, map, NS_INGEN "Internal") - , ingen_activity (forge, map, NS_INGEN "activity") - , ingen_arc (forge, map, NS_INGEN "arc") - , ingen_block (forge, map, NS_INGEN "block") - , ingen_broadcast (forge, map, NS_INGEN "broadcast") - , ingen_canvasX (forge, map, NS_INGEN "canvasX") - , ingen_canvasY (forge, map, NS_INGEN "canvasY") - , ingen_controlBinding (forge, map, NS_INGEN "controlBinding") - , ingen_document (forge, map, NS_INGEN "document") - , ingen_enabled (forge, map, NS_INGEN "enabled") - , ingen_engine (forge, map, NS_INGEN "engine") - , ingen_head (forge, map, NS_INGEN "head") - , ingen_incidentTo (forge, map, NS_INGEN "incidentTo") - , ingen_nil (forge, map, NS_INGEN "nil") - , ingen_polyphonic (forge, map, NS_INGEN "polyphonic") - , ingen_polyphony (forge, map, NS_INGEN "polyphony") - , ingen_prototype (forge, map, NS_INGEN "prototype") - , ingen_sampleRate (forge, map, NS_INGEN "sampleRate") - , ingen_status (forge, map, NS_INGEN "status") - , ingen_tail (forge, map, NS_INGEN "tail") - , ingen_uiEmbedded (forge, map, NS_INGEN "uiEmbedded") - , ingen_value (forge, map, NS_INGEN "value") + , ingen_Arc (forge, map, INGEN__Arc) + , ingen_Block (forge, map, INGEN__Block) + , ingen_Graph (forge, map, INGEN__Graph) + , ingen_GraphPrototype (forge, map, INGEN__GraphPrototype) + , ingen_Internal (forge, map, INGEN__Internal) + , ingen_activity (forge, map, INGEN__activity) + , ingen_arc (forge, map, INGEN__arc) + , ingen_block (forge, map, INGEN__block) + , ingen_broadcast (forge, map, INGEN__broadcast) + , ingen_canvasX (forge, map, INGEN__canvasX) + , ingen_canvasY (forge, map, INGEN__canvasY) + , ingen_enabled (forge, map, INGEN__enabled) + , ingen_file (forge, map, INGEN__file) + , ingen_head (forge, map, INGEN__head) + , ingen_incidentTo (forge, map, INGEN__incidentTo) + , ingen_polyphonic (forge, map, INGEN__polyphonic) + , ingen_polyphony (forge, map, INGEN__polyphony) + , ingen_prototype (forge, map, INGEN__prototype) + , ingen_tail (forge, map, INGEN__tail) + , ingen_uiEmbedded (forge, map, INGEN__uiEmbedded) + , ingen_value (forge, map, INGEN__value) , log_Error (forge, map, LV2_LOG__Error) , log_Note (forge, map, LV2_LOG__Note) , log_Warning (forge, map, LV2_LOG__Warning) @@ -119,9 +115,11 @@ URIs::URIs(Forge& f, URIMap* map) , midi_Controller (forge, map, LV2_MIDI__Controller) , midi_MidiEvent (forge, map, LV2_MIDI__MidiEvent) , midi_NoteOn (forge, map, LV2_MIDI__NoteOn) + , midi_binding (forge, map, LV2_MIDI__binding) , midi_controllerNumber (forge, map, LV2_MIDI__controllerNumber) , midi_noteNumber (forge, map, LV2_MIDI__noteNumber) , morph_currentType (forge, map, LV2_MORPH__currentType) + , param_sampleRate (forge, map, LV2_PARAMETERS__sampleRate) , patch_Delete (forge, map, LV2_PATCH__Delete) , patch_Get (forge, map, LV2_PATCH__Get) , patch_Move (forge, map, LV2_PATCH__Move) @@ -137,6 +135,7 @@ URIs::URIs(Forge& f, URIMap* map) , patch_request (forge, map, LV2_PATCH__request) , patch_subject (forge, map, LV2_PATCH__subject) , patch_value (forge, map, LV2_PATCH__value) + , patch_wildcard (forge, map, LV2_PATCH__wildcard) , pprops_logarithmic (forge, map, LV2_PORT_PROPS__logarithmic) , rdf_type (forge, map, NS_RDF "type") , rdfs_seeAlso (forge, map, NS_RDFS "seeAlso") @@ -149,8 +148,6 @@ URIs::URIs(Forge& f, URIMap* map) , time_beatsPerMinute (forge, map, LV2_TIME__beatsPerMinute) , time_frame (forge, map, LV2_TIME__frame) , time_speed (forge, map, LV2_TIME__speed) - , wildcard (forge, map, NS_INGEN "wildcard") -{ -} +{} } // namespace Ingen diff --git a/src/World.cpp b/src/World.cpp index bb837783..2236c28e 100644 --- a/src/World.cpp +++ b/src/World.cpp @@ -29,6 +29,7 @@ #include "ingen/URIMap.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" +#include "ingen/ingen.h" #include "ingen/runtime_paths.hpp" #include "lilv/lilv.h" #include "sord/sordmm.hpp" @@ -130,7 +131,7 @@ public: rdf_world->add_prefix("atom", "http://lv2plug.in/ns/ext/atom#"); rdf_world->add_prefix("patch", "http://lv2plug.in/ns/ext/patch#"); rdf_world->add_prefix("doap", "http://usefulinc.com/ns/doap#"); - rdf_world->add_prefix("ingen", "http://drobilla.net/ns/ingen#"); + rdf_world->add_prefix("ingen", INGEN_NS); rdf_world->add_prefix("lv2", "http://lv2plug.in/ns/lv2core#"); rdf_world->add_prefix("midi", "http://lv2plug.in/ns/ext/midi#"); rdf_world->add_prefix("owl", "http://www.w3.org/2002/07/owl#"); @@ -142,7 +143,7 @@ public: LilvNode* rdf_type = lilv_new_uri( lilv_world, "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"); LilvNode* ingen_Plugin = lilv_new_uri( - lilv_world, "http://drobilla.net/ns/ingen#Plugin"); + lilv_world, INGEN__Plugin); LilvNodes* internals = lilv_world_find_nodes( lilv_world, NULL, rdf_type, ingen_Plugin); LILV_FOREACH(nodes, i, internals) { diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp index 56c74cd8..02f5f4f0 100644 --- a/src/client/ClientStore.cpp +++ b/src/client/ClientStore.cpp @@ -270,10 +270,11 @@ ClientStore::put(const Raul::URI& uri, if (p->second.is_valid() && p->second.type() == _uris.forge.URI) { if (!(plug = _plugin(Raul::URI(p->second.ptr())))) { plug = SPtr( - new PluginModel(uris(), - Raul::URI(p->second.ptr()), - _uris.ingen_nil, - Resource::Properties())); + new PluginModel( + uris(), + Raul::URI(p->second.ptr()), + Raul::URI("http://www.w3.org/2002/07/owl#Nothing"), + Resource::Properties())); add_plugin(plug); } @@ -350,7 +351,7 @@ ClientStore::set_property(const Raul::URI& subject_uri, const Raul::URI& predicate, const Atom& value) { - if (subject_uri == _uris.ingen_engine) { + if (subject_uri == Raul::URI("ingen:/engine")) { _log.info(fmt("Engine property <%1%> = %2%\n") % predicate.c_str() % _uris.forge.str(value)); return; diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 357f4a4a..1b71cf06 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -239,7 +239,7 @@ App::property_change(const Raul::URI& subject, const Raul::URI& key, const Atom& value) { - if (subject == uris().ingen_engine && key == uris().ingen_sampleRate) { + if (subject == Raul::URI("ingen:/engine") && key == uris().param_sampleRate) { if (value.type() == forge().Int) { log().info(fmt("Sample rate: %1%\n") % uris().forge.str(value)); _sample_rate = value.get(); diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 1e1669cb..081cf413 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -424,7 +424,7 @@ GraphBox::event_import() void GraphBox::event_save() { - const Atom& document = _graph->get_property(_app->uris().ingen_document); + const Atom& document = _graph->get_property(_app->uris().ingen_file); if (!document.is_valid() || document.type() != _app->uris().forge.URI) { event_save_as(); } else { @@ -470,7 +470,7 @@ GraphBox::event_save_as() dialog.set_filter(filt); // Set current folder to most sensible default - const Atom& document = _graph->get_property(uris.ingen_document); + const Atom& document = _graph->get_property(uris.ingen_file); const Atom& dir = _app->world()->conf().option("graph-directory"); if (document.type() == uris.forge.URI) dialog.set_uri(document.ptr()); @@ -540,7 +540,7 @@ GraphBox::event_save_as() const Glib::ustring uri = Glib::filename_to_uri(filename); _app->loader()->save_graph(_graph, uri); const_cast(_graph.get())->set_property( - uris.ingen_document, + uris.ingen_file, _app->forge().alloc_uri(uri.c_str()), Resource::Graph::EXTERNAL); _status_bar->push( diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index bb7c968c..f2a23f9f 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -33,6 +33,7 @@ #include "ingen/client/ClientStore.hpp" #include "ingen/client/GraphModel.hpp" #include "ingen/client/PluginModel.hpp" +#include "ingen/ingen.h" #include "ingen/serialisation/Serialiser.hpp" #include "lv2/lv2plug.in/ns/ext/atom/atom.h" @@ -563,7 +564,7 @@ serialise_arc(GanvEdge* arc, void* data) void GraphCanvas::copy_selection() { - static const char* base_uri = "http://drobilla.net/ns/ingen/selection/"; + static const char* base_uri = INGEN_NS "selection/"; Serialisation::Serialiser serialiser(*_app.world()); serialiser.start_to_string(_graph->path(), base_uri); @@ -625,7 +626,7 @@ GraphCanvas::paste() } ClashAvoider avoider(*_app.store().get(), clipboard, &clipboard); - static const char* base_uri = "http://drobilla.net/ns/ingen/selection/"; + static const char* base_uri = INGEN_NS "selection/"; parser->parse_string(_app.world(), &avoider, str, base_uri, parent, symbol); diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index 7cca3869..3c9004e3 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -108,9 +108,9 @@ GraphPortModule::store_location(double ax, double ay) { Resource::Properties remove; remove.insert(make_pair(uris.ingen_canvasX, - Resource::Property(uris.wildcard))); + Resource::Property(uris.patch_wildcard))); remove.insert(make_pair(uris.ingen_canvasY, - Resource::Property(uris.wildcard))); + Resource::Property(uris.patch_wildcard))); Resource::Properties add; add.insert(make_pair(uris.ingen_canvasX, Resource::Property(x, Resource::Graph::INTERNAL))); diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index 7185d9bd..cd801a05 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -403,9 +403,9 @@ NodeModule::store_location(double ax, double ay) { Resource::Properties remove; remove.insert(make_pair(uris.ingen_canvasX, - Resource::Property(uris.wildcard))); + Resource::Property(uris.patch_wildcard))); remove.insert(make_pair(uris.ingen_canvasY, - Resource::Property(uris.wildcard))); + Resource::Property(uris.patch_wildcard))); Resource::Properties add; add.insert(make_pair(uris.ingen_canvasX, x)); add.insert(make_pair(uris.ingen_canvasY, y)); diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 3bd0be38..f19913ac 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -92,8 +92,8 @@ void ObjectMenu::on_menu_learn() { _app->interface()->set_property(_object->uri(), - _app->uris().ingen_controlBinding, - _app->uris().wildcard); + _app->uris().midi_binding, + _app->uris().patch_wildcard); } void @@ -101,8 +101,8 @@ ObjectMenu::on_menu_unlearn() { Resource::Properties remove; remove.insert(std::make_pair( - _app->uris().ingen_controlBinding, - Resource::Property(_app->uris().wildcard))); + _app->uris().midi_binding, + Resource::Property(_app->uris().patch_wildcard))); _app->interface()->delta(_object->uri(), remove, Resource::Properties()); } diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index babc37a1..9c428dd8 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -150,7 +150,7 @@ PortMenu::on_menu_expose() const Raul::Path path = Raul::Path(block->path() + Raul::Symbol("_" + port->symbol())); Ingen::Resource r(*_object.get()); - r.remove_property(uris.lv2_index, uris.wildcard); + r.remove_property(uris.lv2_index, uris.patch_wildcard); r.set_property(uris.lv2_symbol, _app->forge().alloc(path.symbol())); r.set_property(uris.lv2_name, _app->forge().alloc(label.c_str())); diff --git a/src/gui/SubgraphModule.cpp b/src/gui/SubgraphModule.cpp index 63c70278..295d3d16 100644 --- a/src/gui/SubgraphModule.cpp +++ b/src/gui/SubgraphModule.cpp @@ -72,9 +72,9 @@ SubgraphModule::store_location(double ax, double ay) { Resource::Properties remove; remove.insert(make_pair(uris.ingen_canvasX, - Resource::Property(uris.wildcard))); + Resource::Property(uris.patch_wildcard))); remove.insert(make_pair(uris.ingen_canvasY, - Resource::Property(uris.wildcard))); + Resource::Property(uris.patch_wildcard))); Resource::Properties add; add.insert(make_pair(uris.ingen_canvasX, Resource::Property(x, Resource::Graph::EXTERNAL))); diff --git a/src/gui/ingen_gui_lv2.cpp b/src/gui/ingen_gui_lv2.cpp index 489fbf39..f2cd54e7 100644 --- a/src/gui/ingen_gui_lv2.cpp +++ b/src/gui/ingen_gui_lv2.cpp @@ -21,6 +21,7 @@ #include "ingen/client/ClientStore.hpp" #include "ingen/client/GraphModel.hpp" #include "ingen/client/SigClientInterface.hpp" +#include "ingen/ingen.h" #include "ingen/runtime_paths.hpp" #include "ingen/types.hpp" #include "lv2/lv2plug.in/ns/extensions/ui/ui.h" @@ -28,7 +29,7 @@ #include "App.hpp" #include "GraphBox.hpp" -#define INGEN_LV2_UI_URI "http://drobilla.net/ns/ingen#GraphUIGtk2" +#define INGEN_LV2_UI_URI INGEN_NS "GraphUIGtk2" namespace Ingen { diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp index c0f8cf3a..3d8ba96d 100644 --- a/src/serialisation/Parser.cpp +++ b/src/serialisation/Parser.cpp @@ -83,12 +83,12 @@ get_basename(const std::string& uri) } static bool -skip_property(const Sord::Node& predicate) +skip_property(Ingen::URIs& uris, 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); + return (predicate.to_string() == INGEN__file || + predicate.to_string() == uris.ingen_arc || + predicate.to_string() == uris.ingen_block || + predicate.to_string() == uris.lv2_port); } static Resource::Properties @@ -108,7 +108,7 @@ get_properties(Ingen::World* world, const Sord::Node nil; Resource::Properties props; for (Sord::Iter i = model.find(subject, nil, nil); !i.end(); ++i) { - if (!skip_property(i.get_predicate())) { + if (!skip_property(world->uris(), i.get_predicate())) { out.len = 0; sratom_read(sratom, &forge, world->rdf_world()->c_obj(), model.c_obj(), i.get_object().c_obj()); @@ -453,13 +453,6 @@ parse_arcs(Ingen::World* world, 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_arc(world, target, model, i.get_object(), graph); - } - return true; } @@ -605,7 +598,7 @@ Parser::parse_file(Ingen::World* world, if (parsed_path) { target->set_property(Node::path_to_uri(*parsed_path), - Raul::URI("http://drobilla.net/ns/ingen#document"), + Raul::URI(INGEN__file), world->forge().alloc_uri(uri)); } else { world->log().warn("Document URI lost\n"); diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp index bbc23081..a8140c23 100644 --- a/src/serialisation/Serialiser.cpp +++ b/src/serialisation/Serialiser.cpp @@ -525,7 +525,8 @@ Serialiser::Impl::serialise_arc(const Sord::Node& parent, static bool skip_property(Ingen::URIs& uris, const Sord::Node& predicate) { - return (predicate.to_string() == "http://drobilla.net/ns/ingen#document" || + return (predicate.to_string() == INGEN__file || + predicate.to_string() == uris.ingen_arc || predicate.to_string() == uris.ingen_block || predicate.to_string() == uris.lv2_port); } -- cgit v1.2.1