query-05bdfc929c42343530ba75293e648333

rq turtle/ttl

How many people are there whose "number of children (P1971)" matches with "child (P40)"? PS: Including the corner case where the number of children equals 0. P1971 is mainly used when full listings of children can't or shouldn't be included. How many people are there whose "number of children (P1971)" matches with "child (P40)"?PS: Including the corner case where the number of children equals 0. P1971 is mainly used when full listings of children can't or shouldn't be included. How many people are there whose "number of children (P1971)" matches with "child (P40)"? PS: Including the corner case where the number of children equals 0. P1971 is mainly used when full listings of children can't or shouldn't be included. How many people are there whose "number of children (P1971)" matches with "child (P40)"?PS: Including the corner case where the number of children equals 0. P1971 is mainly used when full listings of children can't or shouldn't be included. Combien de personnes existe-t-il dont le "nombre d'enfants (P1971)" vaut "enfant (P40)"?PS : y compris le cas limite pour lequel le nombre d'enfants vaut 0. P1971 est principalement utilisé lorsque la liste complète des enfants ne peut pas (ou ne doit pas) être incluse. How many people are there whose "number of children (P1971)" matches with "child (P40)"? PS: Including the corner case where the number of children equals 0. P1971 is mainly used when full listings of children can't or shouldn't be included. Hoeveel mensen hebben een "aantal kinderen (P1971) " die overeenkomt met "kind (P40)"?PS: Inclusief het grensgeval waar het aantal kinderen gelijk is aan 0. P1971 wordt voornamelijk gebruikt wanneer volledige lijsten van kinderen niet kunnen of niet mogen worden opgenomen. How many people are there whose "number of children (P1971)" matches with "child (P40)"? PS: Including the corner case where the number of children equals 0. P1971 is mainly used when full listings of children can't or shouldn't be included. How many people are there whose "number of children (P1971)" matches with "child (P40)"? PS: Including the corner case where the number of children equals 0. P1971 is mainly used when full listings of children can't or shouldn't be included. How many people are there whose "number of children (P1971)" matches with "child (P40)"? PS: Including the corner case where the number of children equals 0. P1971 is mainly used when full listings of children can't or shouldn't be included. How many people are there whose "number of children (P1971)" matches with "child (P40)"?PS: Including the corner case where the number of children equals 0. P1971 is mainly used when full listings of children can't or shouldn't be included.

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT (COUNT(DISTINCT(?person)) AS ?countPerson)
WHERE {
  { # non-zero number of children matches
    ?person wdt:P1971 ?numOfChildren .
    {SELECT ?person (COUNT(?child) AS ?numOfChildrenComputed)
    WHERE {
      ?person wdt:P40 ?child 
    }
    GROUP BY ?person}
    FILTER (?numOfChildren = ?numOfChildrenComputed)
  }
  UNION
  { # zero number of children matches
    ?person wdt:P1971 "0"^^xsd:decimal .
    FILTER NOT EXISTS { ?person wdt:P40 ?child }
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?child") v5("?countPerson") v1("?numOfChildren") v5("?numOfChildrenComputed") v3("?person"):::projected c3(["0^^xsd:decimal"]):::literal subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; f0[["not "]] subgraph f0e0["Exists Clause"] e0v1 --"wdt:P40"--> e0v2 e0v2("?child"):::projected e0v1("?person"):::projected end f0--EXISTS--> f0e0 f0 --> v3 f0 --> c2 f0 --> v4 v3 --"wdt:P40"--> v4 v3 --"wdt:P1971"--> c3 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; f1[["?numOfChildren = ?numOfChildrenComputed"]] f1 --> v1 f1 --> v5 v3 --"wdt:P1971"--> v1 v3 --"wdt:P40"--> v4 bind3[/"count(?child)"/] v4 --o bind3 bind3 --as--o v5 end union0r <== or ==> union0l end bind5[/"count(?person)"/] v3 --o bind5 bind5 --as--o v5