query-10488df6a9c8e2809ccc0ba3f2ee6db0
For article Q6679
SELECT ?decile ?hybrid
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)
?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)
}
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
#For article Q6679
SELECT ?decile ?hybrid
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)
?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)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?anchor")
v10("?anchorZ")
v1("?annotation")
v9("?annotationZ")
v8("?charnumber")
v12("?decile"):::projected
v4("?dic")
v3("?dic0")
v7("?hybrid"):::projected
v5("?hybrid1")
v6("?hybrid2")
v11("?length")
c2(["wd:Q5"]):::iri
c9(["wd:Q6"]):::iri
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
v2 --"wdt:P12"--> c6
v2 --"wdt:P10"--> v8
v9 --"wdt:P19"--> v10
v10 --"wdt:P7"--> c9
v10 --"wdt:P12"--> c6
v10 --"wdt:P10"--> v11
bind4[/"numeric-floor('10^^xsd:integer' * ?charnumber / ?length)"/]
v8 --o bind4
v11 --o bind4
bind4 --as--o v12