query-749fb8b10e9b0a288ce4abbc9d8bf36f

rq turtle/ttl

TODO

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
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 ?gdp ?currencyLabel ?flag (count(*) as ?rank) WHERE {
#  values ?country {wd:Q30 wd:Q184}
  ?country wdt:P463 wd:Q37470. 
  ?country2 wdt:P463 wd:Q37470.          
  ?country p:P2131 [ psv:P2131 [ wikibase:quantityAmount ?gdp; wikibase:quantityUnit ?currency ]; pq:P585 ?time; prov:wasDerivedFrom/pr:P248 wd:Q21540096 ] .
  FILTER(YEAR(?time) = 2017) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
  ?country2 p:P2131 [ psv:P2131 [ wikibase:quantityAmount ?gdp2; wikibase:quantityUnit ?currency ]; pq:P585 ?time; prov:wasDerivedFrom/pr:P248 wd:Q21540096 ] .
  filter (?gdp2 >= ?gdp)
  ?country wdt:P41 ?flag.
} group by ?country ?countryLabel ?gdp ?currencyLabel ?flag ORDER BY ?rank

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?country"):::projected v6("?country2") v7("?currency") v8("?flag"):::projected v3("?gdp"):::projected v2("?gdp2") v9("?rank") v4("?time") a2((" ")) a1((" ")) a3((" ")) a5((" ")) a4((" ")) a6((" ")) c10(["wd:Q21540096"]):::iri c15(["en"]):::literal c3(["wd:Q37470"]):::iri c13(["bd:serviceParam"]):::iri f0[["?gdp2 >= ?gdp"]] f0 --> v2 f0 --> v3 f1[["year-from-dateTime(?time) = '2017^^xsd:integer'"]] f1 --> v4 v5 --"p:direct/P463"--> c3 v6 --"p:direct/P463"--> c3 a1 --"wikibase:quantityAmount"--> v3 a1 --"wikibase:quantityUnit"--> v7 a2 --"p:statement/value/P2131"--> a1 a2 --"p:qualifier/P585"--> v4 a2 --"prov:wasDerivedFrom"--> a3 a3 --"p:reference/P248"--> c10 v5 --"p:P2131"--> a2 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end a4 --"wikibase:quantityAmount"--> v2 a4 --"wikibase:quantityUnit"--> v7 a5 --"p:statement/value/P2131"--> a4 a5 --"p:qualifier/P585"--> v4 a5 --"prov:wasDerivedFrom"--> a6 a6 --"p:reference/P248"--> c10 v6 --"p:P2131"--> a5 v5 --"p:direct/P41"--> v8 bind3[/"count(*)"/] bind3 --as--o v9