what;s coming in sparql2?
Post on 08-May-2015
4.784 Views
Preview:
DESCRIPTION
TRANSCRIPT
What’s coming with SPARQL 2?
Slides available online at:http://www.slideshare.net/LeeFeigenbaum/whats-coming-in-sparql2
Comments & questions to:Lee Feigenbaum <lee@cambridgesemantics.com>VP Technology & Standards, Cambridge Semantics
Co-chair, W3C SPARQL Working Group
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
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
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
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)
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
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.
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
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.
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
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
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
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 { …}
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
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 … }}
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 }}
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
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?
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?
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
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 .}
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 { … }}
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)
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
Get Involved
• Join. – Email team-sparql-chairs@w3.org
• Follow. – WG materials at http://www.w3.org/2009/sparql/wiki/
• Comment. – Public feedback at public-rdf-dawg-comments@w3.org
• Use. – Discuss SPARQL at public-sparql-dev@w3.org
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
top related