- Notifications
You must be signed in to change notification settings - Fork35
[DEPRECATED] A JavaScript client for Triple Pattern Fragments interfaces.
License
LinkedDataFragments/Client.js
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This project has been deprecated in favor ofComunica SPARQL, which is part of theComunica platform. It can do everything Client.js can do, and more.
On today's Web, Linked Data is published in different ways,includingdata dumps,subject pages,andresults of SPARQL queries.We call each such part aLinked Data Fragment of the dataset.
The issue with the current Linked Data Fragmentsis 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 accessingTriple Pattern Fragments.
Each Triple Pattern Fragment offers:
- data that corresponds to atriple 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/2015/en query.sparql
The arguments to theldf-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 aFragmentsClient
to fetch fragments of a certain dataset.
Then create aSparqlIterator
to evaluate SPARQL queries on that dataset.
varldf=require('ldf-client');varfragmentsClient=newldf.FragmentsClient('http://fragments.dbpedia.org/2015/en');varquery='SELECT * { ?s ?p <http://dbpedia.org/resource/Belgium>. ?s ?p ?o } LIMIT 100',results=newldf.SparqlIterator(query,{fragmentsClient:fragmentsClient});results.on('data',function(result){console.log(result);});
The command-line client requiresNode.js 4.0 or higherand is tested on OSX and Linux.To install, execute:
$ [sudo] npm install -g ldf-client
The client can also run in Web browsers viabrowserify, which provides browser equivalents for Node.js-specific parts.Try the live demo.
To build a browserified version, run:
npm install [-g] browserifynpm run browserify
The browserified version will be written toldf-client-browser.js
.
The API is the same as that of the Node version, except thatldf = require('ldf-client')
is no longer necessary, sinceldf
is exposed aswindow.ldf
.
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/2015/en queries/artists-york.sparql
Thequeries
folder contains several example queries for DBpedia.
If you want to rapidly deploy use the client as a microservice, you can build aDocker container as follows:
$ docker build -t ldf-client.
After that, you can run your newly created container:
$ docker run -it --rm ldf-client http://fragments.dbpedia.org/2015/en'SELECT * WHERE { ?s ?p ?o } LIMIT 100'
Mounting custom config and query files can be done like this:
$ docker run -it --rm$(pwd)/config.json:/tmp/config.json$(pwd)/query.sparql:/tmp/query.sparql ldf-client http://fragments.dbpedia.org/2015/en -f /tmp/query.sparql -c /tmp/config.json
The Linked Data Fragments client is written byRuben Verborgh and colleagues.
This code is copyrighted byGhent University – imecand released under theMIT license.
About
[DEPRECATED] A JavaScript client for Triple Pattern Fragments interfaces.