Version 0.3
[mp-sparql-moved-to-github.git] / src / filter_sparql.cpp
1 /* This file is part of Metaproxy.
2    Copyright (C) Index Data
3
4 Metaproxy is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8
9 Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19 #include <metaproxy/package.hpp>
20 #include <metaproxy/util.hpp>
21 #include <yaz/log.h>
22 #include <yaz/srw.h>
23 #include <yaz/diagbib1.h>
24 #include <yaz/match_glob.h>
25 #include <boost/scoped_ptr.hpp>
26 #include <boost/thread/mutex.hpp>
27 #include <boost/thread/condition.hpp>
28 #include "sparql.h"
29
30 #include <yaz/zgdu.h>
31
32 namespace mp = metaproxy_1;
33 namespace yf = mp::filter;
34
35 namespace metaproxy_1 {
36     namespace filter {
37         class SPARQL : public Base {
38             class Session;
39             class Rep;
40             class Conf;
41             class FrontendSet;
42
43             typedef boost::shared_ptr<Session> SessionPtr;
44             typedef boost::shared_ptr<Conf> ConfPtr;
45
46             typedef boost::shared_ptr<FrontendSet> FrontendSetPtr;
47             typedef std::map<std::string,FrontendSetPtr> FrontendSets;
48         public:
49             SPARQL();
50             ~SPARQL();
51             void process(metaproxy_1::Package & package) const;
52             void configure(const xmlNode * ptr, bool test_only,
53                            const char *path);
54             SessionPtr get_session(Package &package, Z_APDU **apdu) const;
55             void release_session(Package &package) const;
56             boost::scoped_ptr<Rep> m_p;
57             std::list<ConfPtr> db_conf;
58         };
59         class SPARQL::Conf {
60         public:
61             std::string db;
62             std::string uri;
63             std::string schema;
64             yaz_sparql_t s;
65             ~Conf();
66         };
67         class SPARQL::Rep {
68             friend class SPARQL;
69             boost::condition m_cond_session_ready;
70             boost::mutex m_mutex;
71             std::map<mp::Session,SessionPtr> m_clients;
72         };
73         class SPARQL::FrontendSet {
74         public:
75             FrontendSet();
76             ~FrontendSet();
77         private:
78             friend class Session;
79             Odr_int hits;
80             std::string db;
81             ConfPtr conf;
82             xmlDoc *doc;
83         };
84         class SPARQL::Session {
85         public:
86             Session(const SPARQL *);
87             ~Session();
88             void handle_z(Package &package, Z_APDU *apdu);
89             Z_APDU *run_sparql(mp::Package &package,
90                                Z_APDU *apdu_req,
91                                mp::odr &odr,
92                                const char *sparql_query,
93                                ConfPtr conf);
94             Z_Records *fetch(
95                 FrontendSetPtr fset,
96                 ODR odr, Odr_oid *preferredRecordSyntax,
97                 Z_ElementSetNames *esn,
98                 int start, int number, int &error_code, std::string &addinfo,
99                 int *number_returned, int *next_position);
100             bool m_in_use;
101         private:
102             bool m_support_named_result_sets;
103             FrontendSets m_frontend_sets;
104             const SPARQL *m_sparql;
105         };
106     }
107 }
108
109 yf::SPARQL::FrontendSet::~FrontendSet()
110 {
111     if (doc)
112         xmlFreeDoc(doc);
113 }
114
115 yf::SPARQL::FrontendSet::FrontendSet()
116 {
117     doc = 0;
118 }
119
120 yf::SPARQL::SPARQL() : m_p(new Rep)
121 {
122 }
123
124 yf::SPARQL::~SPARQL()
125 {
126 }
127
128 void yf::SPARQL::configure(const xmlNode *xmlnode, bool test_only,
129                            const char *path)
130 {
131     const xmlNode *ptr = xmlnode->children;
132
133     for (; ptr; ptr = ptr->next)
134     {
135         if (ptr->type != XML_ELEMENT_NODE)
136             continue;
137         if (!strcmp((const char *) ptr->name, "db"))
138         {
139             yaz_sparql_t s = yaz_sparql_create();
140             ConfPtr conf(new Conf);
141             conf->s = s;
142
143             const struct _xmlAttr *attr;
144             for (attr = ptr->properties; attr; attr = attr->next)
145             {
146                 if (!strcmp((const char *) attr->name, "path"))
147                     conf->db = mp::xml::get_text(attr->children);
148                 else if (!strcmp((const char *) attr->name, "uri"))
149                     conf->uri = mp::xml::get_text(attr->children);
150                 else if (!strcmp((const char *) attr->name, "schema"))
151                     conf->schema = mp::xml::get_text(attr->children);
152                 else
153                     throw mp::filter::FilterException(
154                         "Bad attribute " + std::string((const char *)
155                                                        attr->name));
156             }
157             xmlNode *p = ptr->children;
158             for (; p; p = p->next)
159             {
160                 if (p->type != XML_ELEMENT_NODE)
161                     continue;
162                 std::string name = (const char *) p->name;
163                 const struct _xmlAttr *attr;
164                 for (attr = p->properties; attr; attr = attr->next)
165                 {
166                     if (!strcmp((const char *) attr->name, "type"))
167                     {
168                         name.append(".");
169                         name.append(mp::xml::get_text(attr->children));
170                     }
171                     else
172                         throw mp::filter::FilterException(
173                             "Bad attribute " + std::string((const char *)
174                                                            attr->name));
175                 }
176                 std::string value = mp::xml::get_text(p);
177                 if (yaz_sparql_add_pattern(s, name.c_str(), value.c_str()))
178                 {
179                     throw mp::filter::FilterException(
180                         "Bad SPARQL config " + name);
181                 }
182             }
183             if (!conf->uri.length())
184             {
185                 throw mp::filter::FilterException("Missing uri");
186             }
187             if (!conf->db.length())
188             {
189                 throw mp::filter::FilterException("Missing path");
190             }
191             db_conf.push_back(conf);
192         }
193         else
194         {
195             throw mp::filter::FilterException
196                 ("Bad element "
197                  + std::string((const char *) ptr->name)
198                  + " in sparql filter");
199         }
200     }
201 }
202
203 yf::SPARQL::Conf::~Conf()
204 {
205     yaz_sparql_destroy(s);
206 }
207
208 yf::SPARQL::Session::Session(const SPARQL *sparql) :
209     m_in_use(true),
210     m_support_named_result_sets(false),
211     m_sparql(sparql)
212 {
213 }
214
215 yf::SPARQL::Session::~Session()
216 {
217 }
218
219 yf::SPARQL::SessionPtr yf::SPARQL::get_session(Package & package,
220                                                Z_APDU **apdu) const
221 {
222     SessionPtr ptr0;
223
224     Z_GDU *gdu = package.request().get();
225
226     boost::mutex::scoped_lock lock(m_p->m_mutex);
227
228     std::map<mp::Session,SPARQL::SessionPtr>::iterator it;
229
230     if (gdu && gdu->which == Z_GDU_Z3950)
231         *apdu = gdu->u.z3950;
232     else
233         *apdu = 0;
234
235     while (true)
236     {
237         it = m_p->m_clients.find(package.session());
238         if (it == m_p->m_clients.end())
239             break;
240         if (!it->second->m_in_use)
241         {
242             it->second->m_in_use = true;
243             return it->second;
244         }
245         m_p->m_cond_session_ready.wait(lock);
246     }
247     if (!*apdu)
248         return ptr0;
249
250     // new Z39.50 session ..
251     SessionPtr p(new Session(this));
252     m_p->m_clients[package.session()] = p;
253     return p;
254 }
255
256 void yf::SPARQL::release_session(Package &package) const
257 {
258     boost::mutex::scoped_lock lock(m_p->m_mutex);
259     std::map<mp::Session,SessionPtr>::iterator it;
260
261     it = m_p->m_clients.find(package.session());
262     if (it != m_p->m_clients.end())
263     {
264         it->second->m_in_use = false;
265
266         if (package.session().is_closed())
267             m_p->m_clients.erase(it);
268         m_p->m_cond_session_ready.notify_all();
269     }
270 }
271
272 static xmlNode *get_result(xmlDoc *doc, Odr_int *sz, Odr_int pos)
273 {
274     xmlNode *ptr = xmlDocGetRootElement(doc);
275     Odr_int cur = 0;
276
277     if (ptr->type == XML_ELEMENT_NODE &&
278         !strcmp((const char *) ptr->name, "RDF"))
279     {
280         ptr = ptr->children;
281
282         while (ptr && ptr->type != XML_ELEMENT_NODE)
283             ptr = ptr->next;
284         if (ptr && ptr->type == XML_ELEMENT_NODE &&
285             !strcmp((const char *) ptr->name, "Description"))
286         {
287             xmlNode *p = ptr->children;
288
289             while (p && p->type != XML_ELEMENT_NODE)
290                 p = p->next;
291             if (p && p->type == XML_ELEMENT_NODE &&
292                 !strcmp((const char *) p->name, "type"))
293             { /* SELECT RESULT */
294                 for (ptr = ptr->children; ptr; ptr = ptr->next)
295                     if (ptr->type == XML_ELEMENT_NODE &&
296                         !strcmp((const char *) ptr->name, "solution"))
297                     {
298                         if (cur++ == pos)
299                             break;
300                     }
301             }
302             else
303             {   /* CONSTRUCT result */
304                 for (; ptr; ptr = ptr->next)
305                     if (ptr->type == XML_ELEMENT_NODE &&
306                         !strcmp((const char *) ptr->name, "Description"))
307                     {
308                         if (cur++ == pos)
309                             break;
310                     }
311             }
312         }
313     }
314     else
315     {
316         for (; ptr; ptr = ptr->next)
317             if (ptr->type == XML_ELEMENT_NODE &&
318                 !strcmp((const char *) ptr->name, "sparql"))
319                 break;
320         if (ptr)
321         {
322             for (ptr = ptr->children; ptr; ptr = ptr->next)
323                 if (ptr->type == XML_ELEMENT_NODE &&
324                     !strcmp((const char *) ptr->name, "results"))
325                     break;
326         }
327         if (ptr)
328         {
329             for (ptr = ptr->children; ptr; ptr = ptr->next)
330                 if (ptr->type == XML_ELEMENT_NODE &&
331                     !strcmp((const char *) ptr->name, "result"))
332                 {
333                     if (cur++ == pos)
334                         break;
335                 }
336         }
337     }
338     if (sz)
339         *sz = cur;
340     return ptr;
341 }
342
343 Z_Records *yf::SPARQL::Session::fetch(
344     FrontendSetPtr fset,
345     ODR odr, Odr_oid *preferredRecordSyntax,
346     Z_ElementSetNames *esn,
347     int start, int number, int &error_code, std::string &addinfo,
348     int *number_returned, int *next_position)
349 {
350     Z_Records *rec = (Z_Records *) odr_malloc(odr, sizeof(Z_Records));
351     if (esn && esn->which == Z_ElementSetNames_generic &&
352         fset->conf->schema.length())
353     {
354         if (strcmp(esn->u.generic, fset->conf->schema.c_str()))
355         {
356             rec->which = Z_Records_NSD;
357             rec->u.nonSurrogateDiagnostic =
358                 zget_DefaultDiagFormat(
359                     odr,
360                     YAZ_BIB1_SPECIFIED_ELEMENT_SET_NAME_NOT_VALID_FOR_SPECIFIED_,
361                     esn->u.generic);
362             return rec;
363         }
364     }
365     rec->which = Z_Records_DBOSD;
366     rec->u.databaseOrSurDiagnostics = (Z_NamePlusRecordList *)
367         odr_malloc(odr, sizeof(Z_NamePlusRecordList));
368     rec->u.databaseOrSurDiagnostics->records = (Z_NamePlusRecord **)
369         odr_malloc(odr, sizeof(Z_NamePlusRecord *) * number);
370     int i;
371     for (i = 0; i < number; i++)
372     {
373         rec->u.databaseOrSurDiagnostics->records[i] = (Z_NamePlusRecord *)
374             odr_malloc(odr, sizeof(Z_NamePlusRecord));
375         Z_NamePlusRecord *npr = rec->u.databaseOrSurDiagnostics->records[i];
376         npr->databaseName = odr_strdup(odr, fset->db.c_str());
377         npr->which = Z_NamePlusRecord_databaseRecord;
378
379         xmlNode *node = get_result(fset->doc, 0, start - 1 + i);
380         if (!node)
381             break;
382         assert(node->type == XML_ELEMENT_NODE);
383         xmlNode *tmp = xmlCopyNode(node, 1);
384         xmlBufferPtr buf = xmlBufferCreate();
385         xmlNodeDump(buf, tmp->doc, tmp, 0, 0);
386         npr->u.databaseRecord =
387             z_ext_record_xml(odr, (const char *) buf->content, buf->use);
388         xmlFreeNode(tmp);
389         xmlBufferFree(buf);
390     }
391     rec->u.databaseOrSurDiagnostics->num_records = i;
392     *number_returned = i;
393     if (start + number > fset->hits)
394         *next_position = 0;
395     else
396         *next_position = start + number;
397     return rec;
398 }
399
400 Z_APDU *yf::SPARQL::Session::run_sparql(mp::Package &package,
401                                         Z_APDU *apdu_req,
402                                         mp::odr &odr,
403                                         const char *sparql_query,
404                                         ConfPtr conf)
405 {
406     Z_SearchRequest *req = apdu_req->u.searchRequest;
407     Package http_package(package.session(), package.origin());
408
409     http_package.copy_filter(package);
410     Z_GDU *gdu = z_get_HTTP_Request_uri(odr, conf->uri.c_str(), 0, 1);
411
412     z_HTTP_header_add(odr, &gdu->u.HTTP_Request->headers,
413                       "Content-Type", "application/x-www-form-urlencoded");
414     z_HTTP_header_add(odr, &gdu->u.HTTP_Request->headers,
415                       "Accept", "application/sparql-results+xml,"
416                       "application/rdf+xml");
417     const char *names[2];
418     names[0] = "query";
419     names[1] = 0;
420     const char *values[1];
421     values[0] = sparql_query;
422     char *path = 0;
423     yaz_array_to_uri(&path, odr, (char **) names, (char **) values);
424
425     gdu->u.HTTP_Request->content_buf = path;
426     gdu->u.HTTP_Request->content_len = strlen(path);
427
428     yaz_log(YLOG_LOG, "sparql: HTTP request\n%s", sparql_query);
429
430     http_package.request() = gdu;
431     http_package.move();
432
433     Z_GDU *gdu_resp = http_package.response().get();
434     Z_APDU *apdu_res = 0;
435     if (!gdu_resp || gdu_resp->which != Z_GDU_HTTP_Response)
436     {
437         yaz_log(YLOG_LOG, "sparql: no HTTP response");
438         apdu_res = odr.create_searchResponse(apdu_req,
439                                              YAZ_BIB1_TEMPORARY_SYSTEM_ERROR,
440                                              "no HTTP response from backend");
441     }
442     else if (gdu_resp->u.HTTP_Response->code != 200)
443     {
444         mp::wrbuf w;
445
446         wrbuf_printf(w, "sparql: HTTP error %d from backend",
447                      gdu_resp->u.HTTP_Response->code);
448         apdu_res = odr.create_searchResponse(apdu_req,
449                                              YAZ_BIB1_TEMPORARY_SYSTEM_ERROR,
450                                              w.c_str());
451     }
452     else
453     {
454         Z_HTTP_Response *resp = gdu_resp->u.HTTP_Response;
455         FrontendSetPtr fset(new FrontendSet);
456
457         fset->doc = xmlParseMemory(resp->content_buf, resp->content_len);
458         fset->db = req->databaseNames[0];
459         fset->conf = conf;
460         if (!fset->doc)
461             apdu_res = odr.create_searchResponse(apdu_req,
462                                              YAZ_BIB1_TEMPORARY_SYSTEM_ERROR,
463                                              "invalid XML from backendbackend");
464         else
465         {
466             Z_Records *records = 0;
467             int number_returned = 0;
468             int next_position = 0;
469             int error_code = 0;
470             std::string addinfo;
471
472             get_result(fset->doc, &fset->hits, -1);
473             m_frontend_sets[req->resultSetName] = fset;
474
475             Odr_int number = 0;
476             const char *element_set_name = 0;
477             mp::util::piggyback_sr(req, fset->hits, number, &element_set_name);
478             if (number)
479             {
480                 Z_ElementSetNames *esn;
481
482                 if (number > *req->smallSetUpperBound)
483                     esn = req->mediumSetElementSetNames;
484                 else
485                     esn = req->smallSetElementSetNames;
486                 records = fetch(fset,
487                                 odr, req->preferredRecordSyntax, esn,
488                                 1, number,
489                                 error_code, addinfo,
490                                 &number_returned,
491                                 &next_position);
492             }
493             if (error_code)
494             {
495                 apdu_res =
496                     odr.create_searchResponse(
497                         apdu_req, error_code, addinfo.c_str());
498             }
499             else
500             {
501                 apdu_res =
502                     odr.create_searchResponse(apdu_req, 0, 0);
503                 Z_SearchResponse *resp = apdu_res->u.searchResponse;
504                 *resp->resultCount = fset->hits;
505                 *resp->numberOfRecordsReturned = number_returned;
506                 *resp->nextResultSetPosition = next_position;
507                 resp->records = records;
508             }
509         }
510     }
511     return apdu_res;
512 }
513
514 void yf::SPARQL::Session::handle_z(mp::Package &package, Z_APDU *apdu_req)
515 {
516     mp::odr odr;
517     Z_APDU *apdu_res = 0;
518     if (apdu_req->which == Z_APDU_initRequest)
519     {
520         apdu_res = odr.create_initResponse(apdu_req, 0, 0);
521         Z_InitRequest *req = apdu_req->u.initRequest;
522         Z_InitResponse *resp = apdu_res->u.initResponse;
523
524         resp->implementationName = odr_strdup(odr, "sparql");
525         if (ODR_MASK_GET(req->options, Z_Options_namedResultSets))
526             m_support_named_result_sets = true;
527         int i;
528         static const int masks[] = {
529             Z_Options_search, Z_Options_present,
530             Z_Options_namedResultSets, -1
531         };
532         for (i = 0; masks[i] != -1; i++)
533             if (ODR_MASK_GET(req->options, masks[i]))
534                 ODR_MASK_SET(resp->options, masks[i]);
535         static const int versions[] = {
536             Z_ProtocolVersion_1,
537             Z_ProtocolVersion_2,
538             Z_ProtocolVersion_3,
539             -1
540         };
541         for (i = 0; versions[i] != -1; i++)
542             if (ODR_MASK_GET(req->protocolVersion, versions[i]))
543                 ODR_MASK_SET(resp->protocolVersion, versions[i]);
544             else
545                 break;
546         *resp->preferredMessageSize = *req->preferredMessageSize;
547         *resp->maximumRecordSize = *req->maximumRecordSize;
548     }
549     else if (apdu_req->which == Z_APDU_close)
550     {
551         apdu_res = odr.create_close(apdu_req,
552                                     Z_Close_finished, 0);
553         package.session().close();
554     }
555     else if (apdu_req->which == Z_APDU_searchRequest)
556     {
557         Z_SearchRequest *req = apdu_req->u.searchRequest;
558
559         FrontendSets::iterator fset_it =
560             m_frontend_sets.find(req->resultSetName);
561         if (fset_it != m_frontend_sets.end())
562         {
563             // result set already exist
564             // if replace indicator is off: we return diagnostic if
565             // result set already exist.
566             if (*req->replaceIndicator == 0)
567             {
568                 Z_APDU *apdu =
569                     odr.create_searchResponse(
570                         apdu_req,
571                         YAZ_BIB1_RESULT_SET_EXISTS_AND_REPLACE_INDICATOR_OFF,
572                         0);
573                 package.response() = apdu_res;
574             }
575             m_frontend_sets.erase(fset_it);
576         }
577         if (req->query->which != Z_Query_type_1)
578         {
579             apdu_res = odr.create_searchResponse(
580                 apdu_req, YAZ_BIB1_QUERY_TYPE_UNSUPP, 0);
581         }
582         else if (req->num_databaseNames != 1)
583         {
584             apdu_res = odr.create_searchResponse(
585                 apdu_req,
586                 YAZ_BIB1_ACCESS_TO_SPECIFIED_DATABASE_DENIED, 0);
587         }
588         else
589         {
590             std::string db = req->databaseNames[0];
591             std::list<ConfPtr>::const_iterator it;
592
593             it = m_sparql->db_conf.begin();
594             for (; it != m_sparql->db_conf.end(); it++)
595                 if (yaz_match_glob((*it)->db.c_str(), db.c_str()))
596                     break;
597             if (it == m_sparql->db_conf.end())
598             {
599                 apdu_res = odr.create_searchResponse(
600                     apdu_req, YAZ_BIB1_DATABASE_DOES_NOT_EXIST, db.c_str());
601             }
602             else
603             {
604                 WRBUF addinfo_wr = wrbuf_alloc();
605                 WRBUF sparql_wr = wrbuf_alloc();
606                 int error =
607                     yaz_sparql_from_rpn_wrbuf((*it)->s,
608                                               addinfo_wr, sparql_wr,
609                                               req->query->u.type_1);
610                 if (error)
611                 {
612                     apdu_res = odr.create_searchResponse(
613                         apdu_req, error,
614                         wrbuf_len(addinfo_wr) ?
615                         wrbuf_cstr(addinfo_wr) : 0);
616                 }
617                 else
618                 {
619                     apdu_res = run_sparql(package, apdu_req, odr,
620                                           wrbuf_cstr(sparql_wr), *it);
621                 }
622                 wrbuf_destroy(addinfo_wr);
623                 wrbuf_destroy(sparql_wr);
624             }
625         }
626     }
627     else if (apdu_req->which == Z_APDU_presentRequest)
628     {
629         Z_PresentRequest *req = apdu_req->u.presentRequest;
630         FrontendSets::iterator fset_it =
631             m_frontend_sets.find(req->resultSetId);
632         if (fset_it == m_frontend_sets.end())
633         {
634             apdu_res =
635                 odr.create_presentResponse(
636                     apdu_req, YAZ_BIB1_SPECIFIED_RESULT_SET_DOES_NOT_EXIST,
637                     req->resultSetId);
638             package.response() = apdu_res;
639             return;
640         }
641         int number_returned = 0;
642         int next_position = 0;
643         int error_code = 0;
644         std::string addinfo;
645         Z_ElementSetNames *esn = 0;
646         if (req->recordComposition)
647         {
648             if (req->recordComposition->which == Z_RecordComp_simple)
649                 esn = req->recordComposition->u.simple;
650             else
651             {
652                 apdu_res =
653                     odr.create_presentResponse(
654                         apdu_req,
655                         YAZ_BIB1_ONLY_A_SINGLE_ELEMENT_SET_NAME_SUPPORTED,
656                         0);
657                 package.response() = apdu_res;
658                 return;
659             }
660         }
661         Z_Records *records = fetch(
662             fset_it->second,
663             odr, req->preferredRecordSyntax, esn,
664             *req->resultSetStartPoint, *req->numberOfRecordsRequested,
665             error_code, addinfo,
666             &number_returned,
667             &next_position);
668         if (error_code)
669         {
670             apdu_res =
671                 odr.create_presentResponse(apdu_req, error_code,
672                                            addinfo.c_str());
673         }
674         else
675         {
676             apdu_res =
677                 odr.create_presentResponse(apdu_req, 0, 0);
678             Z_PresentResponse *resp = apdu_res->u.presentResponse;
679             resp->records = records;
680             *resp->numberOfRecordsReturned = number_returned;
681             *resp->nextResultSetPosition = next_position;
682         }
683     }
684     else
685     {
686         apdu_res = odr.create_close(apdu_req,
687                                     Z_Close_protocolError,
688                                     "sparql: unhandled APDU");
689         package.session().close();
690     }
691
692     assert(apdu_res);
693     package.response() = apdu_res;
694 }
695
696 void yf::SPARQL::process(mp::Package &package) const
697 {
698     Z_APDU *apdu;
699     SessionPtr p = get_session(package, &apdu);
700     if (p && apdu)
701     {
702         p->handle_z(package, apdu);
703     }
704     else
705         package.move();
706     release_session(package);
707 }
708
709 static mp::filter::Base* filter_creator()
710 {
711     return new mp::filter::SPARQL;
712 }
713
714 extern "C" {
715     struct metaproxy_1_filter_struct metaproxy_1_filter_sparql = {
716         0,
717         "sparql",
718         filter_creator
719     };
720 }
721
722
723 /*
724  * Local variables:
725  * c-basic-offset: 4
726  * c-file-style: "Stroustrup"
727  * indent-tabs-mode: nil
728  * End:
729  * vim: shiftwidth=4 tabstop=8 expandtab
730  */
731