query-501c32cb058f388c5f02ee3cc3646c92

rq turtle/ttl

For article Q6679

Two columns of data

SELECT ?decile (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(10*?charnumber/?length) AS ?decile) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?decile

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
SELECT ?decile (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(10*?charnumber/?length) AS ?decile)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  }
 GROUP BY ?decile

Query found at

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