Linked Open Data British Museum practical

authored by Frank Lynam at 01/12/2014 17:44:46

Objective

Get a list of all of the granodiorite sarcophagi in the British Museum collection. Find out where they were discovered and use the Google Maps Geocoding API to get the geo-coordinates (longitude, latitude, elevation) for these find spots.

Steps

  1. Go to the BM’s SPARQL endpoint at http://collection.britishmuseum.org/sparql
  2. Enter the following query:

#Get all of the find locations of the granodiorite sarcophagi that are housed in the BM
PREFIX ecrm: <http://erlangen-crm.org/current/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX bmo: <http://collection.britishmuseum.org/id/ontology/>
SELECT ?s ?findDicoveryEventPlaceName { ?s bmo:PX_object_type ?objecttype. ?objecttype skos:prefLabel "sarcophagus". ?s ecrm:P45_consists_of ?material. ?material skos:prefLabel "granodiorite" . ?s ecrm:P12i_was_present_at ?findDiscoveryEvent . ?findDiscoveryEvent ecrm:P7_took_place_at ?findDicoveryEventPlace . ?findDicoveryEventPlace skos:prefLabel ?findDicoveryEventPlaceName . } LIMIT 100
  1. Read through and make sure that you understand the logic of the query.
  2. When satisfied, click <Submit> to run the query.
  3. Download the results as JSON data.
  4. Open up Google Refine (or OpenRefine).
  5. Create a new project using your JSON file as the source data.
  6. Follow the instructions on how to parse this JSON data correctly.
  7. Select the column that lists the discovery location place-names.
  8. Click on <Edit column>/<Add column by fetching URLs…>.
  9. Enter a name for your new column (this will store the geo-coordinates that correspond to your place-names).
  10. In the <Expression> field enter the following:

"https://maps.googleapis.com/maps/api/geocode/json?address="+escape(value, "url")+"&key=[GMAPS API KEY]"
  1. Here you are going to have to fill in Google Maps API key in the place shown. You can get this by signing up to use the Google Maps API. You can do this at https://developers.google.com/maps/signup.
  2. Once you have your API key, replace ‘[GMAPS API KEY]’ in the <Expression> field and click <OK> to start the Web API calls.
  3. All going well, your new column should be populated with a list of JSON data that correspond to the place-name of the row.

 

Further work

Parse the geo-coordinates into longitude, latitude and elevation values and plot these values on a map using Google Maps, OpenLayers or Leaflet.js.

Comments

submit