1. Querying the Web of Data with XSPARQL 1.1
Daniele Dell’Aglio (DEIB, Politecnico di Milano)
Axel Polleres (Vienna University of Economics and Business)
Nuno Lopes (IBM Research Ireland)
Stefan Bischof (SIEMENS Austria)
2. / 8
What is XSPARQL?
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
2
XSPARQL is a transformation language to conveniently query XML and RDF side-by-side
It is a syntactic extension of XQuery
A SPARQL-for clause to query RDF data (by using SPARQL operators)
A CONSTRUCT clause to produce RDF output
3. / 8
What is XSPARQL?
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
2
XSPARQL is a transformation language to conveniently query XML and RDF side-by-side
It is a syntactic extension of XQuery
A SPARQL-for clause to query RDF data (by using SPARQL operators)
A CONSTRUCT clause to produce RDF output
Several improvements during the years
Support for querying RDBMS data sources
Support for R2RML
Query optimisations
4. / 8
Where to go to learn headbanging?
We want to retrieve the list of upcoming concerts of music artists having Nuclear Blast as music label
Pictures from Wikipedia
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
3
5. / 8
Where to go to learn headbanging?
We want to retrieve the list of upcoming concerts of music artists having Nuclear Blast as music label
We can get
The list of the artists from DBPedia
Pictures from Wikipedia
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
3
6. / 8
Where to go to learn headbanging?
We want to retrieve the list of upcoming concerts of music artists having Nuclear Blast as music label
We can get
The list of the artists from DBPedia
The concerts on Last.fm
Pictures from Wikipedia
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
3
7. / 8
Where to go to learn headbanging?
We want to retrieve the list of upcoming concerts of music artists having Nuclear Blast as music label
We can get
The list of the artists from DBPedia
The concerts on Last.fm
And put data… together?
Different data sources
Different formats (JSON, RDF)
Pictures from Wikipedia
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
3
8. / 8
Where to go to learn headbanging?
We want to retrieve the list of upcoming concerts of music artists having Nuclear Blast as music label
We can get
The list of the artists from DBPedia
The concerts on Last.fm
And put data… together?
Different data sources
Different formats (JSON, RDF)
Pictures from Wikipedia
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
3
9. / 8
How can XSPARQL 1.1 help us?
1. prefix lastfm: <http://xsparql.deri.org/lastfm#> 2. prefix dbprop: http://dbpedia.org/property/ 3. prefix dbpedia: <http://dbpedia.org/resource/> 4. for * 5. where { 6. service <http://dbpedia.org/sparql> { 7. $artist a dbowl:Band ; 8. dbprop:label dbpedia:Nuclear_Blast ; 9. dbprop:name $artistName . 10. } 11. } 12. return 13. let $doc := fn:concat("http://ws.../artist=",$artistName) 14. for $event in xsparql:json-doc($doc)//events/event/* 15. construct { 16. [] a lastfm:Event ; 17. lastfm:artist {$artistName} ; 18. lastfm:venue {$event/venue/location/city} ; 19. last:date {$event/startDate} 20. }
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
4
10. / 8
How can XSPARQL 1.1 help us?
1. prefix lastfm: <http://xsparql.deri.org/lastfm#> 2. prefix dbprop: http://dbpedia.org/property/ 3. prefix dbpedia: <http://dbpedia.org/resource/> 4. for * 5. where { 6. service <http://dbpedia.org/sparql> { 7. $artist a dbowl:Band ; 8. dbprop:label dbpedia:Nuclear_Blast ; 9. dbprop:name $artistName . 10. } 11. } 12. return 13. let $doc := fn:concat("http://ws.../artist=",$artistName) 14. for $event in xsparql:json-doc($doc)//events/event/* 15. construct { 16. [] a lastfm:Event ; 17. lastfm:artist {$artistName} ; 18. lastfm:venue {$event/venue/location/city} ; 19. last:date {$event/startDate} 20. }
Support of SPARQL 1.1 operators:
Assignment/Project Expressions
Aggregate functions: SUM, AVG,...
Federation
Negation
Property paths
Subqueries
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
4
11. / 8
How can XSPARQL 1.1 help us?
1. prefix lastfm: <http://xsparql.deri.org/lastfm#> 2. prefix dbprop: http://dbpedia.org/property/ 3. prefix dbpedia: <http://dbpedia.org/resource/> 4. for * 5. where { 6. service <http://dbpedia.org/sparql> { 7. $artist a dbowl:Band ; 8. dbprop:label dbpedia:Nuclear_Blast ; 9. dbprop:name $artistName . 10. } 11. } 12. return 13. let $doc := fn:concat("http://ws.../artist=",$artistName) 14. for $event in xsparql:json-doc($doc)//events/event/* 15. construct { 16. [] a lastfm:Event ; 17. lastfm:artist {$artistName} ; 18. lastfm:venue {$event/venue/location/city} ; 19. last:date {$event/startDate} 20. }
Support of SPARQL 1.1 operators:
Assignment/Project Expressions
Aggregate functions: SUM, AVG,...
Federation
Negation
Property paths
Subqueries
Processing of JSON files
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
4
12. / 8
How does it work?
xsparql
evaluator
xsparql
rewriter
XSPARQL query
data
xsparql-cli
JAR Library
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
5
13. / 8
How does it work?
XQuery query
xsparql
evaluator
xsparql
rewriter
lexer/parser
rewriter
optimizer
XSPARQL query
data
xsparql-cli
JAR Library
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
5
14. / 8
How does it work?
XQuery query
XQuery engine
SPARQL engine
xsparql
evaluator
xsparql
rewriter
lexer/parser
rewriter
optimizer
XSPARQL query
answer (XML|RDF)
data
xsparql-cli
JAR Library
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
5
15. / 8
How does it work?
XQuery query
XQuery engine
SPARQL engine
xsparql
evaluator
xsparql
rewriter
lexer/parser
rewriter
optimizer
XSPARQL query
answer (XML|RDF)
data
xsparql-cli
JAR Library
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
5
16. / 8
How does it work?
…
XSPARQLEvaluator evalutor =
new XSPARQLEvaluator();
Reader query = ...;
Writer out = ...;
evalutor.evaluate(query, out);
…
XQuery query
XQuery engine
SPARQL engine
xsparql
evaluator
xsparql
rewriter
lexer/parser
rewriter
optimizer
XSPARQL query
answer (XML|RDF)
data
xsparql-cli
JAR Library
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
5
17. / 8
Whats next?
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
6
Use of different SPARQL engines
openRDF and Strabon
Support to JSON-LD
No full control flow
XQUERY/XSPARQL don’t allow you to specify politeness (e.g. crawl delays between doc(.) calls)
18. / 8
Thank you!
Querying the Web of Data with XSPARQL 1.1
http://xsparql.deri.org
http://sourceforge.net/projects/xsparql
Daniele Dell’Aglio, Axel Polleres, Nuno Lopes and Stefan Bischof
daniele.dellaglio@polimi.it
(Thank you, SWSA and Google, for my Student Travel grant!)
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
7
19. / 8
The last slide :)
19 October 2014 - ISWC Dev Workshop 2014
Querying the Web of Data with XSPARQL 1.1
XQuery query
XQuery engine
SPARQL engine
xsparql
evaluator
xsparql
rewriter
lexer/parser
rewriter
optimizer
XSPARQL query
answer (XML|RDF)
data
xsparql-cli
JAR Library
Pictures from Wikipedia
8