Skip to content

Instantly share code, notes, and snippets.

@btotr
Created November 5, 2022 00:11
Show Gist options
  • Save btotr/48688aed60152d8d328281120e9961cc to your computer and use it in GitHub Desktop.
Save btotr/48688aed60152d8d328281120e9961cc to your computer and use it in GitHub Desktop.
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?geonames ?imgS ?vlag
WHERE {
{
SELECT distinct ?geonames ?geoId ?imgS
WHERE {
?term a skos:Concept; skos:narrower+ ?nt ;
skos:prefLabel ?label .
?nt skos:prefLabel ?ntLabel .
?item edm:object ?nt; dc:subject/skos:prefLabel ?onderwerp; dct:medium/skos:prefLabel ?medium; dct:spatial ?spatial; edm:isShownBy ?img .
?spatial skos:prefLabel ?lokatie; skos:exactMatch ?geonames .
BIND(REPLACE(STR(?geonames), "[^0-9]","", "i") AS ?geoId).
BIND(replace(?img, 'http://', 'https://') AS ?imgS)
FILTER(?label = 'hoeden' || ?ntLabel = 'hoeden')
}
LIMIT 150
}
SERVICE <https://query.wikidata.org/bigdata/namespace/wdq/sparql> {
?s wdt:P1566 ?geoId .
?vlag ^wdt:P17*/^wdt:P41 ?s .
}
}
GROUP BY ?geonames ?vlag ?imgS
ORDER BY RAND()
LIMIT 24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment