summaryrefslogtreecommitdiffstats
path: root/src/query.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-16 04:59:14 +0000
committerDavid Robillard <d@drobilla.net>2011-12-16 04:59:14 +0000
commitb8eb516e97042ca9559aaa506becf504180df0a8 (patch)
tree26fdb669e20b70b9927c1bd62723c48b6947dddc /src/query.c
parent3af74220b27e5b5b2bfa7061eb773d0a563d2600 (diff)
downloadlilv-b8eb516e97042ca9559aaa506becf504180df0a8.tar.gz
lilv-b8eb516e97042ca9559aaa506becf504180df0a8.tar.bz2
lilv-b8eb516e97042ca9559aaa506becf504180df0a8.zip
Fix lilv_world_find_nodes to work with wildcard subjects.
Add lilv_plugin_get_related to get resources related to plugins that are not directly rdfs:seeAlso linked (e.g. presets). Add lilv_world_load_resource for related resources (e.g. presets). Print presets in lv2info. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@3877 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/query.c')
-rw-r--r--src/query.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/query.c b/src/query.c
index e465a67..40387ef 100644
--- a/src/query.c
+++ b/src/query.c
@@ -53,14 +53,17 @@ lilv_lang_matches(const char* a, const char* b)
LilvNodes*
lilv_nodes_from_stream_objects_i18n(LilvWorld* world,
- SordIter* stream)
+ SordIter* stream,
+ bool object)
{
LilvNodes* values = lilv_nodes_new();
const SordNode* nolang = NULL; // Untranslated value
const SordNode* partial = NULL; // Partial language match
char* syslang = lilv_get_lang();
FOREACH_MATCH(stream) {
- const SordNode* value = lilv_match_object(stream);
+ const SordNode* value = object
+ ? lilv_match_object(stream)
+ : lilv_match_subject(stream);
if (sord_node_get_type(value) == SORD_LITERAL) {
const char* lang = sord_node_get_language(value);
LilvLangMatch lm = LILV_LANG_MATCH_NONE;
@@ -117,20 +120,23 @@ lilv_nodes_from_stream_objects_i18n(LilvWorld* world,
LilvNodes*
lilv_nodes_from_stream_objects(LilvWorld* world,
- SordIter* stream)
+ SordIter* stream,
+ bool object)
{
if (lilv_matches_end(stream)) {
lilv_match_end(stream);
return NULL;
} else if (world->opt.filter_language) {
- return lilv_nodes_from_stream_objects_i18n(world, stream);
+ return lilv_nodes_from_stream_objects_i18n(world, stream, object);
} else {
LilvNodes* values = lilv_nodes_new();
FOREACH_MATCH(stream) {
- LilvNode* value = lilv_node_new_from_node(
- world, lilv_match_object(stream));
- if (value) {
- zix_tree_insert(values, value, NULL);
+ const SordNode* value = object
+ ? lilv_match_object(stream)
+ : lilv_match_subject(stream);
+ LilvNode* node = lilv_node_new_from_node(world, value);
+ if (node) {
+ zix_tree_insert(values, node, NULL);
}
}
lilv_match_end(stream);