diff options
author | David Robillard <d@drobilla.net> | 2015-03-16 04:08:44 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-03-16 04:08:44 +0000 |
commit | ca78288b81d1a8f1e76b27fd9ecec3a3a5601bd1 (patch) | |
tree | 39b2496d1a88cfb00a58e8c0ffd26502df20bfb6 | |
parent | 1b420b15b3c88ebbcd6789f78b69bd284e0a98f7 (diff) | |
download | lilv-ca78288b81d1a8f1e76b27fd9ecec3a3a5601bd1.tar.gz lilv-ca78288b81d1a8f1e76b27fd9ecec3a3a5601bd1.tar.bz2 lilv-ca78288b81d1a8f1e76b27fd9ecec3a3a5601bd1.zip |
Load discovered owl ontologies as specifications.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5635 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/lilv_internal.h | 3 | ||||
-rw-r--r-- | src/world.c | 31 |
3 files changed, 22 insertions, 15 deletions
@@ -7,6 +7,7 @@ lilv (0.21.3) unstable; * Add lilv_state_get_uri() * Add lilv_state_delete() for deleting user saved presets * Fix creation of duplicate manifest entries when saving state + * Load discovered owl ontologies as specifications * Expose lilv_world_load_specifications() and lilv_world_load_plugin_classes() * Tolerate passing NULL to lilv_state_restore() @@ -16,7 +17,7 @@ lilv (0.21.3) unstable; * Windows fixes (thanks John Emmas) * Minor documentation improvements - -- David Robillard <d@drobilla.net> Sat, 07 Mar 2015 03:31:04 -0500 + -- David Robillard <d@drobilla.net> Mon, 16 Mar 2015 00:06:31 -0400 lilv (0.20.0) stable; diff --git a/src/lilv_internal.h b/src/lilv_internal.h index cd4a621..e2444d3 100644 --- a/src/lilv_internal.h +++ b/src/lilv_internal.h @@ -176,7 +176,7 @@ struct LilvWorldImpl { SordNode* lv2_requiredFeature; SordNode* lv2_symbol; SordNode* lv2_prototype; - SordNode* null_uri; + SordNode* owl_Ontology; SordNode* pset_value; SordNode* rdf_a; SordNode* rdf_value; @@ -189,6 +189,7 @@ struct LilvWorldImpl { SordNode* xsd_decimal; SordNode* xsd_double; SordNode* xsd_integer; + SordNode* null_uri; } uris; LilvOptions opt; }; diff --git a/src/world.c b/src/world.c index 2855885..a25d810 100644 --- a/src/world.c +++ b/src/world.c @@ -46,6 +46,7 @@ lilv_world_new(void) #define NS_DCTERMS "http://purl.org/dc/terms/" #define NS_DYNMAN "http://lv2plug.in/ns/ext/dynmanifest#" +#define NS_OWL "http://www.w3.org/2002/07/owl#" #define NEW_URI(uri) sord_new_uri(world->world, (const uint8_t*)uri) @@ -71,6 +72,7 @@ lilv_world_new(void) world->uris.lv2_requiredFeature = NEW_URI(LV2_CORE__requiredFeature); world->uris.lv2_symbol = NEW_URI(LV2_CORE__symbol); world->uris.lv2_prototype = NEW_URI(LV2_CORE__prototype); + world->uris.owl_Ontology = NEW_URI(NS_OWL "Ontology"); world->uris.pset_value = NEW_URI(LV2_PRESETS__value); world->uris.rdf_a = NEW_URI(LILV_NS_RDF "type"); world->uris.rdf_value = NEW_URI(LILV_NS_RDF "value"); @@ -186,7 +188,7 @@ lilv_world_find_nodes(LilvWorld* world, LILV_ERROR("Both subject and object are NULL\n"); return NULL; } - + return lilv_world_find_nodes_internal(world, subject ? subject->node : NULL, predicate->node, @@ -594,7 +596,7 @@ lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri) lilv_node_free(manifest); return; } - + // ?plugin a lv2:Plugin SordIter* plug_results = sord_search(world->model, NULL, @@ -609,17 +611,20 @@ lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri) lilv_world_load_dyn_manifest(world, bundle_node, manifest); - // ?specification a lv2:Specification - SordIter* spec_results = sord_search(world->model, - NULL, - world->uris.rdf_a, - world->uris.lv2_Specification, - bundle_node); - FOREACH_MATCH(spec_results) { - const SordNode* spec = sord_iter_get_node(spec_results, SORD_SUBJECT); - lilv_world_add_spec(world, spec, bundle_node); + // ?spec a lv2:Specification + // ?spec a owl:Ontology + const SordNode* spec_preds[] = { world->uris.lv2_Specification, + world->uris.owl_Ontology, + NULL }; + for (const SordNode** p = spec_preds; *p; ++p) { + SordIter* i = sord_search( + world->model, NULL, world->uris.rdf_a, *p, bundle_node); + FOREACH_MATCH(i) { + const SordNode* spec = sord_iter_get_node(i, SORD_SUBJECT); + lilv_world_add_spec(world, spec, bundle_node); + } + sord_iter_free(i); } - sord_iter_free(spec_results); lilv_node_free(manifest); } @@ -833,7 +838,7 @@ lilv_world_load_file(LilvWorld* world, SerdReader* reader, const LilvNode* uri) LILV_ERRORF("Error loading file `%s'\n", lilv_node_as_string(uri)); return st; } - + zix_tree_insert((ZixTree*)world->loaded_files, lilv_node_duplicate(uri), NULL); |