query-373f919de859dcdb2e5d625c16553eb1

rq turtle/ttl

Tous les éléments distincts sourcés avec le CQT. SELECT (COUNT(DISTINCT ?item) AS ?total) (COUNT(?item_is_human) AS ?is_human) (?is_human / ?total * 100.0 AS ?pct_human) (COUNT(DISTINCT ?item_has_naissance) AS ?has_naissance) (?has_naissance / ?total * 100.0 AS ?pct_naissance) (COUNT(DISTINCT ?item_has_mort) AS ?has_mort) (?has_mort / ?total * 100.0 AS ?pct_mort) (COUNT(DISTINCT ?item_is_organizaion) AS ?is_organizaion) (?is_organizaion / ?total * 100.0 AS ?pct_organizaion) (COUNT(DISTINCT ?item_has_pays) AS ?has_pays) (?has_pays / ?total * 100.0 AS ?pct_pays) WITH { SELECT DISTINCT ?item WHERE { # Find statements with Q100443909 as reference ?autre_statement pr:P248 wd:Q100443909 . ?statement prov:wasDerivedFrom ?autre_statement .

# Get the statements' property and subject
?property a wikibase:Property ;
   wikibase:claim ?ppp .
?item ?ppp ?statement .

} } AS %get_items_having_statements_with_a_specific_source WHERE { INCLUDE %get_items_having_statements_with_a_specific_source OPTIONAL { ?item wdt:P31 wd:Q5 . BIND (true AS ?item_is_human) } OPTIONAL { ?item wdt:P569 ?naissance . BIND (?item AS ?item_has_naissance) } OPTIONAL { ?item wdt:P570 ?mort . BIND (?item AS ?item_has_mort) } OPTIONAL { ?item wdt:P31 / wdt:P279* wd:Q43229 . hint:Prior hint:gearing "forward" . BIND (?item AS ?item_is_organizaion) } OPTIONAL { ?item (wdt:P17 | wdt:P27) ?pays . BIND (?item AS ?item_has_pays) } }

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
#Tous les éléments distincts sourcés avec le CQT.
SELECT (COUNT(DISTINCT ?item) AS ?total)
  (COUNT(?item_is_human) AS ?is_human) (?is_human / ?total * 100.0 AS ?pct_human)
  (COUNT(DISTINCT ?item_has_naissance) AS ?has_naissance) (?has_naissance / ?total * 100.0 AS ?pct_naissance)
  (COUNT(DISTINCT ?item_has_mort) AS ?has_mort) (?has_mort / ?total * 100.0 AS ?pct_mort)
  (COUNT(DISTINCT ?item_is_organizaion) AS ?is_organizaion) (?is_organizaion / ?total * 100.0 AS ?pct_organizaion)
  (COUNT(DISTINCT ?item_has_pays) AS ?has_pays) (?has_pays / ?total * 100.0 AS ?pct_pays)
WHERE
{

{
  SELECT DISTINCT ?item
  WHERE
  {
    # Find statements with Q100443909 as reference
    ?autre_statement pr:P248 wd:Q100443909 .
    ?statement prov:wasDerivedFrom ?autre_statement .

    # Get the statements' property and subject
    ?property a wikibase:Property ;
       wikibase:claim ?ppp .
    ?item ?ppp ?statement .
  }
}  OPTIONAL
  {
    ?item wdt:P31 wd:Q5 .
    BIND (true AS ?item_is_human)
  }
  OPTIONAL
  {
    ?item wdt:P569 ?naissance .
    BIND (?item AS ?item_has_naissance)
  }
  OPTIONAL
  {
    ?item wdt:P570 ?mort .
    BIND (?item AS ?item_has_mort)
  }
  OPTIONAL
  {
    ?item wdt:P31 / wdt:P279* wd:Q43229 .

    BIND (?item AS ?item_is_organizaion)
  }
  OPTIONAL
  {
    ?item (wdt:P17 | wdt:P27) ?pays .
    BIND (?item AS ?item_has_pays)
  }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?autre_statement") v19("?has_mort"):::projected v17("?has_naissance"):::projected v23("?has_pays"):::projected v15("?is_human"):::projected v21("?is_organizaion"):::projected v5("?item"):::projected v10("?item_has_mort"):::projected v8("?item_has_naissance"):::projected v13("?item_has_pays"):::projected v6("?item_is_human"):::projected v11("?item_is_organizaion"):::projected v9("?mort") v7("?naissance") v12("?pays") v16("?pct_human") v20("?pct_mort") v18("?pct_naissance") v22("?pct_organizaion") v24("?pct_pays") v4("?ppp") v3("?property") v2("?statement") v14("?total"):::projected a1((" ")) c5(["wikibase:Property"]):::iri c12(["wd:Q43229"]):::iri c8(["wd:Q5"]):::iri c2(["wd:Q100443909"]):::iri v1 --"pr:P248"--> c2 v2 --"prov:wasDerivedFrom"--> v1 v3 --"a"--> c5 v3 --"wikibase:claim"--> v4 v5 -->v4--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P31".-> c8 bind0[/"'true^^xsd:boolean'"/] bind0 --as--o v6 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P569".-> v7 bind1[/"?item"/] v5 --o bind1 bind1 --as--o v8 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P570".-> v9 bind2[/"?item"/] v5 --o bind2 bind2 --as--o v10 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v5 -."wdt:P31".-> a1 a1 --"wdt:P279"--> c12 bind3[/"?item"/] v5 --o bind3 bind3 --as--o v11 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; v5 -."wdt:P27".-> v12 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v5 --"wdt:P17"--> v12 end union0r <== or ==> union0l end bind4[/"?item"/] v5 --o bind4 bind4 --as--o v13 end bind11[/"count(?item)"/] v5 --o bind11 bind11 --as--o v14 bind12[/"count(?item_is_human)"/] v6 --o bind12 bind12 --as--o v15 bind13[/"?is_human / ?total * '100.0^^xsd:decimal'"/] v15 --o bind13 v14 --o bind13 bind13 --as--o v16 bind14[/"count(?item_has_naissance)"/] v8 --o bind14 bind14 --as--o v17 bind15[/"?has_naissance / ?total * '100.0^^xsd:decimal'"/] v17 --o bind15 v14 --o bind15 bind15 --as--o v18 bind16[/"count(?item_has_mort)"/] v10 --o bind16 bind16 --as--o v19 bind17[/"?has_mort / ?total * '100.0^^xsd:decimal'"/] v19 --o bind17 v14 --o bind17 bind17 --as--o v20 bind18[/"count(?item_is_organizaion)"/] v11 --o bind18 bind18 --as--o v21 bind19[/"?is_organizaion / ?total * '100.0^^xsd:decimal'"/] v21 --o bind19 v14 --o bind19 bind19 --as--o v22 bind20[/"count(?item_has_pays)"/] v13 --o bind20 bind20 --as--o v23 bind21[/"?has_pays / ?total * '100.0^^xsd:decimal'"/] v23 --o bind21 v14 --o bind21 bind21 --as--o v24