Created
July 14, 2022 19:08
-
-
Save ewg118/26ebc278d7424e9953a30d6970e5e3bf to your computer and use it in GitHub Desktop.
SPARQL query of nomisma places to generate Linked Pasts GeoJSON-LD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> | |
PREFIX dcterms: <http://purl.org/dc/terms/> | |
PREFIX dcmitype: <http://purl.org/dc/dcmitype/> | |
PREFIX foaf: <http://xmlns.com/foaf/0.1/> | |
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> | |
PREFIX nm: <http://nomisma.org/id/> | |
PREFIX nmo: <http://nomisma.org/ontology#> | |
PREFIX org: <http://www.w3.org/ns/org#> | |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> | |
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> | |
PREFIX osgeo: <http://data.ordnancesurvey.co.uk/ontology/geometry/> | |
SELECT ?place ?label ?definition ?type ?source ?sourceLabel ?lat ?long ?geojson (group_concat(DISTINCT ?exactMatch) as ?exactMatches) (group_concat(DISTINCT ?closeMatch) as ?closeMatches) (group_concat(DISTINCT ?broader) as ?broaders) (group_concat(DISTINCT ?broaderLabel) as ?broaderLabels) (group_concat(DISTINCT ?related) as ?periods) WHERE { | |
{?place a nmo:Mint} | |
UNION {?place a nmo:Region} | |
?place skos:prefLabel ?label FILTER (langMatches(lang(?label), "en")) | |
OPTIONAL {?place skos:definition ?definition FILTER (langMatches(lang(?definition), "en"))} | |
?place rdf:type ?type FILTER (?type != skos:Concept) | |
?place geo:location ?loc. | |
OPTIONAL {?loc geo:lat ?lat ; | |
geo:long ?long } | |
OPTIONAL {?loc osgeo:asGeoJSON ?geojson} | |
OPTIONAL {?place dcterms:isPartOf ?field} | |
OPTIONAL {?place skos:closeMatch ?closeMatch} | |
OPTIONAL {?place skos:exactMatch ?exactMatch} | |
OPTIONAL {?place skos:broader ?broader . | |
?broader skos:prefLabel ?broaderLabel FILTER (langMatches(lang(?broaderLabel), "en"))} | |
OPTIONAL {?place dcterms:source ?source . | |
?source skos:prefLabel ?sourceLabel FILTER (langMatches(lang(?sourceLabel), "en"))} | |
OPTIONAL {?place dcterms:isPartOf/skos:related ?related} | |
FILTER NOT EXISTS {?place dcterms:isReplacedBy ?replace} | |
} GROUP BY ?place ?label ?definition ?type ?source ?sourceLabel ?lat ?long ?geojson ORDER BY ASC(?label) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment