Hi Frank On Mon, Oct 22, 2012 at 10:38 AM, Frank Lahm <frankl...@gmail.com> wrote: > Hi, > > is there anything wrong with this SPARQL query > > "SELECT ?url WHERE { ?f nie:url ?url . ?f nfo:fileName ?name . > FILTER(fn:starts-with(?url, 'file:///Volumes/test/') && regex(?name, > 'unti')) }" > > which would explain why tracker-sparql -q QUERY shows results: > > frank$ tracker-sparql -q "SELECT ?url WHERE { ?f nie:url ?url . ?f > nfo:fileName ?name . FILTER(fn:starts-with(?url, > 'file:///Volumes/test/') && regex(?name, 'unti')) }" > Ergebnisse: > file:///Volumes/test/untitled%20text > > ...but the exact same query from a program [1] that uses the SPARQL C > API would give no result ? > > I'm 100% sure it is the exact same query as I have a debug log > statement logging the query string it just a few lines before calling > tracker_sparql_connection_query():
One non-obvious thing that can change how queries are run is the LOCALE / LC_COLLATE setting. If you have non-Western characters in your results and your own C program is running in a different locale to tracker-sparql for some reason, it might explain the issue. It doesn't seem likely in this case though. > Oct 17 22:03:41.777237 afpd[27868] {spotlight_module.c:153} > (D5:Spotlight): sl_mod_start_search: SPARQL query: > "SELECT ?url WHERE { ?f nie:url ?url . ?f nfo:fileName ?name . > FILTER(fn:starts-with(?url, 'file:///Volumes/test/') && regex(?name, > 'test')) }" > > Other SPARQL queries like > > "SELECT ?url WHERE { ?f nie:url ?url FILTER regex(?url, 'test')}" > > work just fine from the program (and tracker-sparql). It seems as as > soon as I have FILTER expressions with more then one sub-expressions > (or more then one FILTER expression) I get this behaviour. > > Unfortunately I can't seem to find a way to get Tracker to log debug > messages for the queries from the C program, the tracker-control > --set-log-verbosity=debug doesn't show me any query info at all (in > /root/.local/share/tracker/tracker-store.log). > > I'm puzzled and would appreciate any pointers. Thanks! By default libtracker-sparql uses direct access for read queries, meaning that it loads the Tracker database in your application process and executes the query there - therefore, the tracker-store logs won't show any evidence of the access because the query didn't reach the tracker-store process itself at all. Write queries always go over DBus to the tracker-store process, so you should see logging information of those. I believe if you set TRACKER_VERBOSITY=3 in the environment of your C program you'll see the logs of the queries that are being run in-process. I hope some of this helps Sam _______________________________________________ tracker-list mailing list tracker-list@gnome.org https://mail.gnome.org/mailman/listinfo/tracker-list