<db path="work" uri="http://bibframe.indexdata.com/sparql/">
<prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
<prefix>bf: http://bibframe.org/vocab/</prefix>
- <field>DISTINCT ?work ?wtitle ?creatorlabel ?subjectlabel</field>
+ <form>SELECT DISTINCT ?work ?wtitle ?creatorlabel ?subjectlabel</form>
+ <criteria>?work a bf:Work</criteria>
+
+ <criteria>?work bf:workTitle ?wt</criteria>
+ <criteria>?wt bf:titleValue ?wtitle</criteria>
+ <index type="4">?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
+ <criteria>?work bf:creator ?creator</criteria>
+ <criteria>?creator bf:label ?creatorlabel</criteria>
+ <index type="1003">?creator bf:label %v FILTER(contains(%v, %s))</index>
+ <criteria>?work bf:subject ?subject</criteria>
+ <criteria>?subject bf:label ?subjectlabel</criteria>
+ <index type="21">?subject bf:label %v FILTER(contains(%v, %s))</index>
+ </db>
+ <db path="works" uri="http://bibframe.indexdata.com/sparql/">
+ <prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
+ <prefix>bf: http://bibframe.org/vocab/</prefix>
+ <form>CONSTRUCT { ?work bf:title ?title . ?work bf:author ?creator . ?work bf:instanceTitle ?it }</form>
<criteria>?work a bf:Work</criteria>
<criteria>?work bf:workTitle ?wt</criteria>
<db path="instance" uri="http://bibframe.indexdata.com/sparql/">
<prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
<prefix>bf: http://bibframe.org/vocab/</prefix>
- <field>DISTINCT ?instance ?title ?format</field>
+ <form>SELECT DISTINCT ?instance ?title ?format</form>
<criteria>?instance a bf:Instance</criteria>
<criteria>?instance bf:title ?title</criteria>
{
xmlNode *ptr = xmlDocGetRootElement(doc);
Odr_int cur = 0;
- for (; ptr; ptr = ptr->next)
- if (ptr->type == XML_ELEMENT_NODE &&
- !strcmp((const char *) ptr->name, "sparql"))
- break;
- if (ptr)
+
+ if (ptr->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr->name, "RDF"))
{
- for (ptr = ptr->children; ptr; ptr = ptr->next)
- if (ptr->type == XML_ELEMENT_NODE &&
- !strcmp((const char *) ptr->name, "results"))
- break;
+ ptr = ptr->children;
+
+ while (ptr && ptr->type != XML_ELEMENT_NODE)
+ ptr = ptr->next;
+ if (ptr && ptr->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr->name, "Description"))
+ {
+ xmlNode *p = ptr->children;
+
+ while (p && p->type != XML_ELEMENT_NODE)
+ p = p->next;
+ if (p && p->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) p->name, "type"))
+ { /* SELECT RESULT */
+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ if (ptr->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr->name, "solution"))
+ {
+ if (cur++ == pos)
+ break;
+ }
+ }
+ else
+ { /* CONSTRUCT result */
+ for (; ptr; ptr = ptr->next)
+ if (ptr->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr->name, "Description"))
+ {
+ if (cur++ == pos)
+ break;
+ }
+ }
+ }
}
- if (ptr)
+ else
{
- for (ptr = ptr->children; ptr; ptr = ptr->next)
+ for (; ptr; ptr = ptr->next)
if (ptr->type == XML_ELEMENT_NODE &&
- !strcmp((const char *) ptr->name, "result"))
- {
- if (cur++ == pos)
+ !strcmp((const char *) ptr->name, "sparql"))
+ break;
+ if (ptr)
+ {
+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ if (ptr->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr->name, "results"))
break;
- }
+ }
+ if (ptr)
+ {
+ for (ptr = ptr->children; ptr; ptr = ptr->next)
+ if (ptr->type == XML_ELEMENT_NODE &&
+ !strcmp((const char *) ptr->name, "result"))
+ {
+ if (cur++ == pos)
+ break;
+ }
+ }
}
if (sz)
*sz = cur;
if (!node)
break;
assert(node->type == XML_ELEMENT_NODE);
- assert(!strcmp((const char *) node->name, "result"));
xmlNode *tmp = xmlCopyNode(node, 1);
xmlBufferPtr buf = xmlBufferCreate();
xmlNodeDump(buf, tmp->doc, tmp, 0, 0);
z_HTTP_header_add(odr, &gdu->u.HTTP_Request->headers,
"Content-Type", "application/x-www-form-urlencoded");
+ z_HTTP_header_add(odr, &gdu->u.HTTP_Request->headers,
+ "Accept", "application/rdf+xml");
const char *names[2];
names[0] = "query";
names[1] = 0;
{
;
}
- else if (!strncmp(e->pattern, "field", 5))
+ else if (!strcmp(e->pattern, "form"))
{
;
}
}
}
pr("\n", client_data);
- pr("SELECT", client_data);
for (e = s->conf; e; e = e->next)
{
- if (!strncmp(e->pattern, "field", 5))
+ if (!strcmp(e->pattern, "form"))
{
pr(" ", client_data);
pr(e->value, client_data);