EKAW - Publishing with Triple Pattern Fragments

31
Publishing with Triple Pattern Fragments Ruben Taelman - @rubensworks imec - Ghent University 1

Transcript of EKAW - Publishing with Triple Pattern Fragments

Page 1: EKAW - Publishing with Triple Pattern Fragments

Publishing withTriple Pattern Fragments

Ruben Taelman - @rubensworksimec - Ghent University

1

Page 2: EKAW - Publishing with Triple Pattern Fragments

Publishing with Triple Pattern FragmentsTPF server software

TPF client-side querying

Quad Pattern Fragments

Demo

2

Page 3: EKAW - Publishing with Triple Pattern Fragments

Publishing with Triple Pattern FragmentsTPF server software

TPF client-side querying

Quad Pattern Fragments

Demo

3

Page 4: EKAW - Publishing with Triple Pattern Fragments

http://linkeddatafragments.org/software/

JavaScript LDF serverPythonPerlRubyPHPJava...

TPF server implementations in different languages

4

Page 5: EKAW - Publishing with Triple Pattern Fragments

Requires Node.js ≥ 4.0

Installing and running the LDF server with Node

5

[sudo] npm install -g ldf-server

ldf-server config.json <port> <workers>

Documentation: https://github.com/LinkedDataFragments/Server.js

Page 6: EKAW - Publishing with Triple Pattern Fragments

Requires Docker

Installing and running the LDF server with Docker

6

docker pull linkeddatafragments/server.js

docker run -p <port>:3000 -it --rm \-v $(pwd)/config.json:/tmp/config.json \

ldf-server /tmp/config.json

Page 7: EKAW - Publishing with Triple Pattern Fragments

Preconfigured LDF server with NGINX cache and web-client

Setting up a full stack with Docker (Compose)

7

docker-compose up

https://github.com/LinkedDataFragments/FullStackServer

Page 8: EKAW - Publishing with Triple Pattern Fragments

{ "title": "My Linked Data Fragments server", "datasources": { "dbpedia": { "title": "DBpedia 2014", "type": "HdtDatasource", "description": "DBpedia 2014 with an HDT back-end", "settings": { "file": "data/dbpedia2014.hdt" } }, "dbpedia-sparql": { "title": "DBpedia 3.9 (Virtuoso)", "type": "SparqlDatasource", "description": "DBpedia 3.9 with a Virtuoso back-end", "settings": { "endpoint": "http://dbpedia.restdesc.org/", "defaultGraph": "http://dbpedia.org" } } }}

LDF server is configured with config.json

8

Page 9: EKAW - Publishing with Triple Pattern Fragments

{ "title": "My Linked Data Fragments server", "datasources": { "dbpedia": { "title": "DBpedia 2014", "type": "HdtDatasource", "description": "DBpedia 2014 with an HDT back-end", "settings": { "file": "data/dbpedia2014.hdt" } }, "dbpedia-sparql": { "title": "DBpedia 3.9 (Virtuoso)", "type": "SparqlDatasource", "description": "DBpedia 3.9 with a Virtuoso back-end", "settings": { "endpoint": "http://dbpedia.restdesc.org/", "defaultGraph": "http://dbpedia.org" } } }}

Configure list of datasources

9

Page 10: EKAW - Publishing with Triple Pattern Fragments

{ "title": "My Linked Data Fragments server", "datasources": { "dbpedia": { "title": "DBpedia 2014", "type": "HdtDatasource", "description": "DBpedia 2014 with an HDT back-end", "settings": { "file": "data/dbpedia2014.hdt" } }, "dbpedia-sparql": { "title": "DBpedia 3.9 (Virtuoso)", "type": "SparqlDatasource", "description": "DBpedia 3.9 with a Virtuoso back-end", "settings": { "endpoint": "http://dbpedia.restdesc.org/", "defaultGraph": "http://dbpedia.org" } } }}

Load an HDT file

10

Page 11: EKAW - Publishing with Triple Pattern Fragments

{ "title": "My Linked Data Fragments server", "datasources": { "dbpedia": { "title": "DBpedia 2014", "type": "HdtDatasource", "description": "DBpedia 2014 with an HDT back-end", "settings": { "file": "data/dbpedia2014.hdt" } }, "dbpedia-sparql": { "title": "DBpedia 3.9 (Virtuoso)", "type": "SparqlDatasource", "description": "DBpedia 3.9 with a Virtuoso back-end", "settings": { "endpoint": "http://dbpedia.restdesc.org/", "defaultGraph": "http://dbpedia.org" } } }}

Act as a proxy to a SPARQL endpoint

11

Page 12: EKAW - Publishing with Triple Pattern Fragments

HDTN-TriplesTurtleJSON-LDSPARQL-endpoint

Different data sources are possible

12

Page 13: EKAW - Publishing with Triple Pattern Fragments

by extending lib/datasources/Datasource.js

Return triple stream given triple pattern, offset and limit

...or write your own datasource implementation

13

Page 14: EKAW - Publishing with Triple Pattern Fragments

Exposing multiple datasources as if it was one

Useful for fragmented datasets that can’t be merged

Compose multiple datasources

14

https://github.com/LinkedDataFragments/Server.js/blob/master/config/config-composite.json

Page 15: EKAW - Publishing with Triple Pattern Fragments

Publishing with Triple Pattern FragmentsTPF server software

TPF client-side querying

Quad Pattern Fragments

Demo

15

Page 16: EKAW - Publishing with Triple Pattern Fragments

http://linkeddatafragments.org/software/

JavaScript LDF clientPythonPerlJava...

Different client implementations exist as well

16

Page 17: EKAW - Publishing with Triple Pattern Fragments

No installation required at all!

http://client.linkeddatafragments.org/

Use the web client

17

Page 18: EKAW - Publishing with Triple Pattern Fragments

Requires Node.js ≥ 4.0

Run from command line or include in your source code

Installing and running the LDF client with Node

18

[sudo] npm install -g ldf-client

ldf-client <tpf-endpoint-url> <sparql-query-path>

Documentation: https://github.com/LinkedDataFragments/Client.js

Page 19: EKAW - Publishing with Triple Pattern Fragments

Requires Docker

Installing and running the LDF client with Docker

19

docker pull linkeddatafragments/client.js

docker run -it --rm \-v <sparql-query-path>:/tmp/query.sparql \

linkeddatafragments/client.js \<tpf-endpoint-url> /tmp/query.sparql

Page 20: EKAW - Publishing with Triple Pattern Fragments

Publishing with Triple Pattern FragmentsTPF server software

TPF client-side querying

Quad Pattern Fragments

20

Page 21: EKAW - Publishing with Triple Pattern Fragments

Quads are triples extended with a fourth element, the graph

<s> <p> <o> <g>.

Triples sometimes need some context

21

Page 22: EKAW - Publishing with Triple Pattern Fragments

Quad Pattern Fragments (QPF)

Adding the fourth element to the interface

22

Page 23: EKAW - Publishing with Triple Pattern Fragments

SELECT *FROM <http://example.org/graph0>FROM NAMED <http://example.org/graph1>WHERE {

GRAPH ?g {?s ?p ?o.

}}

QPF Clients are able to use quad features

23

Page 24: EKAW - Publishing with Triple Pattern Fragments

QPF is backwards-compatible with TPF

24

TPF

QPFTPF

QPFIgnores graphs

Page 26: EKAW - Publishing with Triple Pattern Fragments

Publishing with Triple Pattern FragmentsTPF server software

TPF client-side querying

Quad Pattern Fragments

Demo

26

Page 27: EKAW - Publishing with Triple Pattern Fragments

Let’s try overloading the DBpedia TPF endpoint!

27

http://fragments.dbpedia.org/

Uptime of 99.9967%

Page 28: EKAW - Publishing with Triple Pattern Fragments

28

Page 29: EKAW - Publishing with Triple Pattern Fragments

29

Page 30: EKAW - Publishing with Triple Pattern Fragments

30

Some query types are very slow

~1 hour!

Page 31: EKAW - Publishing with Triple Pattern Fragments

Server running TPF server software with any dataset

31

TPF server software

RDF dataset

HDT dataset

SPARQL endpoint

...