summaryrefslogtreecommitdiffstats
path: root/src/query.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-06-17 01:34:39 +0000
committerDavid Robillard <d@drobilla.net>2009-06-17 01:34:39 +0000
commitcec6214d6820ff7f0ddfc6d12c4de8f6d777e6f0 (patch)
tree1e9df10c5322cd6cb617cc00613d4c5f4418807a /src/query.c
parent933263cfc85ec3464ad1e28dc7e781a3c2e9f2c4 (diff)
downloadlilv-cec6214d6820ff7f0ddfc6d12c4de8f6d777e6f0.tar.gz
lilv-cec6214d6820ff7f0ddfc6d12c4de8f6d777e6f0.tar.bz2
lilv-cec6214d6820ff7f0ddfc6d12c4de8f6d777e6f0.zip
Remove duplicate slv2_value_new_librdf_node and slv2_value_from_librdf_node.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@2122 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/query.c')
-rw-r--r--src/query.c48
1 files changed, 3 insertions, 45 deletions
diff --git a/src/query.c b/src/query.c
index 2400b86..01114e6 100644
--- a/src/query.c
+++ b/src/query.c
@@ -39,48 +39,6 @@ static const char* slv2_query_prefixes =
"PREFIX lv2ev: <http://lv2plug.in/ns/ext/event#>\n";
-/** Create a new SLV2Value from a librdf_node, or return NULL if impossible */
-SLV2Value
-slv2_value_from_librdf_node(SLV2World world, librdf_node* node)
-{
- SLV2Value result = NULL;
-
- librdf_uri* datatype_uri = NULL;
- SLV2ValueType type = SLV2_VALUE_STRING;
-
- switch (librdf_node_get_type(node)) {
- case LIBRDF_NODE_TYPE_RESOURCE:
- type = SLV2_VALUE_URI;
- result = slv2_value_new_librdf_uri(world, librdf_node_get_uri(node));
- break;
- case LIBRDF_NODE_TYPE_LITERAL:
- datatype_uri = librdf_node_get_literal_value_datatype_uri(node);
- if (datatype_uri) {
- if (!strcmp((const char*)librdf_uri_as_string(datatype_uri),
- "http://www.w3.org/2001/XMLSchema#integer"))
- type = SLV2_VALUE_INT;
- else if (!strcmp((const char*)librdf_uri_as_string(datatype_uri),
- "http://www.w3.org/2001/XMLSchema#decimal"))
- type = SLV2_VALUE_FLOAT;
- else
- SLV2_ERRORF("Unknown datatype %s\n", librdf_uri_as_string(datatype_uri));
- }
- result = slv2_value_new(world, type, (const char*)librdf_node_get_literal_value(node));
- break;
- case LIBRDF_NODE_TYPE_BLANK:
- type = SLV2_VALUE_STRING;
- result = slv2_value_new(world, type, (const char*)librdf_node_get_blank_identifier(node));
- break;
- case LIBRDF_NODE_TYPE_UNKNOWN:
- default:
- SLV2_ERRORF("Unknown RDF node type %d\n", librdf_node_get_type(node));
- break;
- }
-
- return result;
-}
-
-
SLV2Values
slv2_query_get_variable_bindings(SLV2World world,
SLV2Results results,
@@ -100,7 +58,7 @@ slv2_query_get_variable_bindings(SLV2World world,
continue;
}
- SLV2Value val = slv2_value_from_librdf_node(world, node);
+ SLV2Value val = slv2_value_new_librdf_node(world, node);
if (val)
raptor_sequence_push(result, val);
@@ -175,7 +133,7 @@ slv2_results_finished(SLV2Results results)
SLV2Value
slv2_results_get_binding_value(SLV2Results results, unsigned index)
{
- return slv2_value_from_librdf_node(results->world,
+ return slv2_value_new_librdf_node(results->world,
librdf_query_results_get_binding_value(
results->rdf_results, index));
}
@@ -184,7 +142,7 @@ slv2_results_get_binding_value(SLV2Results results, unsigned index)
SLV2Value
slv2_results_get_binding_value_by_name(SLV2Results results, const char* name)
{
- return slv2_value_from_librdf_node(results->world,
+ return slv2_value_new_librdf_node(results->world,
librdf_query_results_get_binding_value_by_name(
results->rdf_results, name));
}