summaryrefslogtreecommitdiffstats
path: root/src/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Parser.cpp')
-rw-r--r--src/Parser.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/Parser.cpp b/src/Parser.cpp
index 30de26ba..7df71aa3 100644
--- a/src/Parser.cpp
+++ b/src/Parser.cpp
@@ -276,31 +276,37 @@ parse_block(Ingen::World* world,
{
const URIs& uris = world->uris();
- const Sord::URI ingen_prototype(*world->rdf_world(), uris.ingen_prototype);
- const Sord::Node nil;
-
- Sord::Iter i = model.find(subject, ingen_prototype, nil);
- if (i.end() || i.get_object().type() != Sord::Node::URI) {
- if (!i.end()) {
- std::cerr << "type: " << i.get_object().type() << std::endl;
+ // Try lv2:prototype and old ingen:prototype for backwards compatibility
+ const Sord::URI prototype_predicates[] = {
+ Sord::URI(*world->rdf_world(), uris.lv2_prototype),
+ Sord::URI(*world->rdf_world(), uris.ingen_prototype)
+ };
+
+ std::string type_uri;
+ for (const Sord::URI& prototype : prototype_predicates) {
+ Sord::Iter i = model.find(subject, prototype, Sord::Node());
+ if (!i.end() && i.get_object().type() == Sord::Node::URI) {
+ type_uri = relative_uri(base_uri,
+ i.get_object().to_string(),
+ false);
+ break;
}
+ }
+
+ if (type_uri.empty()) {
world->log().error(
- fmt("Block %1% (%2%) missing mandatory ingen:prototype\n") %
+ fmt("Block %1% (%2%) missing mandatory lv2:prototype\n") %
subject.to_string() % path);
return boost::optional<Raul::Path>();
}
- const std::string type_uri = relative_uri(base_uri,
- i.get_object().to_string(),
- false);
-
if (!serd_uri_string_has_scheme((const uint8_t*)type_uri.c_str())) {
SerdURI base_uri_parts;
serd_uri_parse((const uint8_t*)base_uri.c_str(), &base_uri_parts);
SerdURI ignored;
SerdNode sub_uri = serd_node_new_uri_from_string(
- i.get_object().to_u_string(),
+ (const uint8_t*)type_uri.c_str(),
&base_uri_parts,
&ignored);