New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
What;s Coming In SPARQL2?
1. 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
2. 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
3. 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
4. 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
5. Anatomy of a SPARQL Query PREFIXfoo:<…> PREFIXbar:<…> … SELECT … FROM <…> FROM NAMED <…> WHERE{ … } ORDER BY … LIMIT … OFFSET … Declare prefix shortcuts (optional) Query result clause Define the dataset (optional) Query pattern Query modifiers (optional)
6. An Example SPARQL Query Find the name of all landlocked countries with a population bigger than 15 million PREFIXrdfs:<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-uri HTTP GET or POST. Graphs given in the protocol override graphs given in the query.
9. 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.
10. 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
11. Where are we now? Today August 2010 March 2009 ??? Last Call and beyond of core SPARQL specifications July 2009 FPWD of SPARQL New Features and Rationales document October 2009 FPWD of core SPARQL specifications
13. 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_price WHERE { … }
14. 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
15. Subqueries Nested queries allow multiple queries to be combined into one. Issues around: Variable scope & evaluation model Precise syntax SELECT ?article ?authorWHERE { ?article ex:author ?author . { SELECT ?article WHERE { … ?article … } ORDER BY … LIMIT … }}
16. 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 } }
17. 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
18. 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?
19. 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?
20. 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
21. 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 . }
22. 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 { … } }
23. 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)
24. 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
25. 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
26. 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