summaryrefslogtreecommitdiffstats
path: root/src/plugin.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-30 21:27:39 +0000
committerDavid Robillard <d@drobilla.net>2011-01-30 21:27:39 +0000
commit23ef7a21c277ba5e864748d8e61ff3e20054758f (patch)
tree1f2b2fae3e84b48b0fd2739b6f5a3dba5ed80c35 /src/plugin.c
parent2c17ab25b34cdada738182daf72607eaa2d3673e (diff)
downloadlilv-23ef7a21c277ba5e864748d8e61ff3e20054758f.tar.gz
lilv-23ef7a21c277ba5e864748d8e61ff3e20054758f.tar.bz2
lilv-23ef7a21c277ba5e864748d8e61ff3e20054758f.zip
Add blank node type for value, to allow the user to 'join' statement
queries on blank node values with the simple get_value functions. Remove use of SPARQL from lv2_inspect. git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2874 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/plugin.c')
-rw-r--r--src/plugin.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 45177e1..a7e211e 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -522,8 +522,8 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
SLV2Value subject,
SLV2Value predicate)
{
- if ( ! slv2_value_is_uri(subject)) {
- SLV2_ERROR("Subject is not a URI\n");
+ if ( ! slv2_value_is_uri(subject) && ! slv2_value_is_blank(subject)) {
+ SLV2_ERROR("Subject is not a resource\n");
return NULL;
}
if ( ! slv2_value_is_uri(predicate)) {
@@ -531,9 +531,15 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
return NULL;
}
+ librdf_node* subject_node = (slv2_value_is_uri(subject))
+ ? librdf_new_node_from_uri(
+ p->world->world, subject->val.uri_val)
+ : librdf_new_node_from_blank_identifier(
+ p->world->world, (const uint8_t*)slv2_value_as_blank(subject));
+
return slv2_plugin_query_node(
p,
- librdf_new_node_from_uri(p->world->world, subject->val.uri_val),
+ subject_node,
librdf_new_node_from_uri(p->world->world, predicate->val.uri_val));
}