query-a549a302ffc2fcb8148f2c9169090608
Related galleries based on artist overlap
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX target: <http://www.wikidata.org/entity/Q2982867>
SELECT
?artists
?gallery ?galleryLabel
(CONCAT("#gallery/", SUBSTR(STR(?gallery), 32)) AS ?galleryUrl)
?galleryDescription
?example_artist ?example_artistLabel
(CONCAT("#visualartist/", SUBSTR(STR(?example_artist), 32)) AS ?example_artistUrl)
WHERE {
{
SELECT
(COUNT(DISTINCT ?artist) AS ?artists)
?gallery
(SAMPLE(?artist) AS ?example_artist)
WHERE {
?artist ^wdt:P170 / wdt:P195 target:, ?gallery .
FILTER (target: != ?gallery)
}
GROUP BY ?gallery
} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?artists)
LIMIT 500
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?artist")
v4("?artists"):::projected
v4("?example_artist"):::projected
v6("?example_artistUrl")
v2("?gallery"):::projected
v5("?galleryUrl")
a1((" "))
c1([http://www.wikidata.org/entity/Q2982867]):::iri
c5(["bd:serviceParam"]):::iri
c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["http://www.wikidata.org/entity/Q2982867 != ?gallery"]]
f0 --> v2
a1 --"wdt:P170"--> v3
a1 --"wdt:P195"--> c1
a1 --"wdt:P195"--> v2
bind3[/"count(?artist)"/]
v3 --o bind3
bind3 --as--o v4
bind4[/"sample(?artist)"/]
v3 --o bind4
bind4 --as--o v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end
bind5[/"concat('#gallery/',substring(str(?gallery),'32^^xsd:integer'))"/]
v2 --o bind5
bind5 --as--o v5
bind6[/"concat('#visualartist/',substring(str(?example_artist),'32^^xsd:integer'))"/]
v4 --o bind6
bind6 --as--o v6