26
What’s coming with SPARQL 2? Slides available online at: http://www.slideshare.net/LeeFeigenbaum/whats-coming-in-sparql2 Comments & questions to: Lee Feigenbaum <[email protected]> VP Technology & Standards, Cambridge Semantics Co-chair, W3C SPARQL Working Group

What;s Coming In SPARQL2?

Embed Size (px)

DESCRIPTION

A brief introduction to SPARQL and the current status of SPARQL 2, as presented to the NYC Semantic Web group on October 1, 2009.

Citation preview

Page 1: What;s Coming In SPARQL2?

What’s coming with SPARQL 2?

Slides available online at:http://www.slideshare.net/LeeFeigenbaum/whats-coming-in-sparql2

Comments & questions to:Lee Feigenbaum <[email protected]>VP Technology & Standards, Cambridge Semantics

Co-chair, W3C SPARQL Working Group

Page 2: What;s Coming In SPARQL2?

For More Details

• SPARQL By Example– http://www.cambridgesemantics.com/2008/09/sparql-by-example/

• SPARQL Cheat Sheet– http://www.slideshare.net/LeeFeigenbaum/sparql-cheat-sheet

• SPARQL2 Status– http://www.slideshare.net/LeeFeigenbaum/sparql2-status

Page 3: What;s Coming In SPARQL2?

Why SPARQL?

SPARQL is the query language of the Semantic Web. SPARQL lets us:

• Pull values from structured and semi-structured data

• Explore data by querying unknown relationships• Perform complex joins of disparate data sources

in a single, simple query• Transform RDF data from one vocabulary to

another

Page 4: What;s Coming In SPARQL2?

Structure of a SPARQL Query

A SPARQL query comprises, in order:• Prefix declarations, for abbreviating URIs• Dataset definition, stating what RDF graph(s) are being

queried• A result clause, identifying what information to return

from the query• The query pattern, specifying what to query for in the

underlying dataset• Query modifiers, slicing, ordering, and otherwise

rearranging query results

Page 5: What;s Coming In SPARQL2?

Anatomy of a SPARQL QueryPREFIX foo: <…>PREFIX bar: <…>…SELECT …FROM <…>FROM NAMED <…>WHERE { …}ORDER BY …LIMIT …OFFSET …

Declare prefixshortcuts (optional)

Query result clause

Query pattern

Query modifiers(optional)

Define the dataset (optional)

Page 6: What;s Coming In SPARQL2?

An Example SPARQL Query

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX type: <http://dbpedia.org/class/yago/> PREFIX prop: <http://dbpedia.org/property/> SELECT ?country_name ?population WHERE { ?country a type:LandlockedCountries ; rdfs:label ?country_name ; prop:populationEstimate ?population . FILTER (?population > 15000000) . }

Find the name of all landlocked countries with a population bigger than 15 million

Page 7: What;s Coming In SPARQL2?

SPARQL Over HTTP (the SPARQL Protocol)http://host.domain.com/sparql/endpoint?<parameters>

where <parameters> can include:

query=<encoded query string>e.g. SELECT+*%0DWHERE+{…

default-graph-uri=<encoded graph URI>e.g. http%3A%2F%2Fexmaple.com%2Ffoo…n.b. zero of more occurrences of default-graph-

urinamed-graph-uri=<encoded graph URI>

e.g. http%3A%2F%2Fexmaple.com%2Fbar…n.b. zero of more occurrences of named-graph-uri

HTTP GET or POST. Graphs given in the protocol override graphs given in the query.

Page 8: What;s Coming In SPARQL2?

Some Public SPARQL EndpointsName URL What’s there?

SPARQLer http://sparql.org/sparql.htmlGeneral-purpose query endpoint for Web-accessible data

DBPedia http://dbpedia.org/sparql Extensive RDF data from Wikipedia

DBLP http://www4.wiwiss.fu-berlin.de/dblp/snorql/Bibliographic data from computer science journals and conferences

LinkedMDB http://data.linkedmdb.org/sparql Films, actors, directors, writers, producers, etc.

WorldFactbook

http://www4.wiwiss.fu-berlin.de/factbook/snorql/

Country statistics from the CIA World Factbook

bio2rdf http://bio2rdf.org/sparql Bioinformatics data from around 40 public databases

Page 9: What;s Coming In SPARQL2?

Disclaimer

The SPARQL Working Group has not yet decided many of the technical questions surveyed in

these slides. All examples are subject to change; please do not construe them as indicators or

endorsements of specific technical designs/decisions.

All opinions are Lee Feigenbaum’s alone.

Page 10: What;s Coming In SPARQL2?

Naming

I use “SPARQL2” to collectively refer to the work of the 2nd SPARQL Working Group. The actual

languages being worked on are known as:

SPARQL/Query 1.1SPARQL/Update 1.0

Page 11: What;s Coming In SPARQL2?

Where are we now?

March 2009 Today August 2010

July 2009FPWD of SPARQL New Features and Rationales document

October 2009FPWD of core SPARQL specifications

???Last Call and beyond of core SPARQL specifications

Page 12: What;s Coming In SPARQL2?

OverviewFeature Completeness / Stability

(1-10, Subjective!)

Projected expressions 7

Subqueries 6

Negation 4

Aggregates 3

Service description 5

Update language 2

Update protocol 5

RESTful update 2

Property paths 3

Basic federated query not started

Common functions 4

Entailment regime semantics 3

Page 13: What;s Coming In SPARQL2?

Projected Expressions

• Select expressions other than variables (literals, functions on literals and variables, etc.)

• Issues around:– Do expressions require an aliased name?– Syntax (main issue here)

SELECT ?price * ?qty AS ?total_priceWHERE { …}

Page 14: What;s Coming In SPARQL2?

Aggregates

• À la SQL aggregates (MIN, MAX, COUNT, AVG, etc.)

• Issues around:– Which aggregates to include– Aggregates over mixed datatypes– Syntax, keywords, custom aggregates

SELECT MIN(?price) AS ?min_price …

WHERE { … }GROUP BY ?item

Page 15: What;s Coming In SPARQL2?

Subqueries

• Nested queries allow multiple queries to be combined into one.

• Issues around:– Variable scope & evaluation model– Precise syntax

SELECT ?article ?author WHERE { ?article ex:author ?author . { SELECT ?article WHERE { … ?article … } ORDER BY … LIMIT … }}

Page 16: What;s Coming In SPARQL2?

Negation

• Supplant the mystifying OPTIONAL/!bound method of negation with a dedicated construct

• Issues around:– Filter semantics vs. set-difference semantics– Choice of keyword(s)

SELECT … WHERE { ?person a foaf:Person . NOT { ?person foaf:mbox ?email }}

Page 17: What;s Coming In SPARQL2?

Service Description

• A standard discovery mechanism and vocabulary for describing the capabilities, extensions, data sets, and more for a SPARQL endpoint

• Discovery. How can a client find the RDF that describes a SPARQL endpoint at a particular URI?

• Description. What predicates, classes, values, etc. should a client expect to find (and be able to query) once it locates a service description?

• Issues around:– Choice of discovery mechanism– Which predicates and enumerations to define URIs for

Page 18: What;s Coming In SPARQL2?

Update Language• Based on the

SPARQL Update member submission• Batch insert & delete• Insert & delete based on triple patterns• Graph management (creation, removal)• Issues around:– Graph stores vs. triple stores– Which language statements to include?– Transactions/atomicity/concurrency?

Page 19: What;s Coming In SPARQL2?

Update Protocol• The ability to issue SPARQL/Update language

statements via a standard protocol (e.g. via HTTP POST)

• Issues around:– Relation to existing SPARQL (Query) Protocol– Security– Need for WSDL description? SOAP bindings?

Page 20: What;s Coming In SPARQL2?

RESTful Update• Where appropriate, map RESTful HTTP

requests to SPARQL/Update operations– DELETE /foo/g1 … -> DELETE DATA FROM ex:g1 …

• Issues around:– Which mappings to include?– Updating graphs with URIs that are not under the

control of the SPARQL endpoint

Page 21: What;s Coming In SPARQL2?

Property Paths

• Support arbitrary-length predicate paths in triple patterns – “regular expressions” on predicates?

• Query hierarchical structures such as RDF collections

• Issues around:– Can variables be used in path expressions?– Can the length of a path be found?– Are paths first-class datatypes?

SELECT … WHERE { ?person foaf:knows+ ?network .}

Page 22: What;s Coming In SPARQL2?

Basic Federated Query

• Initial scaffolding for authoring federated SPARQL queries

• Likely will involve a keyword to explicitly target portions of a query to specific endpoints

• Initial plan: Start with ARQ’s SERVICE keyword

SELECT … WHERE { … SERVICE ex:books { … }}

Page 23: What;s Coming In SPARQL2?

Entailment Regime Semantics

• SPARQL/Query 1.0 defines a mechanism to extend SPARQL semantics for additional entailment regimes

• Use this mechanism to define the semantics of SPARQL queries for:– RDF Schema– OWL flavors– RIF rule sets– …

• Issues around:– Requiring consistency checks– How to limit infinite results (e.g. from axiomatic inferences)

Page 24: What;s Coming In SPARQL2?

Common Functions

• Extend the set of functions that SPARQL engines must support to include some of…– Common string functions (e.g. substr)– Common date/time/datetime functions– Logical functions (COALESCE, IF, …?)

• Limited discussion to date about which functions to include

Page 25: What;s Coming In SPARQL2?

Get Involved

• Join. – Email [email protected]

• Follow. – WG materials at http://www.w3.org/2009/sparql/wiki/

• Comment. – Public feedback at [email protected]

• Use. – Discuss SPARQL at [email protected]

Page 26: What;s Coming In SPARQL2?

SPARQL Resources• The SPARQL Specification– http://www.w3.org/TR/rdf-sparql-query/

• SPARQL implementations– http://esw.w3.org/topic/SparqlImplementations

• SPARQL endpoints– http://esw.w3.org/topic/SparqlEndpoints

• SPARQL Frequently Asked Questions– http://www.thefigtrees.net/lee/sw/sparql-faq

• SPARQL 2 Working Group– http://www.w3.org/2009/sparql/wiki/

• Common SPARQL extensions– http://esw.w3.org/topic/SPARQL/Extensions