From 23ef7a21c277ba5e864748d8e61ff3e20054758f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 30 Jan 2011 21:27:39 +0000 Subject: 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 --- src/plugin.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/plugin.c') 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)); } -- cgit v1.2.1