Wikidata:WikiProject LD4 Wikidata Affinity Group/Affinity Group Calls/Meeting Notes/2021-06-29

From Wikidata
Jump to navigation Jump to search

Call details[edit]

  • Date: 2021-06-29
  • Topic: Introduction to SPARQL and the Wikidata Query Service
  • Presenters: Robert Chavez (Northeastern University)

Presentation Material[edit]

Slides

Notes[edit]

Robert Chavez (Senior Digital Scholarship Developer, Northeastern University) on SPARQL basics and using the Wikidata Query Service

  • Why SPARQL?  A query language for RDF graph data.
  • ata, automatically adds labels to your SPARQL results (for any variable add -label to your SELECT statement)
    • Query runs, and then SERVICE runs
  • WQS helpers to look up URIs for constructing WHERE statements
  • WQS declares your prefixes for you: https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Full_list_of_prefixes (can be accessed from ‘Help’ menu)
  • LIMIT value to limit number of results, depending on your needs
    • How are items “ranked” to present the first 100 results, depends on what the back end is doing, consider results a random sample
  • Query Helper:  
    • Find resources within Wikidat and QH will construct SPARQL query for you as you go.
  • OPTIONAL:  ‘if this statement exists, add it to the original query’ and so will return results either way.
    • If you only want results where the statement exists, add it to the WHERE clause, layering your triple statements to refine your query.
  • When creating statements:  CTRL-Space to search for URIs by their labels
  • Specifying the language of the label retrieved from the Wikidata entities
  • Is “?” used in the same way as “wd:”?  
    • Question mark denotes a variable not a specific URL
  • How can we search for labels in two or three languages, would we get results even if the items don’t have labels in all those languages?
    • Yes!
  • Ways for writing a triple statement
    • Sub - Pred - Ob . [period]
    • More Turtle-like: Sub - pred - ob; [semicolon, and then next line] pred - ob
  • FILTER statement
    • Can use Regular Expressions, but need to include labels within your SELECT statement
    • Querying labels by using rdfs:label and then FILTER by language as desired
  • Where do you find all the prefixes you’re using?
    • Help menu on the Query Service page - “List of prefixes”
  • Options for visualizations of results, exporting data options
  • Is there an advantage to using the query that filters for a label over the traditionally structured query?
    • Depends on if your needs are to display a label or if you want to work with that data further.  
  • SPARQL on the last slide of the presentation
  • What are the hardware requirements for Wikibase?

Questions/discussions[edit]