X-Git-Url: http://git.indexdata.com/?p=mp-sparql-moved-to-github.git;a=blobdiff_plain;f=src%2Ffilter_sparql.cpp;fp=src%2Ffilter_sparql.cpp;h=f168571b9886f85a748a7f7d6833e4ef66801c37;hp=34759e5feff3a531233cc3b2e41ae45b21c92fa6;hb=a0884c6c35bc62160b6ce6100a4e8ad2d15ab937;hpb=c30ad7a532b4384a50c5036f5b289d36d06fdb24 diff --git a/src/filter_sparql.cpp b/src/filter_sparql.cpp index 34759e5..f168571 100644 --- a/src/filter_sparql.cpp +++ b/src/filter_sparql.cpp @@ -177,6 +177,24 @@ void yf::SPARQL::configure(const xmlNode *xmlnode, bool test_only, conf->uri = mp::xml::get_text(attr->children); else if (!strcmp((const char *) attr->name, "schema")) 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++; + } else throw mp::filter::FilterException( "Bad attribute " + std::string((const char *) @@ -766,7 +784,8 @@ void yf::SPARQL::Session::handle_z(mp::Package &package, Z_APDU *apdu_req) fset->db = db; it = m_sparql->db_conf.begin(); for (; it != m_sparql->db_conf.end(); it++) - if (yaz_match_glob((*it)->db.c_str(), db.c_str())) + if ((*it)->schema.length() > 0 + && yaz_match_glob((*it)->db.c_str(), db.c_str())) { mp::wrbuf addinfo_wr; mp::wrbuf sparql_wr;