nmem_destroy(s->nmem);
}
+void yaz_sparql_include(yaz_sparql_t s, yaz_sparql_t u)
+{
+ struct sparql_entry *e = u->conf;
+ for (; e; e = e->next)
+ yaz_sparql_add_pattern(s, e->pattern, e->value);
+}
+
int yaz_sparql_add_pattern(yaz_sparql_t s, const char *pattern,
const char *value)
{
}
wrbuf_puts(addinfo, ">");
break;
+ case 't':
+ switch (term->which)
+ {
+ case Z_Term_general:
+ wrbuf_json_write(addinfo,
+ term->u.general->buf, term->u.general->len);
+ break;
+ case Z_Term_numeric:
+ wrbuf_printf(addinfo, ODR_INT_PRINTF, *term->u.numeric);
+ break;
+ case Z_Term_characterString:
+ wrbuf_json_puts(addinfo, term->u.characterString);
+ break;
+ }
+ break;
case 'd':
switch (term->which)
{
{
;
}
+ else if (!strncmp(e->pattern, "present", 7))
+ {
+ ;
+ }
else if (!strncmp(e->pattern, "uri", 3))
{
;
return errors;
}
-int yaz_sparql_lookup_schema(yaz_sparql_t s, const char *schema)
+struct sparql_entry *lookup_schema(yaz_sparql_t s, const char *schema)
{
struct sparql_entry *e;
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))
break;
}
}
- return e ? 1 : 0;
+ return e;
+}
+
+int yaz_sparql_lookup_schema(yaz_sparql_t s, const char *schema)
+{
+ return lookup_schema(s, schema) ? 1 : 0;
}
int yaz_sparql_from_uri_stream(yaz_sparql_t s,
const char *uri, const char *schema)
{
int r = 0, errors = emit_prefixes(s, addinfo, pr, client_data);
- struct sparql_entry *e;
-
- for (e = s->conf; e; e = e->next)
- {
- if (!strncmp(e->pattern, "uri.", 4))
- {
- if (!schema || !strcmp(e->pattern + 4, schema))
- break;
- }
- }
+ struct sparql_entry *e = lookup_schema(s, schema);
if (!e)
errors++;
if (!errors)