From dd9e60bc906fcd3dffd764d079aa77cfede70f07 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 30 Apr 2015 13:37:57 +0200 Subject: [PATCH] Multiple databases may be referred to - in include --- src/filter_sparql.cpp | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/filter_sparql.cpp b/src/filter_sparql.cpp index f168571..11206a7 100644 --- a/src/filter_sparql.cpp +++ b/src/filter_sparql.cpp @@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include +#include #include "sparql.h" #include @@ -179,21 +180,29 @@ void yf::SPARQL::configure(const xmlNode *xmlnode, bool test_only, conf->schema = mp::xml::get_text(attr->children); else if (!strcmp((const char *) attr->name, "include")) { - std::string name = mp::xml::get_text(attr->children); - std::list::const_iterator it = db_conf.begin(); - while (1) - if (it == db_conf.end()) - { - throw mp::filter::FilterException( - "include db not found: " + name); - } - else if (name.compare((*it)->db) == 0) - { - yaz_sparql_include(s, (*it)->s); - break; - } - else - it++; + std::vector dbs; + std::string db = mp::xml::get_text(attr->children); + boost::split(dbs, db, boost::is_any_of(" \t")); + size_t i; + for (i = 0; i < dbs.size(); i++) + { + if (dbs[i].length() == 0) + continue; + std::list::const_iterator it = db_conf.begin(); + while (1) + if (it == db_conf.end()) + { + throw mp::filter::FilterException( + "include db not found: " + dbs[i]); + } + else if (dbs[i].compare((*it)->db) == 0) + { + yaz_sparql_include(s, (*it)->s); + break; + } + else + it++; + } } else throw mp::filter::FilterException( -- 1.7.10.4