Using PoMS's SPARQL Interface for data


You can find here a small Python script which demonstrates how the PoMS SPARQL interface could be used to fetch data for presentation in a way different from that which is readily available from the PoMS's browser-oriented web application.

In this example, a SPARQL query is run to fetch all places involved as land in legal charters that have women as both grantor and beneficiary. The script uses the data the query generates (including the latitude and longitude coordinates for these places, plus a place name) to generate a map (using the Leaflet mechanisms). To run it yourself:

The script is generalized enough that a different query can be easily substituted to generate a different map. The script looks for variables called label, lat and long for values to use for each place's label, and for each latitude and longitude. The values from other variables displayed by the query are shown in a popup that is displayed on the map.

So that you can see what the script creates before you run it yourself, the page that the script generates is included in this folder, and is available for viewing here.

If you wish you can try replacing the query incorporated in the script with the following one, which plots all the places that are involved in legal charters where the language of the charter is Gaelic.

PREFIX vocab: <https://www.poms.ac.uk/rdf/ontology#>
PREFIX rdfs: <https://www.w3.org/2000/01/rdf-schema#>
select ?source ?sourceName ?factoid ?factName ?possession ?possName ?place ?label ?lat ?long
where {
  ?source vocab:hasLanguage <https://www.poms.ac.uk/rdf/entity/Language/Gaelic>
     rdfs:label ?sourceName.
  ?factoid vocab:hasSource ?source;
     rdfs:label ?factName;
     a vocab:TransactionFactoid.
  ?possref vocab:hasFactoid ?factoid;
     vocab:referencesPossession ?possession.
  ?possession a vocab:PossessionLand;
     vocab:hasName ?possName;
     vocab:hasPlace ?place.
  ?place vocab:hasName ?label;
      vocab:hasGeographicLatitude ?lat;
      vocab:hasGeographicLongitude ?long.
}

John Bradley, KDL and DDH, King's College London, May 2020