Slideshow transcript
Slide 1: a division of Publishing Technology SPARQL Query Forms Leigh Dodds, Oxford SWIG, March 2008 Photo Credit: Glen Bowman
Slide 2: a division of Publishing Technology Why are there 4 SPARQL Query Forms? SPARQL Use Cases doesn’t help very much…
Slide 3: a division of Publishing Technology …neither does the SPARQL specification SELECT Returns all, or a subset of, the variables bound in a query pattern match. CONSTRUCT Returns an RDF graph constructed by substituting variables in a set of triple templates. ASK Returns a boolean indicating whether a query pattern matches or not. DESCRIBE Returns an RDF graph that describes the resources found.
Slide 4: a division of Publishing Technology What are they for?
Slide 5: a division of Publishing Technology SELECT Equivalent to SQL SELECT Returns a nice, regular table
Slide 6: a division of Publishing Technology SELECT PREFIX table: <http://www.daml.org/2003/01/periodictable/PeriodicTable#> SELECT ?name ?weight WHERE { ?element table:name ?name; table:atomicWeight ?weight. } ORDER BY DESC(?weight) LIMIT 10
Slide 7: a division of Publishing Technology ASK Returns a true/false value Is there data that looks like this? Do you have any information about that?
Slide 8: a division of Publishing Technology ASK PREFIX foaf: <http://xmlns.com/foaf/0.1/> ASK WHERE { ?person a foaf:Person ; foaf:mbox <mailto:leigh@ldodds.com>. } (SPARQL equivalent of a vanity search!)
Slide 9: a division of Publishing Technology CONSTRUCT Returns an RDF graph Extract a specific subset of the queried data I want this, this, and this
Slide 10: a division of Publishing Technology CONSTRUCT PREFIX foaf: <http://xmlns.com/foaf/0.1/> CONSTRUCT { ?friend a foaf:Person; foaf:name ?name; foaf:homepage ?home. } WHERE { ?person foaf:mbox <mailto:leigh@ldodds.com>; foaf:knows ?friend. ?friend foaf:name ?name; foaf:homepage ?home. }
Slide 11: a division of Publishing Technology DESCRIBE Returns an RDF graph Tell me about this or things that look like this …but you decide what’s relevant
Slide 12: a division of Publishing Technology DESCRIBE PREFIX foaf: <http://xmlns.com/foaf/0.1/> DESCRIBE ?friend WHERE { ?person foaf:mbox “mailto:leigh@ldodds.com”; foaf:knows ?friend. }
Slide 13: a division of Publishing Technology Applied Uses Beyond the basics
Slide 14: a division of Publishing Technology DESCRIBE for Prototyping DESCRIBE <http://example.org/someResource> Quickly assembling UIs Web APIs
Slide 15: a division of Publishing Technology SELECT for Indexing Building an ordering over some data ORDER BY, LIMIT
Slide 16: a division of Publishing Technology CONSTRUCT for Transformation …and also simple inferencing CONSTRUCT could be the XSLT of RDF Currently limited by lack of expressions in CONSTRUCT triple templates
Slide 17: a division of Publishing Technology CONSTRUCT for Transformation PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX ex: <http://www.example.org/blogger/> CONSTRUCT { ?person a ex:Blogger. } WHERE { ?person foaf:weblog ?blog. }
Slide 18: a division of Publishing Technology SPARQL for Validation XSLT can be used for XML Validation (Schematron) SPARQL can be used for RDF Validation
Slide 19: a division of Publishing Technology Validation – ASK* ASK WHERE { #triple patterns that you don’t want to find } *Source: Talis Platform Field Predicate Map Validation
Slide 20: a division of Publishing Technology Validation – CONSTRUCT * CONSTRUCT { #some error message or data } WHERE { #triple patterns that you don’t want to find } *Source: Alistair Miles, Schemarama 2 Jena 2 Validation Support
Slide 21: a division of Publishing Technology In Combination?
Slide 22: a division of Publishing Technology The ADC Pattern ASK – DESCRIBE – CONSTRUCT Probe endpoint Grab default view of data Refine data extraction and/or apply transformation
Slide 23: a division of Publishing Technology Questions?



Add a comment on Slide 1
If you have a SlideShare account, login to comment; else you can comment as a guest- Favorites & Groups
Showing 1-50 of 0 (more)