query-664137acc9e13726a4ad8622789b61b1

rq turtle/ttl

order

Use at

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#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item ?Len ?kdm ?kdmn WHERE { 
 ?item wdt:P170 wd:Q381238 .          # Witkacy as creator
 MINUS{ ?item wdt:P31 wd:Q3658341 .}  # no literary characters
 MINUS{ ?item wdt:P31 wd:Q125191 .}   # no photographs

 optional{ ?item p:P528 [ pq:P972 wd:Q106425660; ps:P528 ?kdm] . }
 optional{ ?item wdt:P156/wdt:P528 ?prev .}            
 optional{ ?item wdt:P155/wdt:P528 ?next .}             
 bind( if( bound(?kdm) && strStarts(str(?kdm), "I "), CONCAT(STR( ?kdm  ), ".5"), 
       if( bound(?next),                              CONCAT(STR( ?next ), ".9"),
       if( bound(?prev),                              CONCAT(STR( ?prev ), ".1"), 
       "Z") ) ) as ?kdmn ) .

 OPTIONAL {
   ?item rdfs:label ?Len 
   FILTER((LANG(?Len)) = "en")
 }
 filter (?item!=wd:Q107095853)
} order by ?kdmn

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?Len"):::projected v2("?item"):::projected v4("?kdm"):::projected v7("?kdmn"):::projected v6("?next") v5("?prev") a1((" ")) a2((" ")) a3((" ")) c6(["wd:Q3658341"]):::iri c7(["wd:Q125191"]):::iri c4(["wd:Q381238"]):::iri c9(["wd:Q106425660"]):::iri f0[["?item != 'wd:Q107095853'"]] f0 --> v2 v2 --"p:direct/P170"--> c4 subgraph minus1["MINUS"] style minus1 stroke-width:6px,fill:pink,stroke:red; v2 --"p:direct/P31"--> c6 end subgraph minus2["MINUS"] style minus2 stroke-width:6px,fill:pink,stroke:red; v2 --"p:direct/P31"--> c7 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; a1 -."p:qualifier/P972".-> c9 a1 --"p:statement/P528"--> v4 v2 --"p:P528"--> a1 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P156".-> a2 a2 --"p:direct/P528"--> v5 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P155".-> a3 a3 --"p:direct/P528"--> v6 end bind3[/"if(bound(?kdm)starts-with(str(?kdm),'I '),concat(str(?kdm),'.5'),if(bound(?next),concat(str(?next),'.9'),if(bound(?prev),concat(str(?prev),'.1'),'Z')))"/] v4 --o bind3 v6 --o bind3 v5 --o bind3 bind3 --as--o v7 subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v2 -."rdfs:label".-> v3 end