s3-mdssvc: lexer and parser for Spotlight queries
[Samba.git] / source3 / rpc_server / mdssvc / sparql_parser_test.c
blob8e4789d2ba1c4d7eab768bb5f21a5a58d760bca0
1 #include "includes.h"
2 #include "mdssvc.h"
3 #include "sparql_parser.h"
5 /*
6 * Examples:
8 * $ ./spotlight2sparql '_kMDItemGroupId=="11"'
9 * ...
10 * $ ./spotlight2sparql '*=="test*"cwd||kMDItemTextContent=="test*"cwd'
11 * ...
14 int main(int argc, char **argv)
16 bool ok;
17 struct sl_query *slq;
19 if (argc != 2) {
20 printf("usage: %s QUERY\n", argv[0]);
21 return 1;
24 slq = talloc_zero(NULL, struct sl_query);
25 if (slq == NULL) {
26 printf("talloc error\n");
27 return 1;
30 slq->query_string = argv[1];
31 slq->path_scope = "/foo/bar";
33 ok = map_spotlight_to_sparql_query(slq);
34 printf("%s\n", ok ? slq->sparql_query : "*mapping failed*");
36 talloc_free(slq);
37 return ok ? 0 : 1;