Skip to content

Instantly share code, notes, and snippets.

Created July 14, 2022 19:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
SPARQL query of nomisma places to generate Linked Pasts GeoJSON-LD
PREFIX crm: <>
PREFIX dcterms: <>
PREFIX dcmitype: <>
PREFIX foaf: <>
PREFIX geo: <>
PREFIX nm: <>
PREFIX nmo: <>
PREFIX org: <>
PREFIX rdf: <>
PREFIX rdfs: <>
PREFIX skos: <>
PREFIX xsd: <>
PREFIX osgeo: <>
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