After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 773031 - Add client-side support for HTTP sparql endpoints
Add client-side support for HTTP sparql endpoints
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: General
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: tracker-general
tracker-general
Depends on:
Blocks:
 
 
Reported: 2016-10-16 14:48 UTC by Carlos Garnacho
Modified: 2016-11-20 16:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add libtracker-remote (14.98 KB, patch)
2016-10-16 14:49 UTC, Carlos Garnacho
committed Details | Review
libtracker-remote: Add support for application/sparql-results+xml (9.10 KB, patch)
2016-10-16 14:49 UTC, Carlos Garnacho
committed Details | Review
tracker: Add remote connection support to "tracker sparql" CLI tool (1.50 KB, patch)
2016-10-16 14:49 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2016-10-16 14:48:31 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
Comment 1 Carlos Garnacho 2016-10-16 14:49:14 UTC
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.
Comment 2 Carlos Garnacho 2016-10-16 14:49:20 UTC
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.
Comment 3 Carlos Garnacho 2016-10-16 14:49:25 UTC
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.
Comment 4 Sam Thursfield 2016-10-30 13:23:42 UTC
Review of attachment 337787 [details] [review]:

Looks fine at a glance.
Comment 5 Sam Thursfield 2016-10-30 13:23:48 UTC
Review of attachment 337788 [details] [review]:

Looks fine at a glance.
Comment 6 Sam Thursfield 2016-10-30 13:23:53 UTC
Review of attachment 337789 [details] [review]:

Looks fine at a glance.
Comment 7 Sam Thursfield 2016-10-30 13:24:53 UTC
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!
Comment 8 Carlos Garnacho 2016-11-20 16:48:51 UTC
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