s3/rpc_server/mdssvc: Generate flex/bison files in build
[metze/samba/wip.git] / source3 / rpc_server / mdssvc / sparql_parser_test.c
1 #include "includes.h"
2 #include "mdssvc.h"
3 #include "rpc_server/mdssvc/sparql_parser.tab.h"
4
5 /*
6  * Examples:
7  *
8  * $ ./spotlight2sparql '_kMDItemGroupId=="11"'
9  * ...
10  * $ ./spotlight2sparql '*=="test*"cwd||kMDItemTextContent=="test*"cwd'
11  * ...
12  */
13
14 int main(int argc, char **argv)
15 {
16         bool ok;
17         struct sl_query *slq;
18
19         if (argc != 2) {
20                 printf("usage: %s QUERY\n", argv[0]);
21                 return 1;
22         }
23
24         slq = talloc_zero(NULL, struct sl_query);
25         if (slq == NULL) {
26                 printf("talloc error\n");
27                 return 1;
28         }
29
30         slq->query_string = argv[1];
31         slq->path_scope = "/foo/bar";
32
33         ok = map_spotlight_to_sparql_query(slq);
34         printf("%s\n", ok ? slq->sparql_query : "*mapping failed*");
35
36         talloc_free(slq);
37         return ok ? 0 : 1;
38 }