summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugin.c29
-rw-r--r--src/port.c2
-rw-r--r--src/query.c8
-rw-r--r--src/slv2_internal.h3
4 files changed, 22 insertions, 20 deletions
diff --git a/src/plugin.c b/src/plugin.c
index 19418fe..6919513 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -350,7 +350,7 @@ slv2_plugin_get_value(SLV2Plugin p,
"<> ", predicate, " ?value .\n"
"}\n", NULL);
- SLV2Values result = slv2_plugin_simple_query(p, query, "value");
+ SLV2Values result = slv2_plugin_simple_query(p, query, 0);
free(query);
@@ -370,7 +370,7 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
subject, " ", predicate, " ?value .\n"
"}\n", NULL);
- SLV2Values result = slv2_plugin_simple_query(p, query, "value");
+ SLV2Values result = slv2_plugin_simple_query(p, query, 0);
free(query);
@@ -404,20 +404,19 @@ slv2_plugin_has_latency(SLV2Plugin p)
{
const char* const query =
"ASK WHERE {\n"
- " <> lv2:port ?port .\n"
+ " <> lv2:port ?port .\n"
" ?port lv2:portHint lv2:reportsLatency ;\n"
" lv2:index ?index .\n"
"}\n";
- SLV2Values results = slv2_plugin_simple_query(p, query, "port");
+ librdf_query_results* results = slv2_plugin_query(p, query);
+ assert(librdf_query_results_is_boolean(results));
- if (results) {
- bool exists = (results && slv2_values_size(results) > 0);
- slv2_values_free(results);
- return exists;
- } else {
- return false;
- }
+ bool ret = (librdf_query_results_get_boolean(results) > 0);
+
+ librdf_free_query_results(results);
+
+ return ret;
}
@@ -431,7 +430,7 @@ slv2_plugin_get_latency_port(SLV2Plugin p)
" lv2:index ?index .\n"
"}\n";
- SLV2Values result = slv2_plugin_simple_query(p, query, "index");
+ SLV2Values result = slv2_plugin_simple_query(p, query, 0);
// FIXME: need a sane error handling strategy
assert(slv2_values_size(result) > 0);
@@ -452,7 +451,7 @@ slv2_plugin_get_supported_features(SLV2Plugin p)
" { <> lv2:requiredHostFeature ?feature }\n"
"}\n";
- SLV2Values result = slv2_plugin_simple_query(p, query, "feature");
+ SLV2Values result = slv2_plugin_simple_query(p, query, 0);
return result;
}
@@ -466,7 +465,7 @@ slv2_plugin_get_optional_features(SLV2Plugin p)
" <> lv2:optionalHostFeature ?feature .\n"
"}\n";
- SLV2Values result = slv2_plugin_simple_query(p, query, "feature");
+ SLV2Values result = slv2_plugin_simple_query(p, query, 0);
return result;
}
@@ -480,7 +479,7 @@ slv2_plugin_get_required_features(SLV2Plugin p)
" <> lv2:requiredHostFeature ?feature .\n"
"}\n";
- SLV2Values result = slv2_plugin_simple_query(p, query, "feature");
+ SLV2Values result = slv2_plugin_simple_query(p, query, 0);
return result;
}
diff --git a/src/port.c b/src/port.c
index 6744274..635b4b6 100644
--- a/src/port.c
+++ b/src/port.c
@@ -128,7 +128,7 @@ slv2_port_get_value(SLV2Plugin p,
"?port lv2:symbol \"", port->symbol, "\";\n\t",
property, " ?value .\n}", 0);
- result = slv2_plugin_simple_query(p, query, "value");
+ result = slv2_plugin_simple_query(p, query, 0);
free(query);
diff --git a/src/query.c b/src/query.c
index bc1a7dc..b7eae2d 100644
--- a/src/query.c
+++ b/src/query.c
@@ -53,7 +53,7 @@ slv2_query_lang_filter(const char* variable)
SLV2Values
slv2_query_get_variable_bindings(librdf_query_results* results,
- const char* variable)
+ int variable)
{
SLV2Values result = NULL;
@@ -63,7 +63,7 @@ slv2_query_get_variable_bindings(librdf_query_results* results,
while (!librdf_query_results_finished(results)) {
librdf_node* node =
- librdf_query_results_get_binding_value_by_name(results, variable);
+ librdf_query_results_get_binding_value(results, variable);
librdf_uri* datatype_uri = NULL;
SLV2ValueType type = SLV2_VALUE_STRING;
@@ -94,7 +94,7 @@ slv2_query_get_variable_bindings(librdf_query_results* results,
break;
case LIBRDF_NODE_TYPE_UNKNOWN:
default:
- fprintf(stderr, "Unknown variable binding type for ?%s\n", variable);
+ fprintf(stderr, "Unknown variable binding type %d\n", variable);
break;
}
@@ -158,7 +158,7 @@ slv2_plugin_query(SLV2Plugin plugin,
SLV2Values
slv2_plugin_simple_query(SLV2Plugin plugin,
const char* sparql_str,
- const char* variable)
+ unsigned variable)
{
librdf_query_results* results = slv2_plugin_query(plugin, sparql_str);
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index 180f07d..dba9832 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -66,6 +66,9 @@ SLV2Plugin slv2_plugin_new(SLV2World world, librdf_uri* uri, const char* binary_
void slv2_plugin_load(SLV2Plugin p);
void slv2_plugin_free(SLV2Plugin plugin);
+librdf_query_results* slv2_plugin_query(SLV2Plugin plugin,
+ const char* sparql_str);
+
/** Create a new, empty plugin list.
*