X-Git-Url: http://git.indexdata.com/?p=mp-sparql-moved-to-github.git;a=blobdiff_plain;f=src%2Ffilter_sparql.cpp;h=3a824f01ab5d60023eae9ad51a047179964a5b06;hp=bfb18c70a2078b2632ad6ae221eab8c04242f4af;hb=5b4b5eec4062062050112a58a151768d7ab7e579;hpb=3b8f82551458bf8243c7ed12743516e9e480e6fd diff --git a/src/filter_sparql.cpp b/src/filter_sparql.cpp index bfb18c7..3a824f0 100644 --- a/src/filter_sparql.cpp +++ b/src/filter_sparql.cpp @@ -129,16 +129,31 @@ void yf::SPARQL::configure(const xmlNode *xmlnode, bool test_only, 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)