Lab: Wikidata in RDF

From info216
Revision as of 10:47, 21 February 2024 by Sinoa (talk | contribs) (Created page with "==Topics== Wikidata in RDF: * retrieve ''truthy'' triples about a Wikidata entity * retrieve semantic metadata (such as qualifications and references) about the triples * loa...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Topics

Wikidata in RDF:

  • retrieve truthy triples about a Wikidata entity
  • retrieve semantic metadata (such as qualifications and references) about the triples
  • load the semantic data and metadata into GraphDB
  • visualise the semantic data and metadata

Motivation: So far you have built your own knowledge graph and worked on a small grap you were given. This week we will look at how to retrieve knowledge graphs from Wikidata, which can then be merged with your own graph to provide additional context. This is not a trivial problem because Wikidata most likely contains a lot more data - and in particular metadata - than you need.

Useful materials

Tasks

Getting ready: In a web browser, go to Wikidata's Query Service (WDQS). Be careful to always use a limit like LIMIT 100 when you test things. Otherwise, you risk being blocked from the query service or, worse, you risk blocking out a whole subdomain.

Emergency data: If Wikdata's Query Service is unavailable, you can load [:File:Q42-extended.txt | this Turtle file] into GraphDB instead, and continue there using Q42 as your example entity. (Remember to rename it from .txt to .ttl.)

Task: From Wikidata's ordinary UI, find the Q-code of one of the people or entities involved in the Mueller investigation. Use that entity as your reference in the rest of this lab. (The Q-code should look like this https://www.wikidata.org/entity/Q42 or wd:Q42.)

Task: Use a DESCRIBE query to retrieve some triples about your entity (remember LIMIT 100, although it is less critical on DESCRIBE queries).

Task: Use a SELECT query to retrieve the first 100 triples about your entity.

Task: Start GraphDB on your local machine. Create a new repository (No inference needed), and activate it.

Write a local SELECT query that embeds a <http://query.wikidata.org> SERVICE query to retrieve the first 100 triples about your entity to your local machine.

Change the SELECT query to an INSERT query that updates your local repository.