<filters xmlns="http://indexdata.com/metaproxy">
<filter type="sparql">
- <db path="work" uri="http://bibframe.indexdata.com/sparql/" schema="sparql-results">
+ <defaults uri="http://bibframe.indexdata.com:21/sparql/"/>
+ <db path="work" schema="sparql-results">
<prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
<prefix>bf: http://bibframe.org/vocab/</prefix>
- <form>SELECT
- ?work
+ <form>SELECT
+ ?work
MAX(?wtitle) AS ?title
MAX(?creatorlabel) AS ?creator
MAX(?subjectlabel) AS ?subject
<index type="4">?wt bf:titleValue %v FILTER(contains(%v, %s))</index>
<index type="1003">?creator bf:label %v FILTER(contains(%v, %s))</index>
<index type="21">?subject bf:label %v FILTER(contains(%v, %s))</index>
- <index type="1016"> {
+ <index type="1016"> {
?work ?op1 ?child .
?child ?op2 ?val FILTER(contains(STR(?val), %s))
}
</index>
<modifier>GROUP BY $work</modifier>
</db>
- <db path="works" uri="http://bibframe.indexdata.com/sparql/" schema="rdf">
+ <db path="works" schema="rdf">
<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>?subject bf:label ?subjectlabel</criteria>
<index type="21">?subject bf:label %v FILTER(contains(%v, %s))</index>
</db>
- <db path="instance" uri="http://bibframe.indexdata.com/sparql/" schema="sparql-results">
+ <db path="instance" schema="sparql-results">
<prefix>rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns</prefix>
<prefix>bf: http://bibframe.org/vocab/</prefix>
<form>SELECT DISTINCT ?instance ?title ?format</form>
attribute type { "xquery" },
attribute id { xsd:NCName }?,
attribute name { xsd:NCName }?,
+ element mp:defaults {
+ attribute uri { xsd:string }
+ }?,
element mp:db {
attribute path { xsd:string },
attribute uri { xsd:string },
}*,
element mp:modifier { xsd:string }*
}+
-
const char *path)
{
const xmlNode *ptr = xmlnode->children;
+ std::string uri;
for (; ptr; ptr = ptr->next)
{
if (ptr->type != XML_ELEMENT_NODE)
continue;
- if (!strcmp((const char *) ptr->name, "db"))
+ if (!strcmp((const char *) ptr->name, "defaults"))
+ {
+ const struct _xmlAttr *attr;
+ for (attr = ptr->properties; attr; attr = attr->next)
+ {
+ if (!strcmp((const char *) attr->name, "uri"))
+ uri = mp::xml::get_text(attr->children);
+ else
+ throw mp::filter::FilterException(
+ "Bad attribute " + std::string((const char *)
+ attr->name));
+ }
+ }
+ else if (!strcmp((const char *) ptr->name, "db"))
{
yaz_sparql_t s = yaz_sparql_create();
ConfPtr conf(new Conf);
conf->s = s;
+ conf->uri = uri;
const struct _xmlAttr *attr;
for (attr = ptr->properties; attr; attr = attr->next)