query-802890247e518ea7e7543a38a7f3cf6e

rq turtle/ttl

Levana Taylor

Use at

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 p: <http://www.wikidata.org/prop/>
SELECT DISTINCT ?item ?wikisource
WHERE
{
  ?item wdt:P31 wd:Q5. # ?item is human

  ?item p:P18 ?image_statement_1 .
  ?item p:P18 ?image_statement_2 .
  FILTER (?image_statement_1 != ?image_statement_2) # First filter: Comparing the IRIs is fastest
  FILTER (STR(?image_statement_1) < STR(?image_statement_2)) # Second filter: Convert to string to the halve the result set
  ?image_statement_1 wikibase:rank ?rank1.
  ?image_statement_2 wikibase:rank ?rank2.
  FILTER (?rank1 != wikibase:PreferredRank)
  FILTER (?rank2 != wikibase:PreferredRank)

  ?wikisource schema:about ?item.
  ?wikisource schema:isPartOf <https://en.wikisource.org/>.
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?image_statement_1") v4("?image_statement_2") v5("?item"):::projected v2("?rank1") v1("?rank2") v6("?wikisource"):::projected c3(["wd:Q5"]):::iri c8([https://en.wikisource.org/]):::iri f0[["?rank2 != 'wikibase:PreferredRank'"]] f0 --> v1 f1[["?rank1 != 'wikibase:PreferredRank'"]] f1 --> v2 f2[["str(?image_statement_1) < str(?image_statement_2)"]] f2 --> v3 f2 --> v4 f3[["?image_statement_1 != ?image_statement_2"]] f3 --> v3 f3 --> v4 v5 --"p:direct/P31"--> c3 v5 --"p:P18"--> v3 v5 --"p:P18"--> v4 v3 --"wikibase:rank"--> v2 v4 --"wikibase:rank"--> v1 v6 --"schema:about"--> v5 v6 --"schema:isPartOf"--> c8