query-b844b3da2a229b4d29c92dd3afa7ec89
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?id ?geo
(IF (BOUND(?nl_title), CONCAT("[[:nl:", ?nl_title, "|", ?idLabel, "]]"), ?idLabel) AS ?title)
(SAMPLE(?image) AS ?img)
(IF (BOUND(?img), CONCAT(?creatorLabel, "\n", "[[File:", SUBSTR(STR(?img), 52), "|200px]]"), ?creatorLabel) AS ?description)
(IF(?gender = wd:Q6581097, "#CCFFFF", IF(?gender = wd:Q6581072, "#FFCCCC", "#CCCCCC")) AS ?marker_color)
WHERE {
?id wdt:P136 wd:Q557141;
wdt:P625 ?geo;
wdt:P17 wd:Q31.
OPTIONAL {
?id wdt:P170 ?creator.
?creator wdt:P21 ?gender.
}
OPTIONAL { ?id wdt:P18 ?image }
OPTIONAL {
?sitelink schema:about ?id.
?sitelink schema:isPartOf <https://nl.wikipedia.org/> .
?sitelink schema:name ?nl_title .
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en, nl".
?id rdfs:label ?idLabel.
?creator rdfs:label ?creatorLabel.
}
}
GROUP BY ?id ?geo ?creator ?gender ?nl_title ?idLabel ?creatorLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?creator")
v9("?creatorLabel"):::projected
v12("?description")
v4("?gender"):::projected
v2("?geo"):::projected
v1("?id"):::projected
v8("?idLabel"):::projected
v5("?image"):::projected
v11("?img"):::projected
v13("?marker_color")
v7("?nl_title"):::projected
v6("?sitelink")
v10("?title")
c2(["wd:Q557141"]):::iri
c16(["en, nl"]):::literal
c5(["wd:Q31"]):::iri
c14(["bd:serviceParam"]):::iri
c11([https://nl.wikipedia.org/]):::iri
v1 --"wdt:P136"--> c2
v1 --"wdt:P625"--> v2
v1 --"wdt:P17"--> c5
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P170".-> v3
v3 --"wdt:P21"--> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v1 -."wdt:P18".-> v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v6 -."schema:about".-> v1
v6 --"schema:isPartOf"--> c11
v6 --"schema:name"--> v7
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
v1 --"rdfs:label"--> v8
v3 --"rdfs:label"--> v9
end
bind1[/"if(bound(?nl_title),concat('#91;#91;:nl:',?nl_title,'|',?idLabel,'#93;#93;'),?idLabel)"/]
v7 --o bind1
v8 --o bind1
bind1 --as--o v10
bind2[/"sample(?image)"/]
v5 --o bind2
bind2 --as--o v11
bind3[/"if(bound(?img),concat(?creatorLabel,'
','#91;#91;File:',substring(str(?img),'52^^xsd:integer'),'|200px#93;#93;'),?creatorLabel)"/]
v11 --o bind3
v9 --o bind3
bind3 --as--o v12
bind4[/"if(?gender = 'wd:Q6581097','#CCFFFF',if(?gender = 'wd:Q6581072','#FFCCCC','#CCCCCC'))"/]
v4 --o bind4
bind4 --as--o v13