Config for record retrieval should be called present MPSPARQL-16
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 30 Apr 2015 08:48:42 +0000 (10:48 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 30 Apr 2015 08:48:42 +0000 (10:48 +0200)
Rather than uri .

src/sparql.c
src/test_sparql.c

index 0ce6c40..3905347 100644 (file)
@@ -359,6 +359,10 @@ static int emit_prefixes(yaz_sparql_t s,
         {
             ;
         }
+        else if (!strncmp(e->pattern, "present", 7))
+        {
+            ;
+        }
         else if (!strncmp(e->pattern, "uri", 3))
         {
             ;
@@ -378,6 +382,11 @@ struct sparql_entry *lookup_schema(yaz_sparql_t s, const char *schema)
 
     for (e = s->conf; e; e = e->next)
     {
+        if (!strncmp(e->pattern, "present.", 8))
+        {
+            if (!schema || !strcmp(e->pattern + 8, schema))
+                break;
+        }
         if (!strncmp(e->pattern, "uri.", 4))
         {
             if (!schema || !strcmp(e->pattern + 4, schema))
index 4bd27a0..718f9f7 100644 (file)
@@ -151,6 +151,7 @@ static void tst1(void)
     yaz_sparql_add_pattern(s, "index.bf.isbn", "?inst bf:ISBN %s");
 
     yaz_sparql_add_pattern(s, "uri.full", "SELECT ?sub ?rel WHERE ?work = %u");
+    yaz_sparql_add_pattern(s, "present.brief", "SELECT %u");
 
     YAZ_CHECK(test_uri(s, "http://x/y", "full",
                        "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns>\n"
@@ -158,6 +159,13 @@ static void tst1(void)
                        "PREFIX gs: <http://gs.com/panorama/domain-model>\n"
                        "SELECT ?sub ?rel WHERE ?work = <http://x/y>\n"));
 
+
+    YAZ_CHECK(test_uri(s, "http://x/z", "brief",
+                       "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns>\n"
+                       "PREFIX bf: <http://bibframe.org/vocab/>\n"
+                       "PREFIX gs: <http://gs.com/panorama/domain-model>\n"
+                       "SELECT <http://x/z>\n"));
+
     YAZ_CHECK(test_query(
                   s, "@attr 1=bf.title computer",
                   "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns>\n"