Allow solution sequence / modifier MPSPARQL-9
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 17 Feb 2015 13:21:17 +0000 (14:21 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 17 Feb 2015 13:22:35 +0000 (14:22 +0100)
Also tune the creation of whitespace a bit for "form" .

doc/filter_sparql.rnc
doc/sparql.xml
src/sparql.c

index 4e71e8c..3a97465 100644 (file)
@@ -16,6 +16,7 @@ filter_sparql =
     element mp:index {
       attribute type { xsd:string },
       xsd:string
-    }*
+    }*,
+    element mp:modifier { xsd:string }*
   }+
 
index ba4eca7..e23b149 100644 (file)
       </para>
      </listitem>
     </varlistentry>
+    <varlistentry><term>&lt;modifier/&gt;</term>
+     <listitem>
+      <para>
+       Optional section that allows you to add solution sequences or
+       modifiers.
+      </para>
+     </listitem>
+    </varlistentry>
+
    </variablelist>
   </para>
  </refsect1>
index fbd8c91..55b02e1 100644 (file)
@@ -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;