query-61f322d4a72c7cac594d527965a391e0

rq turtle/ttl

TODO

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 DISTINCT ?countryLabel (AVG(?fertility) AS ?fertilityAverage) (AVG(?democracy) AS ?democracyAverage) (AVG(?lifeExpectancy) AS ?lifeExpectancyAverage) WHERE
{
   { 
  SELECT ?country ?countryLabel WHERE {

 ?country wdt:P31 wd:Q6256;
          rdfs:label ?countryLabel.
   FILTER (REGEX(?countryLabel, "(Italy)|(Germany)")).
   FILTER(lang(?countryLabel)="en").
  } }  ?country p:P4841 ?fertilityStatement.
  ?fertilityStatement ps:P4841 ?fertility;
                      pq:P585 ?fertilityDate.

  ?country p:P8328 ?democracyStatement.
  ?democracyStatement ps:P8328 ?democracy;
                      pq:P585 ?democracyDate.

  ?country p:P2250 ?lifeExpectancyStatement.
  ?lifeExpectancyStatement ps:P2250 ?lifeExpectancy;
                           pq:P585 ?lifeExpectancyDate.
} GROUP BY ?countryLabel HAVING (AVG(?fertility) > 1.30 && AVG(?democracy) > 0.5) ORDER BY ASC(?country)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v12("?_anon_d00291b7e9a143df8ec0be8c8ebd714c103935") v13("?_anon_d00291b7e9a143df8ec0be8c8ebd714c103936") v1("?country") v2("?countryLabel"):::projected v7("?democracy"):::projected v15("?democracyAverage") v8("?democracyDate") v6("?democracyStatement") v4("?fertility"):::projected v14("?fertilityAverage") v5("?fertilityDate") v3("?fertilityStatement") v10("?lifeExpectancy"):::projected v16("?lifeExpectancyAverage") v11("?lifeExpectancyDate") v9("?lifeExpectancyStatement") a1((" ")) a2((" ")) c6(["wd:Q6256"]):::iri f0[[" > '1.30^^xsd:decimal' > '0.5^^xsd:decimal'"]] f0 --> a1 f0 --> a2 f1[["?countryLabel = 'en'"]] f1 --> v2 f2[["regex(?countryLabel,'(Italy)|(Germany)')"]] f2 --> v2 v1 --"p:direct/P31"--> c6 v1 --"rdfs:label"--> v2 v1 --"p:P4841"--> v3 v3 --"p:statement/P4841"--> v4 v3 --"p:qualifier/P585"--> v5 v1 --"p:P8328"--> v6 v6 --"p:statement/P8328"--> v7 v6 --"p:qualifier/P585"--> v8 v1 --"p:P2250"--> v9 v9 --"p:statement/P2250"--> v10 v9 --"p:qualifier/P585"--> v11 bind8[/"average(?fertility)"/] v4 --o bind8 bind8 --as--o v12 bind9[/"average(?democracy)"/] v7 --o bind9 bind9 --as--o v13 bind10[/"average(?fertility)"/] v4 --o bind10 bind10 --as--o v14 bind11[/"average(?democracy)"/] v7 --o bind11 bind11 --as--o v15 bind12[/"average(?lifeExpectancy)"/] v10 --o bind12 bind12 --as--o v16