query-42f77ae91a1bc764016f8319d6a530ae

rq turtle/ttl

For article Q6679

Two columns of data, breakdown of paper 2% at a time

SELECT ?quantile (COUNT(?hybrid1) AS ?count1) (COUNT(?hybrid2) AS ?count2)

WHERE { ?annotation wdt:P3 wd:Q5 ; wdt:P19 ?anchor; wdt:P16 ?dic0. VALUES ?dic { wd:Q6803 wd:Q6793 }. ?dic wdt:P16 ?dic0. BIND((IF (?dic=wd:Q6803, "Q6803",1/0)) AS ?hybrid1) BIND((IF (?dic=wd:Q6793, "Q6793",1/0)) AS ?hybrid2)
BIND(COALESCE(?hybrid1,?hybrid2) AS ?hybrid) BIND(COALESCE(?hybrid1Label,?hybrid2Label) AS ?hl) ?anchor wdt:P12 wd:Q6679. ?anchor wdt:P10 ?charnumber. ?annotationZ wdt:P19 ?anchorZ. ?anchorZ wdt:P7 wd:Q6; wdt:P12 wd:Q6679; wdt:P10 ?length. BIND (floor(50*?charnumber/?length) AS ?quantile) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?quantile ORDER BY ASC(?quantile)

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#>
#For article Q6679
#Two columns of data, breakdown of paper 2% at a time
SELECT ?quantile (COUNT(?hybrid1) AS ?count1) (COUNT(?hybrid2) AS ?count2) 

  WHERE {
    ?annotation wdt:P3 wd:Q5 ;
                wdt:P19 ?anchor;
                wdt:P16 ?dic0.
    VALUES ?dic { wd:Q6803 wd:Q6793 }.
    ?dic wdt:P16 ?dic0.
    BIND((IF (?dic=wd:Q6803, "Q6803",1/0)) AS ?hybrid1)
    BIND((IF (?dic=wd:Q6793, "Q6793",1/0)) AS ?hybrid2)  
    BIND(COALESCE(?hybrid1,?hybrid2) AS ?hybrid)
    BIND(COALESCE(?hybrid1Label,?hybrid2Label) AS ?hl)
    ?anchor wdt:P12 wd:Q6679.
    ?anchor wdt:P10 ?charnumber.
    ?annotationZ wdt:P19 ?anchorZ.
    ?anchorZ wdt:P7 wd:Q6;
             wdt:P12 wd:Q6679;
             wdt:P10 ?length.
   BIND (floor(50*?charnumber/?length) AS ?quantile)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  }
 GROUP BY ?quantile
 ORDER BY ASC(?quantile)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?anchor") v12("?anchorZ") v2("?annotation") v11("?annotationZ") v10("?charnumber") v14("?count1") v15("?count2") v5("?dic") v4("?dic0") v9("?hl") v8("?hybrid") v6("?hybrid1"):::projected v7("?hybrid2"):::projected v13("?length") v14("?quantile"):::projected c11(["bd:serviceParam"]):::iri c2(["wd:Q5"]):::iri c9(["wd:Q6"]):::iri c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal c6(["wd:Q6679"]):::iri v2 --"wdt:P3"--> c2 v2 --"wdt:P19"--> v3 v2 --"wdt:P16"--> v4 bind0[/VALUES ?dic/] bind0-->v5 bind00(["wd:Q6803"]) bind00 --> bind0 bind01(["wd:Q6793"]) bind01 --> bind0 v5 --"wdt:P16"--> v4 bind1[/"if(?dic = 'wd:Q6803','Q6803','1^^xsd:integer' / '0^^xsd:integer')"/] v5 --o bind1 bind1 --as--o v6 bind2[/"if(?dic = 'wd:Q6793','Q6793','1^^xsd:integer' / '0^^xsd:integer')"/] v5 --o bind2 bind2 --as--o v7 bind3[/"?hybrid1?hybrid2"/] v6 --o bind3 v7 --o bind3 bind3 --as--o v8 bind4[/"?hybrid1Label?hybrid2Label"/] null --o bind4 null --o bind4 bind4 --as--o v9 v3 --"wdt:P12"--> c6 v3 --"wdt:P10"--> v10 v11 --"wdt:P19"--> v12 v12 --"wdt:P7"--> c9 v12 --"wdt:P12"--> c6 v12 --"wdt:P10"--> v13 bind5[/"numeric-floor('50^^xsd:integer' * ?charnumber / ?length)"/] v10 --o bind5 v13 --o bind5 bind5 --as--o v14 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c11 --"wikibase:language"--> c13 end bind8[/"count(?hybrid1)"/] v6 --o bind8 bind8 --as--o v14 bind9[/"count(?hybrid2)"/] v7 --o bind9 bind9 --as--o v15