What’s coming with SPARQL 2?Slides available online at:http://www.slideshare.net/LeeFeigenbaum/whats-coming-in-sparql2Comments & questions to:Lee Feigenbaum <lee@cambridgesemantics.com>VP Technology & Standards, Cambridge SemanticsCo-chair, W3C SPARQL Working Group
For More DetailsSPARQL By Examplehttp://www.cambridgesemantics.com/2008/09/sparql-by-example/SPARQL Cheat Sheethttp://www.slideshare.net/LeeFeigenbaum/sparql-cheat-sheetSPARQL2 Statushttp://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 dataExplore data by querying unknown relationshipsPerform complex joins of disparate data sources in a single, simple queryTransform RDF data from one vocabulary to another
Structure of a SPARQL QueryA SPARQL query comprises, in order:Prefix declarations, for abbreviating URIsDataset definition, stating what RDF graph(s) are being queriedA result clause, identifying what information to return from the queryThe query pattern, specifying what to query for in the underlying datasetQuery modifiers, slicing, ordering, and otherwise rearranging query results
Anatomy of a SPARQL QueryPREFIXfoo:<…>PREFIXbar:<…>…SELECT …FROM <…>FROM NAMED <…>WHERE{  …}ORDER BY …LIMIT …OFFSET …Declare prefixshortcuts (optional)Query result clauseDefine the dataset (optional)Query patternQuery modifiers(optional)
An Example SPARQL QueryFind the name of all landlocked countries with a population bigger than 15 millionPREFIXrdfs:<http://www.w3.org/2000/01/rdf-schema#>PREFIXtype:<http://dbpedia.org/class/yago/>PREFIXprop: <http://dbpedia.org/property/>SELECT?country_name ?population WHERE{ ?countryatype:LandlockedCountries;rdfs:label?country_name;prop:populationEstimate?population.FILTER(?population>15000000).}
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-uri	named-graph-uri=<encoded graph URI>e.g. http%3A%2F%2Fexmaple.com%2Fbar…n.b. zero of more occurrences of named-graph-uriHTTP GET or POST. Graphs given in the protocol override graphs given in the query.
Some Public SPARQL Endpoints
DisclaimerThe 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.
NamingI 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?TodayAugust 2010March 2009???Last Call and beyond of core SPARQL specificationsJuly 2009FPWD of SPARQL New Features and Rationales documentOctober 2009FPWD of core SPARQL specifications
Overview
Projected ExpressionsSelect 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 includeAggregates over mixed datatypesSyntax, keywords, custom aggregatesSELECT MIN(?price) AS ?min_price …WHERE { … }GROUP BY ?item
SubqueriesNested queries allow multiple queries to be combined into one. Issues around:Variable scope & evaluation modelPrecise syntaxSELECT ?article ?authorWHERE {   ?article ex:author ?author .  {     SELECT ?article WHERE {      … ?article …    } ORDER BY … LIMIT …  }}
NegationSupplant the mystifying OPTIONAL/!bound method of negation with a dedicated constructIssues around:Filter semantics vs. set-difference semanticsChoice of keyword(s)SELECT … WHERE {   ?person a foaf:Person . NOT {    ?person foaf:mbox ?email }}
Service DescriptionA standard discovery mechanism and vocabulary for describing the capabilities, extensions, data sets, and more for a SPARQL endpointDiscovery. 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 LanguageBased on the SPARQL Update member submissionBatch insert & deleteInsert & delete based on triple patternsGraph management (creation, removal)Issues around:Graph stores vs. triple storesWhich language statements to include?Transactions/atomicity/concurrency?
Update ProtocolThe 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 UpdateWhere appropriate, map RESTful HTTP requests to SPARQL/Update operationsDELETE /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 PathsSupport arbitrary-length predicate paths in triple patterns – “regular expressions” on predicates?Query hierarchical structures such as RDF collectionsIssues 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 QueryInitial scaffolding for authoring federated SPARQL queriesLikely will involve a keyword to explicitly target portions of a query to specific endpointsInitial plan: Start with ARQ’s SERVICE keywordSELECT … WHERE {  … SERVICE ex:books {   … }}
Entailment Regime SemanticsSPARQL/Query 1.0 defines a mechanism to extend SPARQL semantics for additional entailment regimesUse this mechanism to define the semantics of SPARQL queries for:RDF SchemaOWL flavorsRIF rule sets…Issues around:Requiring consistency checksHow to limit infinite results (e.g. from axiomatic inferences)
Common FunctionsExtend the set of functions that SPARQL engines must support to include some of…Common string functions (e.g. substr)Common date/time/datetime functionsLogical functions (COALESCE, IF, …?)Limited discussion to date about which functions to include
Get InvolvedJoin. Email team-sparql-chairs@w3.orgFollow. WG materials at http://www.w3.org/2009/sparql/wiki/Comment. Public feedback at public-rdf-dawg-comments@w3.orgUse. Discuss SPARQL at public-sparql-dev@w3.org
SPARQL ResourcesThe SPARQL Specificationhttp://www.w3.org/TR/rdf-sparql-query/SPARQL implementationshttp://esw.w3.org/topic/SparqlImplementationsSPARQL endpointshttp://esw.w3.org/topic/SparqlEndpointsSPARQL Frequently Asked Questionshttp://www.thefigtrees.net/lee/sw/sparql-faqSPARQL 2 Working Grouphttp://www.w3.org/2009/sparql/wiki/Common SPARQL extensionshttp://esw.w3.org/topic/SPARQL/Extensions

What;s Coming In SPARQL2?

  • 1.
    What’s coming withSPARQL 2?Slides available online at:http://www.slideshare.net/LeeFeigenbaum/whats-coming-in-sparql2Comments & questions to:Lee Feigenbaum <lee@cambridgesemantics.com>VP Technology & Standards, Cambridge SemanticsCo-chair, W3C SPARQL Working Group
  • 2.
    For More DetailsSPARQLBy Examplehttp://www.cambridgesemantics.com/2008/09/sparql-by-example/SPARQL Cheat Sheethttp://www.slideshare.net/LeeFeigenbaum/sparql-cheat-sheetSPARQL2 Statushttp://www.slideshare.net/LeeFeigenbaum/sparql2-status
  • 3.
    Why SPARQL?SPARQL isthe query language of the Semantic Web. SPARQL lets us:Pull values from structured and semi-structured dataExplore data by querying unknown relationshipsPerform complex joins of disparate data sources in a single, simple queryTransform RDF data from one vocabulary to another
  • 4.
    Structure of aSPARQL QueryA SPARQL query comprises, in order:Prefix declarations, for abbreviating URIsDataset definition, stating what RDF graph(s) are being queriedA result clause, identifying what information to return from the queryThe query pattern, specifying what to query for in the underlying datasetQuery modifiers, slicing, ordering, and otherwise rearranging query results
  • 5.
    Anatomy of aSPARQL QueryPREFIXfoo:<…>PREFIXbar:<…>…SELECT …FROM <…>FROM NAMED <…>WHERE{ …}ORDER BY …LIMIT …OFFSET …Declare prefixshortcuts (optional)Query result clauseDefine the dataset (optional)Query patternQuery modifiers(optional)
  • 6.
    An Example SPARQLQueryFind the name of all landlocked countries with a population bigger than 15 millionPREFIXrdfs:<http://www.w3.org/2000/01/rdf-schema#>PREFIXtype:<http://dbpedia.org/class/yago/>PREFIXprop: <http://dbpedia.org/property/>SELECT?country_name ?population WHERE{ ?countryatype:LandlockedCountries;rdfs:label?country_name;prop:populationEstimate?population.FILTER(?population>15000000).}
  • 7.
    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-uri named-graph-uri=<encoded graph URI>e.g. http%3A%2F%2Fexmaple.com%2Fbar…n.b. zero of more occurrences of named-graph-uriHTTP GET or POST. Graphs given in the protocol override graphs given in the query.
  • 8.
  • 9.
    DisclaimerThe SPARQL WorkingGroup 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.
  • 10.
    NamingI 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
  • 11.
    Where are wenow?TodayAugust 2010March 2009???Last Call and beyond of core SPARQL specificationsJuly 2009FPWD of SPARQL New Features and Rationales documentOctober 2009FPWD of core SPARQL specifications
  • 12.
  • 13.
    Projected ExpressionsSelect expressionsother 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 { …}
  • 14.
    AggregatesÀ la SQLaggregates (MIN, MAX, COUNT, AVG, etc.)Issues around:Which aggregates to includeAggregates over mixed datatypesSyntax, keywords, custom aggregatesSELECT MIN(?price) AS ?min_price …WHERE { … }GROUP BY ?item
  • 15.
    SubqueriesNested queries allowmultiple queries to be combined into one. Issues around:Variable scope & evaluation modelPrecise syntaxSELECT ?article ?authorWHERE { ?article ex:author ?author . { SELECT ?article WHERE { … ?article … } ORDER BY … LIMIT … }}
  • 16.
    NegationSupplant the mystifyingOPTIONAL/!bound method of negation with a dedicated constructIssues around:Filter semantics vs. set-difference semanticsChoice of keyword(s)SELECT … WHERE { ?person a foaf:Person . NOT { ?person foaf:mbox ?email }}
  • 17.
    Service DescriptionA standarddiscovery mechanism and vocabulary for describing the capabilities, extensions, data sets, and more for a SPARQL endpointDiscovery. 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
  • 18.
    Update LanguageBased onthe SPARQL Update member submissionBatch insert & deleteInsert & delete based on triple patternsGraph management (creation, removal)Issues around:Graph stores vs. triple storesWhich language statements to include?Transactions/atomicity/concurrency?
  • 19.
    Update ProtocolThe abilityto 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?
  • 20.
    RESTful UpdateWhere appropriate,map RESTful HTTP requests to SPARQL/Update operationsDELETE /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
  • 21.
    Property PathsSupport arbitrary-lengthpredicate paths in triple patterns – “regular expressions” on predicates?Query hierarchical structures such as RDF collectionsIssues 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 .}
  • 22.
    Basic Federated QueryInitialscaffolding for authoring federated SPARQL queriesLikely will involve a keyword to explicitly target portions of a query to specific endpointsInitial plan: Start with ARQ’s SERVICE keywordSELECT … WHERE { … SERVICE ex:books { … }}
  • 23.
    Entailment Regime SemanticsSPARQL/Query1.0 defines a mechanism to extend SPARQL semantics for additional entailment regimesUse this mechanism to define the semantics of SPARQL queries for:RDF SchemaOWL flavorsRIF rule sets…Issues around:Requiring consistency checksHow to limit infinite results (e.g. from axiomatic inferences)
  • 24.
    Common FunctionsExtend theset of functions that SPARQL engines must support to include some of…Common string functions (e.g. substr)Common date/time/datetime functionsLogical functions (COALESCE, IF, …?)Limited discussion to date about which functions to include
  • 25.
    Get InvolvedJoin. Emailteam-sparql-chairs@w3.orgFollow. WG materials at http://www.w3.org/2009/sparql/wiki/Comment. Public feedback at public-rdf-dawg-comments@w3.orgUse. Discuss SPARQL at public-sparql-dev@w3.org
  • 26.
    SPARQL ResourcesThe SPARQLSpecificationhttp://www.w3.org/TR/rdf-sparql-query/SPARQL implementationshttp://esw.w3.org/topic/SparqlImplementationsSPARQL endpointshttp://esw.w3.org/topic/SparqlEndpointsSPARQL Frequently Asked Questionshttp://www.thefigtrees.net/lee/sw/sparql-faqSPARQL 2 Working Grouphttp://www.w3.org/2009/sparql/wiki/Common SPARQL extensionshttp://esw.w3.org/topic/SPARQL/Extensions

Editor's Notes

  • #19 http://www.w3.org/Submission/SPARQL-Update/
  • #20 http://www.w3.org/Submission/SPARQL-Update/
  • #21 http://www.w3.org/Submission/SPARQL-Update/