1 / 12

SPARQL 101: Query fundamentals, sample queries, Query builder, and simple reports

SPARQL 101: Query fundamentals, sample queries, Query builder, and simple reports. Nicholas Rejack – nrejack@ufl.edu VIVO Implementation Fest – Boulder, CO Wednesday, May 16, 2012 – 1:30 – 2:30 PM. Goal of this presentation: Provide you with a basic introduction to querying

Download Presentation

SPARQL 101: Query fundamentals, sample queries, Query builder, and simple reports

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SPARQL 101: Query fundamentals, sample queries, Query builder, and simple reports Nicholas Rejack – nrejack@ufl.edu VIVO Implementation Fest – Boulder, CO Wednesday, May 16, 2012 – 1:30 – 2:30 PM

  2. Goal of this presentation: Provide you with a basic introduction to querying Provide you with some building blocks to piece together new queries

  3. SPARQL basics • SPARQL = SPARQL Protocol And RDF Query Language • Similiarity to SQL querying: • SELECT • FROM • WHERE • ORDER BY etc. clauses the same • Differences: We’re binding triples, not columns • We need to use either prefixed (namespace) elements or URIs • What will not be covered in these sessions: • Updates

  4. Basic variable binding in all 3 locations • 1) Binding variable in subject position: • “show me all the info about this” • URI example (1) (use case: find all triples about a particular URI) • Prefixed example (2) (use case: show all the information about a particular ontology element) • 2) Binding variable in predicate position: • “show me all the uses of this predicate” • Prefixed example (3) (use cases: show me all the uses of this predicate) • Labeled example (4) & (5) (add selected variables)

  5. Basic variable binding in all 3 locations • 3) Binding variable in object position • “show me all the reverse links back to the subject” • URI example (6)

  6. Restricting results: LIMIT • Results list may be too long, or take too long to return • Restrict amount you return with LIMIT keyword • Example (7)

  7. COUNT keyword • Use COUNT to get a sum (8) • Syntax: • SELECTcount(var) or SELECT (count(var) as ?var2) • Be careful what you are counting: • You may need to view the data before re-running the query to count it (9)

  8. Displaying the graph • Use GRAPH keyword (10) • Syntax: • SELECT * WHERE • { • GRAPH ?g • { • Query • } • }

  9. Simple reporting with CSV files • Use the CSV output option to generate simple reports

  10. Binding multiple variables • Query builder example: building author lists

  11. Resources for further learning • Contribute queries via SF wiki: • http://sourceforge.net/apps/mediawiki/vivo/index.php?title=SPARQL_Queries_for_Data_Maintenance

  12. Questions? • Contact: Nicholas Rejack (nrejack@ufl.edu)

More Related