Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Feb 5, 2020. It is now read-only.

[DEPRECATED] A JavaScript client for Triple Pattern Fragments interfaces.

License

NotificationsYou must be signed in to change notification settings

LinkedDataFragments/Client.js

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.


Linked Data Fragments Client

Build Statusnpm versionDocker Automated BuildDOI

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).

Execute SPARQL queries

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:

  1. Any fragment of the dataset you want to query, in this case DBpedia.More datasets.
  2. A file with the query you want to execute (this can also be a string).

From within your application

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);});

Install the client

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

Browser version

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.

From source

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.

(Optional) Running in a Docker container

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

License

The Linked Data Fragments client is written byRuben Verborgh and colleagues.

This code is copyrighted byGhent University – imecand released under theMIT license.


[8]ページ先頭

©2009-2025 Movatter.jp