GNOME Bugzilla – Bug 773031
Add client-side support for HTTP sparql endpoints
Last modified: 2016-11-20 16:49:03 UTC
I'm attaching some patches I did some time ago to support remote TrackerSparqlConnections to HTTP sparql endpoints. It supports both the application/sparql-results+json and application/sparql-results+xml formats, although should eventually support the other supported csv and tab separated formats. This seems enough to eg. access wikidata query service [1]: $ tracker sparql -r 'https://query.wikidata.org/sparql?query=' -q 'SELECT DISTINCT ?personLabel WHERE { ?person wdt:P166/wdt:P279* wd:Q7191 . ?person wdt:P166/wdt:P279* wd:Q19020 . SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en" } }' Results: Bob Dylan George Bernard Shaw [1] from the "People that received both Academy Award and Nobel Prize" example at https://query.wikidata.org
Created attachment 337787 [details] [review] Add libtracker-remote This is yet another libtracker-sparql backend to connect to remote HTTP SPARQL databases. Connections are made explicitly through the tracker_sparql_connection_remote_new() API call, passing a server to connect to. This commit introduces support for application/sparql-results+json as specified in https://www.w3.org/TR/sparql11-results-json/. XML format will be handled next. Just readonly queries are supported, and provided there's no authentication schemes.
Created attachment 337788 [details] [review] libtracker-remote: Add support for application/sparql-results+xml As specified in https://www.w3.org/TR/rdf-sparql-XMLres/. This cursor implementation is able to read the XML expected under that content type.
Created attachment 337789 [details] [review] tracker: Add remote connection support to "tracker sparql" CLI tool The -r/--remote switch can be used to specify the base url to be used in queries.
Review of attachment 337787 [details] [review]: Looks fine at a glance.
Review of attachment 337788 [details] [review]: Looks fine at a glance.
Review of attachment 337789 [details] [review]: Looks fine at a glance.
Nice, I haven't really tested these, but I think it makes sense to merge as it's a small amount of code for quite a cool new feature!
Thanks for the review :). The wikidata service doesn't seem too mature yet, but it's cool to support it for whenever it becomes interesting enough for anyone to use. Attachment 337787 [details] pushed as 2b63b4b - Add libtracker-remote Attachment 337788 [details] pushed as b514c3a - libtracker-remote: Add support for application/sparql-results+xml Attachment 337789 [details] pushed as e1936b6 - tracker: Add remote connection support to "tracker sparql" CLI tool