query-c3cae045ca6a64eaa30bbda1e3e57042
deprecated redirecthttps://w.wiki/8BiA
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?qid ?x1 ?iri ?qs
#?item ?qid ?iri ?y1 ?y2
{
?item p:P227 [
ps:P227 ?x1;
pq:P2241 wd:Q45403344;
wikibase:rank ?r1].
?item wdt:P227 ?x2;
wdt:P31 wd:Q5;
wdt:P7902 ?y1;
wdt:P7902 ?y2.
FILTER ( str(?x1)< str( ?x2) )
#FILTER ( ?x1 = ?y1 )
#FILTER ( ?x2 = ?y2 )
BIND(xsd:integer(SUBSTR(STR(?item),33)) as ?qid)
BIND(IRI(CONCAT( STR(?item),"#P227")) as ?iri)
BIND(CONCAT( SUBSTR(STR(?item),32),',"""',?x1,'"""') as ?qs)
}
ORDER BY ASC(?qid)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v8("?iri"):::projected
v5("?item")
v8("?qid"):::projected
v9("?qs"):::projected
v4("?r1")
v2("?x1"):::projected
v3("?x2")
v6("?y1")
v7("?y2")
a1((" "))
c3(["wd:Q45403344"]):::iri
c8(["wd:Q5"]):::iri
f0[["str(?x1) < str(?x2)"]]
f0 --> v2
f0 --> v3
a1 --"p:statement/P227"--> v2
a1 --"p:qualifier/P2241"--> c3
a1 --"wikibase:rank"--> v4
v5 --"p:P227"--> a1
v5 --"p:direct/P227"--> v3
v5 --"p:direct/P31"--> c8
v5 --"p:direct/P7902"--> v6
v5 --"p:direct/P7902"--> v7
bind1[/"http://www.w3.org/2001/XMLSchema#integer(substring(str(?item),'33^^xsd:integer'))"/]
v5 --o bind1
bind1 --as--o v8
bind2[/"concat(str(?item),'#P227')"/]
v5 --o bind2
bind2 --as--o v8
bind3[/"concat(substring(str(?item),'32^^xsd:integer'),',"""',?x1,'"""')"/]
v5 --o bind3
v2 --o bind3
bind3 --as--o v9