summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-04-12 00:11:46 +0000
committerDavid Robillard <d@drobilla.net>2012-04-12 00:11:46 +0000
commit6b6e3e31386b52bed8fbae531d72ea546b005d7e (patch)
tree146ef655dd38fd5d2688cad76248e3a903838eda /src
parent3047c5346364ee6ae10e7a41dab53eba96350030 (diff)
downloadlilv-6b6e3e31386b52bed8fbae531d72ea546b005d7e.tar.gz
lilv-6b6e3e31386b52bed8fbae531d72ea546b005d7e.tar.bz2
lilv-6b6e3e31386b52bed8fbae531d72ea546b005d7e.zip
Remove pointless lilv_world_find_statements() wrapper and use new sord_search().
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4169 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/state.c25
-rw-r--r--src/world.c67
2 files changed, 36 insertions, 56 deletions
diff --git a/src/state.c b/src/state.c
index 0a4af18..82ed8df 100644
--- a/src/state.c
+++ b/src/state.c
@@ -418,8 +418,7 @@ lilv_state_restore(const LilvState* state,
static SordNode*
get1(SordModel* model, const SordNode* s, const SordNode* p)
{
- const SordQuad pat = { s, p, NULL, NULL };
- SordIter* const i = sord_find(model, pat);
+ SordIter* const i = sord_search(model, s, p, 0, 0);
SordNode* const node = i ? sord_node_copy(sord_iter_get_node(i, SORD_OBJECT)) : NULL;
sord_iter_free(i);
return node;
@@ -438,8 +437,7 @@ new_state_from_model(LilvWorld* world,
state->atom_Path = map->map(map->handle, LV2_ATOM__Path);
// Get the plugin URI this state applies to
- const SordQuad upat = { node, world->uris.lv2_appliesTo, NULL, NULL };
- SordIter* i = sord_find(model, upat);
+ SordIter* i = sord_search(model, node, world->uris.lv2_appliesTo, 0, 0);
if (i) {
const SordNode* object = sord_iter_get_node(i, SORD_OBJECT);
const SordNode* graph = sord_iter_get_node(i, SORD_GRAPH);
@@ -454,8 +452,7 @@ new_state_from_model(LilvWorld* world,
}
// Get the state label
- const SordQuad lpat = { node, world->uris.rdfs_label, NULL, NULL };
- i = sord_find(model, lpat);
+ i = sord_search(model, node, world->uris.rdfs_label, NULL, NULL);
if (i) {
const SordNode* object = sord_iter_get_node(i, SORD_OBJECT);
const SordNode* graph = sord_iter_get_node(i, SORD_GRAPH);
@@ -474,8 +471,7 @@ new_state_from_model(LilvWorld* world,
&forge, sratom_forge_sink, sratom_forge_deref, &chunk);
// Get port values
- const SordQuad ppat = { node, world->uris.lv2_port, NULL, NULL };
- SordIter* ports = sord_find(model, ppat);
+ SordIter* ports = sord_search(model, node, world->uris.lv2_port, 0, 0);
FOREACH_MATCH(ports) {
const SordNode* port = sord_iter_get_node(ports, SORD_OBJECT);
const SordNode* label = get1(model, port, world->uris.rdfs_label);
@@ -509,9 +505,7 @@ new_state_from_model(LilvWorld* world,
SordNode* statep = sord_new_uri(world->world, USTR(LV2_STATE__state));
const SordNode* state_node = get1(model, node, statep);
if (state_node) {
- const SordQuad spat = { state_node, NULL, NULL };
- SordIter* props = sord_find(model, spat);
-
+ SordIter* props = sord_search(model, state_node, 0, 0, 0);
FOREACH_MATCH(props) {
const SordNode* p = sord_iter_get_node(props, SORD_PREDICATE);
const SordNode* o = sord_iter_get_node(props, SORD_OBJECT);
@@ -638,11 +632,10 @@ lilv_state_new_from_string(LilvWorld* world,
set_prefixes(env);
serd_reader_read_string(reader, USTR(str));
- const SordNode* p = sord_new_uri(world->world, USTR(LILV_NS_RDF "type"));
- const SordNode* o = sord_new_uri(world->world, USTR(NS_PSET "Preset"));
- const SordQuad pat = { NULL, p, o, NULL };
- SordIter* const i = sord_find(model, pat);
- const SordNode* s = sord_iter_get_node(i, SORD_SUBJECT);
+ const SordNode* p = sord_new_uri(world->world, USTR(LILV_NS_RDF "type"));
+ const SordNode* o = sord_new_uri(world->world, USTR(NS_PSET "Preset"));
+ SordIter* const i = sord_search(model, NULL, p, o, NULL);
+ const SordNode* s = sord_iter_get_node(i, SORD_SUBJECT);
LilvState* state = new_state_from_model(world, map, model, s, NULL);
diff --git a/src/world.c b/src/world.c
index 3c499f9..db1eaf8 100644
--- a/src/world.c
+++ b/src/world.c
@@ -173,18 +173,6 @@ lilv_world_set_option(LilvWorld* world,
LILV_WARNF("Unrecognized or invalid option `%s'\n", option);
}
-static SordIter*
-lilv_world_find_statements(const LilvWorld* world,
- SordModel* model,
- const SordNode* subject,
- const SordNode* predicate,
- const SordNode* object,
- const SordNode* graph)
-{
- SordQuad pat = { subject, predicate, object, graph };
- return sord_find(model, pat);
-}
-
LILV_API
LilvNodes*
lilv_world_find_nodes(LilvWorld* world,
@@ -227,8 +215,7 @@ lilv_world_query_internal(LilvWorld* world,
const SordNode* predicate,
const SordNode* object)
{
- return lilv_world_find_statements(world, world->model,
- subject, predicate, object, NULL);
+ return sord_search(world->model, subject, predicate, object, NULL);
}
LilvNodes*
@@ -302,8 +289,8 @@ lilv_world_add_spec(LilvWorld* world,
spec->data_uris = lilv_nodes_new();
// Add all plugin data files (rdfs:seeAlso)
- SordIter* files = lilv_world_find_statements(
- world, world->model,
+ SordIter* files = sord_search(
+ world->model,
specification_node,
world->uris.rdfs_seeAlso,
NULL,
@@ -359,8 +346,8 @@ lilv_world_add_plugin(LilvWorld* world,
#endif
// Add all plugin data files (rdfs:seeAlso)
- SordIter* files = lilv_world_find_statements(
- world, world->model,
+ SordIter* files = sord_search(
+ world->model,
plugin_node,
world->uris.rdfs_seeAlso,
NULL,
@@ -391,8 +378,8 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
LV2_Dyn_Manifest_Handle handle = NULL;
// ?dman a dynman:DynManifest
- SordIter* dmanifests = lilv_world_find_statements(
- world, world->model,
+ SordIter* dmanifests = sord_search(
+ world->model,
NULL,
world->uris.rdf_a,
world->uris.dman_DynManifest,
@@ -401,8 +388,8 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
const SordNode* dmanifest = sord_iter_get_node(dmanifests, SORD_SUBJECT);
// ?dman lv2:binary ?binary
- SordIter* binaries = lilv_world_find_statements(
- world, world->model,
+ SordIter* binaries = sord_search(
+ world->model,
dmanifest,
world->uris.lv2_binary,
NULL,
@@ -480,8 +467,8 @@ lilv_world_load_dyn_manifest(LilvWorld* world,
fclose(fd);
// ?plugin a lv2:Plugin
- SordIter* plug_results = lilv_world_find_statements(
- world, world->model,
+ SordIter* plug_results = sord_search(
+ world->model,
NULL,
world->uris.rdf_a,
world->uris.lv2_Plugin,
@@ -528,8 +515,8 @@ lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri)
}
// ?plugin a lv2:Plugin
- SordIter* plug_results = lilv_world_find_statements(
- world, world->model,
+ SordIter* plug_results = sord_search(
+ world->model,
NULL,
world->uris.rdf_a,
world->uris.lv2_Plugin,
@@ -544,8 +531,8 @@ lilv_world_load_bundle(LilvWorld* world, LilvNode* bundle_uri)
lilv_world_load_dyn_manifest(world, bundle_node, manifest_uri);
// ?specification a lv2:Specification
- SordIter* spec_results = lilv_world_find_statements(
- world, world->model,
+ SordIter* spec_results = sord_search(
+ world->model,
NULL,
world->uris.rdf_a,
world->uris.lv2_Specification,
@@ -661,8 +648,8 @@ lilv_world_load_plugin_classes(LilvWorld* world)
a menu), they won't be seen anyway...
*/
- SordIter* classes = lilv_world_find_statements(
- world, world->model,
+ SordIter* classes = sord_search(
+ world->model,
NULL,
world->uris.rdf_a,
world->uris.rdfs_Class,
@@ -671,8 +658,8 @@ lilv_world_load_plugin_classes(LilvWorld* world)
const SordNode* class_node = sord_iter_get_node(classes, SORD_SUBJECT);
// Get parents (superclasses)
- SordIter* parents = lilv_world_find_statements(
- world, world->model,
+ SordIter* parents = sord_search(
+ world->model,
class_node,
world->uris.rdfs_subClassOf,
NULL,
@@ -692,8 +679,8 @@ lilv_world_load_plugin_classes(LilvWorld* world)
}
// Get labels
- SordIter* labels = lilv_world_find_statements(
- world, world->model,
+ SordIter* labels = sord_search(
+ world->model,
class_node,
world->uris.rdfs_label,
NULL,
@@ -735,8 +722,8 @@ lilv_world_load_all(LilvWorld* world)
(ZixTree*)world->plugins, p);
// ?new dc:replaces plugin
- SordIter* replacement = lilv_world_find_statements(
- world, world->model,
+ SordIter* replacement = sord_search(
+ world->model,
NULL,
world->uris.dc_replaces,
lilv_node_as_node(lilv_plugin_get_uri(plugin)),
@@ -766,10 +753,10 @@ lilv_world_load_resource(LilvWorld* world,
}
int n_read = 0;
- SordIter* files = lilv_world_find_statements(world, world->model,
- resource->val.uri_val,
- world->uris.rdfs_seeAlso,
- NULL, NULL);
+ SordIter* files = sord_search(world->model,
+ resource->val.uri_val,
+ world->uris.rdfs_seeAlso,
+ NULL, NULL);
FOREACH_MATCH(files) {
const SordNode* file = sord_iter_get_node(files, SORD_OBJECT);
const uint8_t* str = sord_node_get_string(file);