On today's Web, Linked Data is published in different ways, including data dumps, subject pages, and results of SPARQL queries. We call each such part a Linked Data Fragment of the dataset.
The issue with the current Linked Data Fragments is that they are either so powerful that their servers suffer from low availability rates (as is the case with SPARQL), or either don't allow efficient querying.
Instead, this client solves queries by accessing Triple Pattern Fragments.
Each Triple Pattern Fragment offers:
- data that corresponds to a triple pattern (example).
- metadata that consists of the (approximate) total triple count (example).
- controls that lead to all other fragments of the same dataset (example).
You can execute SPARQL queries against Triple Pattern Fragments like this:
$ ldf-client http://fragments.dbpedia.org/2014/en query.sparql
The arguments to the ldf-client
command are:
- Any fragment of the dataset you want to query, in this case DBpedia. More datasets.
- A file with the query you want to execute (this can also be a string).
First, create a FragmentsClient
to fetch fragments of a certain dataset.
Then create a SparqlIterator
to evaluate SPARQL queries on that dataset.
var ldf = require('ldf-client');
var fragmentsClient = new ldf.FragmentsClient('http://fragments.dbpedia.org/2014/en');
var query = 'SELECT * { ?s ?p <http://dbpedia.org/resource/Belgium>. ?s ?p ?o } LIMIT 100',
results = new ldf.SparqlIterator(query, { fragmentsClient: fragmentsClient });
results.on('data', console.log);
This client requires Node.js 0.10 or higher and is tested on OSX and Linux. To install, execute:
$ [sudo] npm install -g ldf-client
The client can also run in Web browsers via browserify. Live demo.
The API is the same as that of the Node version.
A usage example is available in a separate project.
To install from the latest GitHub sources, execute:
$ git clone git@github.com:LinkedDataFragments/Client.js
$ cd Client.js
$ npm install .
Then run the application with:
$ ./bin/ldf-client http://fragments.dbpedia.org/2014/en queries/artists-york.sparql
The queries
folder contains several example queries for DBpedia.
The Linked Data Fragments client is written by Ruben Verborgh and colleagues.
This code is copyrighted by Ghent University – iMinds and released under the MIT license.