From 97efaf4488f116981d794ae045cbd1fd5d38e25c Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 17 Feb 2015 14:21:17 +0100 Subject: [PATCH] Allow solution sequence / modifier MPSPARQL-9 Also tune the creation of whitespace a bit for "form" . --- doc/filter_sparql.rnc | 3 ++- doc/sparql.xml | 9 +++++++++ src/sparql.c | 17 ++++++++++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/filter_sparql.rnc b/doc/filter_sparql.rnc index 4e71e8c..3a97465 100644 --- a/doc/filter_sparql.rnc +++ b/doc/filter_sparql.rnc @@ -16,6 +16,7 @@ filter_sparql = element mp:index { attribute type { xsd:string }, xsd:string - }* + }*, + element mp:modifier { xsd:string }* }+ diff --git a/doc/sparql.xml b/doc/sparql.xml index ba4eca7..e23b149 100644 --- a/doc/sparql.xml +++ b/doc/sparql.xml @@ -77,6 +77,15 @@ + <modifier/> + + + Optional section that allows you to add solution sequences or + modifiers. + + + + diff --git a/src/sparql.c b/src/sparql.c index fbd8c91..55b02e1 100644 --- a/src/sparql.c +++ b/src/sparql.c @@ -326,21 +326,23 @@ int yaz_sparql_from_rpn_stream(yaz_sparql_t s, { ; } + else if (!strcmp(e->pattern, "modifier")) + { + ; + } else { errors++; } } - pr("\n", client_data); for (e = s->conf; e; e = e->next) { if (!strcmp(e->pattern, "form")) { - pr(" ", client_data); pr(e->value, client_data); + pr("\n", client_data); } } - pr("\n", client_data); pr("WHERE {\n", client_data); for (e = s->conf; e; e = e->next) { @@ -397,6 +399,15 @@ int yaz_sparql_from_rpn_stream(yaz_sparql_t s, wrbuf_destroy(vars); } pr("\n}\n", client_data); + + for (e = s->conf; e; e = e->next) + { + if (!strcmp(e->pattern, "modifier")) + { + pr(e->value, client_data); + pr(e->value, "\n"); + } + } yaz_tok_cfg_destroy(cfg); return errors ? -1 : r; -- 1.7.10.4