query-0157e954afc130ee585cc1cf42156b01

rq turtle/ttl

Related artworks

Use at

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/Q21044790>

SELECT 
  ?score
  ?reasons

  ?artwork ?artworkLabel
  (CONCAT("#artwork/", SUBSTR(STR(?artwork), 32)) AS ?artworkUrl)
  ?artworkDescription

WHERE {
   {
  SELECT 
    (SUM(?score_) AS ?score)
    (GROUP_CONCAT(DISTINCT ?reason; separator=", ") AS ?reasons)
    ?artwork
  WHERE {
    {
      BIND(1 AS ?score_)
      BIND("collection" AS ?reason)
      target: wdt:P195 / ^wdt:P195 ?artwork
    }
    UNION
    {
      BIND(3 AS ?score_)
      BIND("artist" AS ?reason)
      target: wdt:P170 / ^wdt:P170 ?artwork
    }
    UNION
    {
      BIND(1 AS ?score_)
      BIND("depiction" AS ?reason)
      target: wdt:P180 / ^wdt:P180 ?artwork
    }
    UNION
    {
      BIND(2 AS ?score_)
      BIND("exhibition" AS ?reason)
      target: wdt:P608 / ^wdt:P608 ?artwork
    }
    UNION
    {
      BIND(2 AS ?score_)
      BIND("genre" AS ?reason)
      target: wdt:P136 / ^wdt:P136 ?artwork
    }
    UNION
    {
      BIND(1 AS ?score_)
      BIND("date" AS ?reason)
      target: wdt:P571 / ^wdt:P571 ?artwork
    }
    FILTER (target: != ?artwork)
  }
  GROUP BY ?artwork
  ORDER BY DESC(?score)
  LIMIT 500
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en,cz,da,de,fi,fr,nb,nn,sv". }
}
ORDER BY DESC(?score)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?artwork"):::projected v6("?artworkUrl") v5("?reason") v5("?reasons"):::projected v5("?score"):::projected v5("?score_") a1((" ")) a2((" ")) a3((" ")) a4((" ")) a5((" ")) a6((" ")) c9(["bd:serviceParam"]):::iri c11(["#91;AUTO_LANGUAGE#93;,mul,en,cz,da,de,fi,fr,nb,nn,sv"]):::literal c1([http://www.wikidata.org/entity/Q21044790]):::iri f0[["http://www.wikidata.org/entity/Q21044790 != ?artwork"]] f0 --> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; subgraph union3[" Union "] subgraph union3l[" "] style union3l fill:#abf,stroke-dasharray: 3 3; subgraph union4[" Union "] subgraph union4l[" "] style union4l fill:#abf,stroke-dasharray: 3 3; bind1[/"'1^^xsd:integer'"/] bind1 --as--o v5 bind2[/"'date'"/] bind2 --as--o v5 c1 --"wdt:P571"--> a6 v2 --"wdt:P571"--> a6 end subgraph union4r[" "] style union4r fill:#abf,stroke-dasharray: 3 3; bind3[/"'2^^xsd:integer'"/] bind3 --as--o v5 bind4[/"'genre'"/] bind4 --as--o v5 c1 --"wdt:P136"--> a5 v2 --"wdt:P136"--> a5 end union4r <== or ==> union4l end end subgraph union3r[" "] style union3r fill:#abf,stroke-dasharray: 3 3; bind5[/"'2^^xsd:integer'"/] bind5 --as--o v5 bind6[/"'exhibition'"/] bind6 --as--o v5 c1 --"wdt:P608"--> a4 v2 --"wdt:P608"--> a4 end union3r <== or ==> union3l end end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; bind7[/"'1^^xsd:integer'"/] bind7 --as--o v5 bind8[/"'depiction'"/] bind8 --as--o v5 c1 --"wdt:P180"--> a3 v2 --"wdt:P180"--> a3 end union2r <== or ==> union2l end end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; bind9[/"'3^^xsd:integer'"/] bind9 --as--o v5 bind10[/"'artist'"/] bind10 --as--o v5 c1 --"wdt:P170"--> a2 v2 --"wdt:P170"--> a2 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; bind11[/"'1^^xsd:integer'"/] bind11 --as--o v5 bind12[/"'collection'"/] bind12 --as--o v5 c1 --"wdt:P195"--> a1 v2 --"wdt:P195"--> a1 end union0r <== or ==> union0l end bind15[/"sum(?score_)"/] v5 --o bind15 bind15 --as--o v5 bind16[/"?reason"/] v5 --o bind16 bind16 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind17[/"concat('#artwork/',substring(str(?artwork),'32^^xsd:integer'))"/] v2 --o bind17 bind17 --as--o v6