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

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

SPARQL Query Forms

5,270
views

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

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,270
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
132
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
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.
      • 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.
    • 4. What are they for?
    • 5. SELECT Equivalent to SQL SELECT Returns a nice, regular table
    • 6. 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
    • 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: <http://xmlns.com/foaf/0.1/> ASK WHERE { ?person a foaf:Person ; foaf:mbox <mailto:leigh@ldodds.com>. } (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: <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. }
    • 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: <http://xmlns.com/foaf/0.1/> DESCRIBE ?friend WHERE { ?person foaf:mbox “mailto:leigh@ldodds.com”; foaf:knows ?friend. }
    • 13. Applied Uses Beyond the basics
    • 14. DESCRIBE for Prototyping DESCRIBE <http://example.org/someResource> 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: <http://xmlns.com/foaf/0.1/> PREFIX ex: <http://www.example.org/blogger/> 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?