query-161877be7e2399674dfe4558290eb8fd
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT
?item
(SAMPLE (?titleL) AS ?title)
(group_concat(distinct ?creatorL ; separator = ", ") as ?creator)
(group_concat(distinct ?genreL ; separator = ", ") as ?genre)
(group_concat(distinct ?placeL ; separator = ", ") as ?place)
(group_concat(distinct ?arr ; separator = ", ") as ?arrondissement)
(SAMPLE (?img) AS ?image)
(SAMPLE (?coord) AS ?coordinates) {
{
SELECT DISTINCT ?item { {
?item wdt:P136 wd:Q557141 ; # genre: public art
wdt:P131 wd:Q90 # located in: Paris
} UNION { # or
?item wdt:P136 wd:Q557141 ; # genre: public art
wdt:P131/wdt:P131* wd:Q90 # located in an arrondissement of Paris
} }
}
# title
OPTIONAL { ?item rdfs:label ?titleL filter (lang(?titleL) = "fr") }
# creators
OPTIONAL { ?item wdt:P170 [rdfs:label ?creatorL] filter (lang(?creatorL) = "fr") }
#genre
OPTIONAL {
{
?item wdt:P136 ?g filter (STR(?g) != 'http://www.wikidata.org/entity/Q557141')
} UNION {
?item wdt:P31 ?g .
}
?g rdfs:label ?genreL filter (lang(?genreL) = "fr") .
}
# place
OPTIONAL {
?item wdt:P276 [rdfs:label ?placeL] filter (lang(?placeL) = "fr") .
}
# arrondissement
OPTIONAL {
?item wdt:P131 [wdt:P131 wd:Q90 ; rdfs:label ?arrL] filter (lang(?arrL) = "fr").
BIND(REPLACE(?arrL, '^([0-9]+).*$', "$1", "si") AS ?arr)
}
# image
OPTIONAL { ?item wdt:P18 ?img }
# coordinates
OPTIONAL { ?item wdt:P625 ?coord }
} GROUP BY ?item
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?arr"):::projected
v1("?arrL")
v15("?arrondissement")
v10("?coord"):::projected
v17("?coordinates")
v12("?creator")
v4("?creatorL"):::projected
v7("?g")
v13("?genre")
v3("?genreL"):::projected
v16("?image")
v9("?img"):::projected
v6("?item"):::projected
v14("?place")
v2("?placeL"):::projected
v11("?title")
v5("?titleL"):::projected
a1((" "))
a2((" "))
a3((" "))
a4((" "))
c5(["wd:Q90"]):::iri
c3(["wd:Q557141"]):::iri
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P136"--> c3
v6 --"wdt:P131"--> a1
a1 --"wdt:P131"--> c5
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v6 --"wdt:P136"--> c3
v6 --"wdt:P131"--> c5
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."rdfs:label".-> v5
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
a2 -."rdfs:label".-> v4
v6 --"wdt:P170"--> a2
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v6 -."wdt:P31".-> v7
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
f0[["str(?g) != 'http://www.wikidata.org/entity/Q557141'"]]
f0 --> v7
v6 --"wdt:P136"--> v7
end
union1r <== or ==> union1l
end
v7 --"rdfs:label"--> v3
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
a3 -."rdfs:label".-> v2
v6 --"wdt:P276"--> a3
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
a4 -."wdt:P131".-> c5
a4 --"rdfs:label"--> v1
v6 --"wdt:P131"--> a4
bind1[/"replace(?arrL,'^(#91;0-9#93;+).*$','$1','si')"/]
v1 --o bind1
bind1 --as--o v8
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v6 -."wdt:P18".-> v9
end
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v6 -."wdt:P625".-> v10
end
bind9[/"sample(?titleL)"/]
v5 --o bind9
bind9 --as--o v11
bind10[/"?creatorL"/]
v4 --o bind10
bind10 --as--o v12
bind11[/"?genreL"/]
v3 --o bind11
bind11 --as--o v13
bind12[/"?placeL"/]
v2 --o bind12
bind12 --as--o v14
bind13[/"?arr"/]
v8 --o bind13
bind13 --as--o v15
bind14[/"sample(?img)"/]
v9 --o bind14
bind14 --as--o v16
bind15[/"sample(?coord)"/]
v10 --o bind15
bind15 --as--o v17