Your SlideShare is downloading. ×
SPARQL Query Forms
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

SPARQL Query Forms


Published on

Examines the different SPARQL query forms to tease out their uses and applications

Examines the different SPARQL query forms to tease out their uses and applications

Published in: Technology, Education

  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide
  • Transcript

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