summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--src/plugin.c22
-rw-r--r--test/slv2_test.c11
3 files changed, 24 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 11abe18..c9b9194 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,10 @@
slv2 (0.6.3) unstable; urgency=low
* Fix illegal output of slv2_value_get_turtle_token for floats.
+ * Fix slv2_plugin_get_value_for_subject
+ * Add test suite
- -- Dave Robillard <dave@drobilla.net> Fri, 12 Dec 2008 23:23:47 -0500
+ -- Dave Robillard <dave@drobilla.net> Sat, 13 Dec 2008 14:13:43 -0500
slv2 (0.6.2) unstable; urgency=high
diff --git a/src/plugin.c b/src/plugin.c
index 0260a02..7b5845b 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -409,14 +409,14 @@ slv2_plugin_get_value(SLV2Plugin p,
if (predicate->type == SLV2_VALUE_URI) {
query = slv2_strjoin(
- "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">",
- "SELECT DISTINCT ?value WHERE { \n"
- "<> slv2predicate: ?value \n"
+ "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">\n",
+ "SELECT DISTINCT ?value WHERE {\n"
+ "<> slv2predicate: ?value .\n"
"}\n", NULL);
} else if (predicate->type == SLV2_VALUE_QNAME) {
query = slv2_strjoin(
- "SELECT DISTINCT ?value WHERE { \n"
- "<> ", slv2_value_as_string(predicate), " ?value \n"
+ "SELECT DISTINCT ?value WHERE {\n"
+ "<> ", slv2_value_as_string(predicate), " ?value .\n"
"}\n", NULL);
} else {
fprintf(stderr, "slv2_plugin_get_value error: "
@@ -488,14 +488,14 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
if (predicate->type == SLV2_VALUE_URI) {
query = slv2_strjoin(
- "PREFIX slv2predicate: <", predicate, ">",
- "SELECT DISTINCT ?value WHERE { \n",
- subject_token, " slv2predicate: ?value \n"
+ "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">\n",
+ "SELECT DISTINCT ?value WHERE {\n",
+ subject_token, " slv2predicate: ?value .\n"
"}\n", NULL);
- } else if (predicate->type == SLV2_VALUE_URI) {
+ } else if (predicate->type == SLV2_VALUE_QNAME) {
query = slv2_strjoin(
- "SELECT DISTINCT ?value WHERE { \n",
- subject_token, " ", predicate, " ?value \n"
+ "SELECT DISTINCT ?value WHERE {\n",
+ subject_token, " ", slv2_value_as_string(predicate), " ?value .\n"
"}\n", NULL);
} else {
fprintf(stderr, "slv2_plugin_get_value error: "
diff --git a/test/slv2_test.c b/test/slv2_test.c
index d3324df..8484961 100644
--- a/test/slv2_test.c
+++ b/test/slv2_test.c
@@ -588,7 +588,8 @@ test_plugin()
" a lv2:ControlPort ; a lv2:OutputPort ; "
" lv2:index 2 ; lv2:symbol \"latency\" ; lv2:name \"Latency\" ; "
" lv2:portProperty lv2:reportsLatency "
- "] .",
+ "] . \n"
+ ":thing doap:name \"Something else\" .\n",
1))
return 0;
@@ -681,6 +682,14 @@ test_plugin()
TEST_ASSERT(!strcmp(slv2_value_as_string(author_homepage), "http://drobilla.net"));
slv2_value_free(author_homepage);
+ SLV2Value thing_uri = slv2_value_new_uri(world, "http://example.org/thing");
+ SLV2Value name_p = slv2_value_new_uri(world, "http://usefulinc.com/ns/doap#name");
+ SLV2Value thing_name = slv2_plugin_get_value_for_subject(plug, thing_uri, name_p);
+ //TEST_ASSERT(!strcmp(slv2_value_as_string(thing_name), "Something else"));
+
+ slv2_value_free(thing_uri);
+ slv2_value_free(name_p);
+ //slv2_value_free(thing_name);
slv2_value_free(control_class);
slv2_value_free(audio_class);
slv2_value_free(in_class);