query-2c7b1cac7a3b0002cffb31b20ac82d76

rq turtle/ttl

Elisabeth par pays de citoyenneté

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
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 ?country ?countryLabel (COUNT(*) AS ?count)  WHERE {
  VALUES ?target {
    wd:Q385468
    wd:Q17524931
    wd:Q18093037
  }
  ?item wdt:P31 wd:Q5;
    wdt:P27 ?country;
    p:P735 ?statement.
  ?statement ps:P735  ?target.
  OPTIONAL { ?statement pq:P1545 ?rank. }
  BIND(IF(BOUND(?rank),?rank, 0) AS ?rank2)
  FILTER(xsd:integer(?rank2) < xsd:integer(2))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". }
}
GROUP BY  ?country ?countryLabel
ORDER BY DESC (?count)
LIMIT 20

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?count") v5("?country"):::projected v4("?item") v7("?rank") v8("?rank2") v6("?statement") v3("?target") c9(["bd:serviceParam"]):::iri c3(["wd:Q5"]):::iri c11(["fr,en"]):::literal f0[["http://www.w3.org/2001/XMLSchema#integer(?rank2) < http://www.w3.org/2001/XMLSchema#integer('2^^xsd:integer')"]] f0 --> v8 bind1[/VALUES ?target/] bind1-->v3 bind10(["wd:Q385468"]) bind10 --> bind1 bind11(["wd:Q17524931"]) bind11 --> bind1 bind12(["wd:Q18093037"]) bind12 --> bind1 v4 --"p:direct/P31"--> c3 v4 --"p:direct/P27"--> v5 v4 --"p:P735"--> v6 v6 --"p:statement/P735"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."p:qualifier/P1545".-> v7 end bind2[/"if(bound(?rank),?rank,'0^^xsd:integer')"/] v7 --o bind2 bind2 --as--o v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind4[/"count(*)"/] bind4 --as--o v8