Tuesday, August 22, 2017

More mapping features for Nomisma SPARQL responses

Edited 23 August 2017: changed getGeoJsonForQuery to query.json and getKmlForQuery to query.kml

The Nomisma.org SPARQL query HTML interface, for both SELECT and CONSTRUCT/DESCRIBE responses, has been extended generate a map when the query response includes latitude and longitude geographic coordinates (when using the geo:lat and geo:long RDF properties).

The introduction of this new feature necessitated the creation of a new API, query.json, which is essentially an XSLT transformation from either the SPARQL XML response schema or RDF into GeoJSON. The XSLT was extended from existing templates for the other GeoJSON responses for getting the geographic distribution of mints, hoards, or individual finds for a Nomisma concept ID or a coin type.

The query (get a list of hoards that contained tetradrachm coin types [based on PELLA])


PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX nm: <http://nomisma.org/id/>
PREFIX nmo: <http://nomisma.org/ontology#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT DISTINCT ?hoard ?findspot ?lat ?long WHERE {
  ?type a nmo:TypeSeriesItem ;
          nmo:hasDenomination nm:tetradrachm .
  ?coin nmo:hasTypeSeriesItem ?type ;
        dcterms:isPartOf ?hoard .
  ?hoard a nmo:Hoard ;
           nmo:hasFindspot ?findspot .
  ?findspot geo:lat ?lat ;
            geo:long ?long
}

is therefore rendered as the image below:

Map response for SPARQL query, http://bit.ly/2v36y9t
The GeoJSON response is rendered in Leaflet with the MarkerCluster plugin. Similarly, by replacing SELECT DISTINCT with DESCRIBE, the map will also render when coordinates are available within the RDF output from the SPARQL endpoint. See here.

Furthermore, I introduced a query.kml API, which accepts the same SPARQL query parameter and outputs KML instead of GeoJSON.

The SPARQL results page now has links to download the result set in CSV for SELECT queries and RDF/XML, Turtle, and JSON-LD for CONSTRUCT/DESCRIBE, as well as links to the GeoJSON and KML responses when geographic distributions are available.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.