summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugin.c49
-rw-r--r--src/port.c28
-rw-r--r--src/slv2_internal.h2
-rw-r--r--src/value.c4
4 files changed, 24 insertions, 59 deletions
diff --git a/src/plugin.c b/src/plugin.c
index b58a3ec..1986f2c 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -404,23 +404,11 @@ slv2_plugin_get_value(SLV2Plugin p,
char* query = NULL;
/* Hack around broken RASQAL, full URI predicates don't work :/ */
-
- if (predicate->type == SLV2_VALUE_URI) {
- query = slv2_strjoin(
- "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"
- "}\n", NULL);
- } else {
- fprintf(stderr, "slv2_plugin_get_value error: "
- "predicate is not a URI or QNAME\n");
- return NULL;
- }
+ query = slv2_strjoin(
+ "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">\n",
+ "SELECT DISTINCT ?value WHERE {\n"
+ "<> slv2predicate: ?value .\n"
+ "}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
@@ -480,27 +468,16 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
char* query = NULL;
- /* Hack around broken RASQAL, full URI predicates don't work :/ */
+
char* subject_token = slv2_value_get_turtle_token(subject);
- if (predicate->type == SLV2_VALUE_URI) {
- query = slv2_strjoin(
- "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_QNAME) {
- query = slv2_strjoin(
- "SELECT DISTINCT ?value WHERE {\n",
- subject_token, " ", slv2_value_as_string(predicate), " ?value .\n"
- "}\n", NULL);
- } else {
- fprintf(stderr, "slv2_plugin_get_value error: "
- "predicate is not a URI or QNAME\n");
- free(subject_token);
- return NULL;
- }
+ /* Hack around broken RASQAL, full URI predicates don't work :/ */
+ query = slv2_strjoin(
+ "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">\n",
+ "SELECT DISTINCT ?value WHERE {\n",
+ subject_token, " slv2predicate: ?value .\n"
+ "}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
@@ -514,6 +491,7 @@ slv2_plugin_get_value_for_subject(SLV2Plugin p,
SLV2Values
slv2_plugin_get_properties(SLV2Plugin p)
{
+ // FIXME: APIBREAK: This predicate does not even exist. Remove this function.
return slv2_plugin_get_value_by_qname(p, "lv2:pluginProperty");
}
@@ -521,6 +499,7 @@ slv2_plugin_get_properties(SLV2Plugin p)
SLV2Values
slv2_plugin_get_hints(SLV2Plugin p)
{
+ // FIXME: APIBREAK: This predicate does not even exist. Remove this function.
return slv2_plugin_get_value_by_qname(p, "lv2:pluginHint");
}
diff --git a/src/port.c b/src/port.c
index bf7ab19..e72aba0 100644
--- a/src/port.c
+++ b/src/port.c
@@ -156,27 +156,13 @@ slv2_port_get_value(SLV2Plugin p,
char* query = NULL;
/* Hack around broken RASQAL, full URI predicates don't work :/ */
-
- if (predicate->type == SLV2_VALUE_URI) {
- query = slv2_strjoin(
- "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">",
- "SELECT DISTINCT ?value WHERE { \n"
- "<", slv2_value_as_uri(p->plugin_uri), "> lv2:port ?port .\n"
- "?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n\t",
- " slv2predicate: ?value .\n"
- "}\n", NULL);
- } else if (predicate->type == SLV2_VALUE_QNAME) {
- query = slv2_strjoin(
- "SELECT DISTINCT ?value WHERE { \n"
- "<", slv2_value_as_uri(p->plugin_uri), "> lv2:port ?port .\n"
- "?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n\t",
- slv2_value_as_string(predicate), " ?value .\n"
- "}\n", NULL);
- } else {
- fprintf(stderr, "slv2_port_get_value error: "
- "predicate is not a URI or QNAME\n");
- return NULL;
- }
+ query = slv2_strjoin(
+ "PREFIX slv2predicate: <", slv2_value_as_string(predicate), ">",
+ "SELECT DISTINCT ?value WHERE { \n"
+ "<", slv2_value_as_uri(p->plugin_uri), "> lv2:port ?port .\n"
+ "?port lv2:symbol \"", slv2_value_as_string(port->symbol), "\";\n\t",
+ " slv2predicate: ?value .\n"
+ "}\n", NULL);
SLV2Values result = slv2_plugin_query_variable(p, query, 0);
diff --git a/src/slv2_internal.h b/src/slv2_internal.h
index ecb7255..9aea9f9 100644
--- a/src/slv2_internal.h
+++ b/src/slv2_internal.h
@@ -188,7 +188,7 @@ void slv2_ui_free(SLV2UI ui);
typedef enum _SLV2ValueType {
SLV2_VALUE_URI,
- SLV2_VALUE_QNAME,
+ SLV2_VALUE_QNAME_UNUSED, ///< FIXME: APIBREAK: remove
SLV2_VALUE_STRING,
SLV2_VALUE_INT,
SLV2_VALUE_FLOAT,
diff --git a/src/value.c b/src/value.c
index ba39754..ae24a68 100644
--- a/src/value.c
+++ b/src/value.c
@@ -208,8 +208,8 @@ slv2_value_equals(SLV2Value value, SLV2Value other)
switch (value->type) {
case SLV2_VALUE_URI:
return (librdf_uri_equals(value->val.uri_val, other->val.uri_val) != 0);
- case SLV2_VALUE_QNAME:
case SLV2_VALUE_STRING:
+ case SLV2_VALUE_QNAME_UNUSED:
return ! strcmp(value->str_val, other->str_val);
case SLV2_VALUE_INT:
return (value->val.int_val == other->val.int_val);
@@ -236,8 +236,8 @@ slv2_value_get_turtle_token(SLV2Value value)
result = calloc(len, sizeof(char));
snprintf(result, len, "<%s>", value->str_val);
break;
- case SLV2_VALUE_QNAME:
case SLV2_VALUE_STRING:
+ case SLV2_VALUE_QNAME_UNUSED:
result = strdup(value->str_val);
break;
case SLV2_VALUE_INT: