Lab: SPARQL 2

From info216
Revision as of 10:52, 11 February 2024 by Bamos3003 (talk | contribs) (Created page with "==Topics== * SPARQL updates * SPARQL insertions * SPARQL deletions * DESCRIBE and CONSTRUCT ==Useful materials== GraphDB documentation: * [https://graphdb.ontotext.com/docume...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Topics

  • SPARQL updates
  • SPARQL insertions
  • SPARQL deletions
  • DESCRIBE and CONSTRUCT

Useful materials

GraphDB documentation:

SPARQL reference:

Tasks

Task: Write the following SPARQL updates:

  • The muellerkg:name property is misnamed, because the object in those triples is always a resource. Rename it to something like muellerkg:person.
  • Update the graph so all the investigated person and president nodes (such as muellerkg:G._Gordon_Liddy and muellerkg:Richard_Nizon) become the subjects in foaf:name triples with the corresponding strings (G. Gordon Liddy and Richard Nixon) as the literals. (Tip: Use STR(kgmueller:) inside a REPLACE in a BIND statement to remove the URI path.)

Task: Load the RDF graph you created in exercises 1 and 2. (Maybe you want to create a new namespace in GraphDB first.) Use INSERT DATA updates to add these triples to your graph:

  • George Papadopoulos was adviser to the Trump campaign.
    • He pleaded guilty to lying to the FBI.
    • He was sentenced to prison.
  • Roger Stone is a Republican.
    • He was adviser to Trump.
    • He was an official in the Trump campaign.
    • He interacted with Wikileaks.
    • He made a testimony for the House Intelligence Committee.
    • He was cleared of all charges.

Task: Use DELETE DATA and then INSERT DATA updates to correct that Roger Stone was cleared of all charges. Actually,

  • He was indicted for making false statements, witness tampering, and obstruction of justice.

Task:

  • Use a DESCRIBE query to show the updated information about Roger Stone.
  • Use a CONSTRUCT query to create a new RDF group with triples only about Roger Stone (in other words, having Roger Stone as the subject.)

If you have more time

Task: In the russia_investigation_kg.ttl dataset, the muellerkg:name property used as predicate is already covered by a standard term from an estalished vocabulary in the LOD cloud: foaf:name, where foaf: is http://xmlns.com/foaf/0.1/.

  • If you have not done so already: write a SPARQL DELETE/INSERT update to change every muellerkg:name predicate in your graph to foaf:name. (It is easy to destroy your RDF graph when you do this, so it is good you saved a copy in the previous task.)
  • Otherwise: find another resource to rename everywhere. For example, you can change your local URI for a public person to a standard Wikidata URI.

Task: Write a DELETE/INSERT statement to change one of the prefixes in your graph, renaming all the resources that use that prefix.

Task: Write an INSERT statement to add at least one significant date to the Mueller investigation, with literal type xsd:date. Write a DELETE/INSERT statement to change the date to a string, and a new DELETE/INSERT statement to change it back to xsd:date.