query-18ebb0ee33a6308f333e5af33f7e90b8

rq turtle/ttl

https://w.wiki/6h$$

https://w.wiki/6i23

Parité homme/femme dans les émissions TV de Frédéric Taddéï

SELECT $series $seriesLabel ((?totalMale100)/?totalGuests AS ?malePercent) ((?totalFemale100)/?totalGuests AS ?femalePercent) WHERE { { SELECT $series (SUM(?male) AS ?totalMale) (SUM(?female) AS ?totalFemale) ((SUM(?female) + SUM(?male)) AS ?totalGuests) WHERE { $item wdt:P31 wd:Q21191270 . $item wdt:P179 $series ; wdt:P5030 ?guest . $series wdt:P371 wd:Q603 . ?guest wdt:P21 $gender .

  BIND (
    IF(?gender = wd:Q6581097 , 1, 0) AS ?male
  )
  BIND (
    IF(?gender = wd:Q6581072 , 1, 0) AS ?female
  )
}
GROUP BY $series $seriesLabel

} SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". } }

https://w.wiki/6i2Q

https://w.wiki/6i5Y

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# https://w.wiki/6h$$ 
# https://w.wiki/6i23

# Parité homme/femme dans les émissions TV de Frédéric Taddéï
SELECT $series $seriesLabel ((?totalMale*100)/?totalGuests AS ?malePercent) ((?totalFemale*100)/?totalGuests AS ?femalePercent) 
WHERE {
  {
    SELECT $series (SUM(?male) AS ?totalMale) (SUM(?female) AS ?totalFemale) ((SUM(?female) + SUM(?male)) AS ?totalGuests) 
    WHERE {
      $item wdt:P31 wd:Q21191270 .
      $item wdt:P179 $series ; wdt:P5030 ?guest .
      $series wdt:P371 wd:Q603 .
      ?guest wdt:P21 $gender .

      BIND (
        IF(?gender = wd:Q6581097 , 1, 0) AS ?male
      )
      BIND (
        IF(?gender = wd:Q6581072 , 1, 0) AS ?female
      )
    }
    GROUP BY $series $seriesLabel
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en". }
}

# https://w.wiki/6i2Q
# https://w.wiki/6i5Y

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v7("?_anon_42b5416610844a34809f33a099ae9de14940") v8("?_anon_42b5416610844a34809f33a099ae9de14941") v6("?female") v13("?femalePercent") v4("?gender") v3("?guest") v1("?item") v5("?male") v12("?malePercent") v2("?series"):::projected v10("?totalFemale"):::projected v11("?totalGuests"):::projected v9("?totalMale"):::projected c9(["bd:serviceParam"]):::iri c6(["wd:Q603"]):::iri c11(["fr,en"]):::literal c2(["wd:Q21191270"]):::iri v1 --"wdt:P31"--> c2 v1 --"wdt:P179"--> v2 v1 --"wdt:P5030"--> v3 v2 --"wdt:P371"--> c6 v3 --"wdt:P21"--> v4 bind0[/"if(?gender = 'wd:Q6581097','1^^xsd:integer','0^^xsd:integer')"/] v4 --o bind0 bind0 --as--o v5 bind1[/"if(?gender = 'wd:Q6581072','1^^xsd:integer','0^^xsd:integer')"/] v4 --o bind1 bind1 --as--o v6 bind6[/"sum(?female)"/] v6 --o bind6 bind6 --as--o v7 bind7[/"sum(?male)"/] v5 --o bind7 bind7 --as--o v8 bind8[/"sum(?male)"/] v5 --o bind8 bind8 --as--o v9 bind9[/"sum(?female)"/] v6 --o bind9 bind9 --as--o v10 bind10[/" + "/] null --o bind10 null --o bind10 bind10 --as--o v11 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c9 --"wikibase:language"--> c11 end bind11[/"?totalMale * '100^^xsd:integer' / ?totalGuests"/] v9 --o bind11 v11 --o bind11 bind11 --as--o v12 bind12[/"?totalFemale * '100^^xsd:integer' / ?totalGuests"/] v10 --o bind12 v11 --o bind12 bind12 --as--o v13