query-8b29b9f8f53b11cbb6c09fb03866994f

rq turtle/ttl

Related films

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

SELECT
  ?score

  ?film ?filmLabel
  (CONCAT("#film/", SUBSTR(STR(?film), 32)) AS ?filmUrl)
  ?filmDescription
WHERE {
   {
  SELECT
    (SUM(?score_) AS ?score)
    ?film
  WHERE {
    { [] ^wdt:P161 ?film, target: }  # actor
    UNION 
    { [] ^wdt:P57 ?film, target: }  # director

    BIND(1 AS ?score_)
    FILTER (target: != ?film)
  }
  GROUP BY ?film
  ORDER BY DESC(?score)
  LIMIT 500
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?score)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?film"):::projected v4("?filmUrl") v4("?score"):::projected v3("?score_") a1((" ")) a2((" ")) c5(["bd:serviceParam"]):::iri c1([http://www.wikidata.org/entity/Q87126473]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal f0[["http://www.wikidata.org/entity/Q87126473 != ?film"]] f0 --> v2 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P57"--> a2 c1 --"wdt:P57"--> a2 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P161"--> a1 c1 --"wdt:P161"--> a1 end union0r <== or ==> union0l end bind1[/"'1^^xsd:integer'"/] bind1 --as--o v3 bind3[/"sum(?score_)"/] v3 --o bind3 bind3 --as--o v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end bind4[/"concat('#film/',substring(str(?film),'32^^xsd:integer'))"/] v2 --o bind4 bind4 --as--o v4