From: Adam Dickmeiss Date: Thu, 30 Apr 2015 08:48:42 +0000 (+0200) Subject: Config for record retrieval should be called present MPSPARQL-16 X-Git-Tag: v0.6~46 X-Git-Url: http://git.indexdata.com/?p=mp-sparql-moved-to-github.git;a=commitdiff_plain;h=c30ad7a532b4384a50c5036f5b289d36d06fdb24 Config for record retrieval should be called present MPSPARQL-16 Rather than uri . --- diff --git a/src/sparql.c b/src/sparql.c index 0ce6c40..3905347 100644 --- a/src/sparql.c +++ b/src/sparql.c @@ -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)) diff --git a/src/test_sparql.c b/src/test_sparql.c index 4bd27a0..718f9f7 100644 --- a/src/test_sparql.c +++ b/src/test_sparql.c @@ -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: \n" @@ -158,6 +159,13 @@ static void tst1(void) "PREFIX gs: \n" "SELECT ?sub ?rel WHERE ?work = \n")); + + YAZ_CHECK(test_uri(s, "http://x/z", "brief", + "PREFIX rdf: \n" + "PREFIX bf: \n" + "PREFIX gs: \n" + "SELECT \n")); + YAZ_CHECK(test_query( s, "@attr 1=bf.title computer", "PREFIX rdf: \n"