query-4a17681e25c676452fdea06daeb0c07e

rq turtle/ttl

Jheald

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?preis ?preisLabel (COUNT (*) AS ?count) (SUM(?before_) AS ?before) (SUM(?after_) AS ?after)
       (SUM(?same_) AS ?same) (SUM(?unknown_) AS ?unknown)
WHERE {
  ?person wdt:P31 wd:Q5 .

  ?person p:P166 ?Leibnitz_preis_statement .
  ?Leibnitz_preis_statement a wikibase:BestRank ; ps:P166 wd:Q703205 .
  OPTIONAL { ?Leibnitz_preis_statement pq:P585 ?Leibnitz_preis_time . }

  ?person p:P166 ?preis_statement .
  ?preis_statement a wikibase:BestRank ; ps:P166 ?preis .
  OPTIONAL { ?preis_statement pq:P585 ?preis_time . }

  ?preis wdt:P31 ?preistype.
  VALUES ?preistype { wd:Q618779  wd:Q11448906 wd:Q15383322 wd:Q107471279 wd:Q378427    wd:Q107494520
                      wd:Q1404101 wd:Q5257307  wd:Q1829324  wd:Q1792571   wd:Q107471043 wd:Q636581
                      wd:Q1357196 wd:Q55190113 wd:Q955824   wd:Q1966910   wd:Q1709894 }

  BIND (IF (BOUND(?Leibnitz_preis_time) && BOUND(?preis_time) && ?preis_time < ?Leibnitz_preis_time, 1, 0) AS ?before_)
  BIND (IF (BOUND(?Leibnitz_preis_time) && BOUND(?preis_time) && ?preis_time > ?Leibnitz_preis_time, 1, 0) AS ?after_)
  BIND (IF (BOUND(?Leibnitz_preis_time) && BOUND(?preis_time) && ?preis_time = ?Leibnitz_preis_time, 1, 0) AS ?same_)
  BIND (IF (BOUND(?Leibnitz_preis_time) && BOUND(?preis_time), 0, 1) AS ?unknown_)  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY  ?preis ?preisLabel
ORDER BY DESC(?count)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?Leibnitz_preis_statement") v4("?Leibnitz_preis_time") v14("?after") v10("?after_"):::projected v13("?before") v9("?before_"):::projected v13("?count") v2("?person") v6("?preis"):::projected v5("?preis_statement") v7("?preis_time") v9("?preistype") v15("?same") v11("?same_"):::projected v16("?unknown") v12("?unknown_"):::projected c7(["wd:Q703205"]):::iri c10(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c5(["wikibase:BestRank"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal v2 --"p:direct/P31"--> c2 v2 --"p:P166"--> v3 v3 --"a"--> c5 v3 --"p:statement/P166"--> c7 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v3 -."p:qualifier/P585".-> v4 end v2 --"p:P166"--> v5 v5 --"a"--> c5 v5 --"p:statement/P166"--> v6 subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."p:qualifier/P585".-> v7 end v6 --"p:direct/P31"--> v9 bind0[/VALUES ?preistype/] bind0-->v9 bind00(["wd:Q618779"]) bind00 --> bind0 bind01(["wd:Q11448906"]) bind01 --> bind0 bind02(["wd:Q15383322"]) bind02 --> bind0 bind03(["wd:Q107471279"]) bind03 --> bind0 bind04(["wd:Q378427"]) bind04 --> bind0 bind05(["wd:Q107494520"]) bind05 --> bind0 bind06(["wd:Q1404101"]) bind06 --> bind0 bind07(["wd:Q5257307"]) bind07 --> bind0 bind08(["wd:Q1829324"]) bind08 --> bind0 bind09(["wd:Q1792571"]) bind09 --> bind0 bind010(["wd:Q107471043"]) bind010 --> bind0 bind011(["wd:Q636581"]) bind011 --> bind0 bind012(["wd:Q1357196"]) bind012 --> bind0 bind013(["wd:Q55190113"]) bind013 --> bind0 bind014(["wd:Q955824"]) bind014 --> bind0 bind015(["wd:Q1966910"]) bind015 --> bind0 bind016(["wd:Q1709894"]) bind016 --> bind0 bind1[/"if(bound(?Leibnitz_preis_time)bound(?preis_time)?preis_time < ?Leibnitz_preis_time,'1^^xsd:integer','0^^xsd:integer')"/] v4 --o bind1 v7 --o bind1 bind1 --as--o v9 bind2[/"if(bound(?Leibnitz_preis_time)bound(?preis_time)?preis_time > ?Leibnitz_preis_time,'1^^xsd:integer','0^^xsd:integer')"/] v4 --o bind2 v7 --o bind2 bind2 --as--o v10 bind3[/"if(bound(?Leibnitz_preis_time)bound(?preis_time)?preis_time = ?Leibnitz_preis_time,'1^^xsd:integer','0^^xsd:integer')"/] v4 --o bind3 v7 --o bind3 bind3 --as--o v11 bind4[/"if(bound(?Leibnitz_preis_time)bound(?preis_time),'0^^xsd:integer','1^^xsd:integer')"/] v4 --o bind4 v7 --o bind4 bind4 --as--o v12 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind10[/"count(*)"/] bind10 --as--o v13 bind11[/"sum(?before_)"/] v9 --o bind11 bind11 --as--o v13 bind12[/"sum(?after_)"/] v10 --o bind12 bind12 --as--o v14 bind13[/"sum(?same_)"/] v11 --o bind13 bind13 --as--o v15 bind14[/"sum(?unknown_)"/] v12 --o bind14 bind14 --as--o v16