query-63f03c33444f7a114a95eec0284a4f03

rq turtle/ttl

TODO

Use at

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 ?item ?qid ?iri ?y1 ?y2
{
?item p:P227 [
ps:P227 ?x1;
pq:P2241 wd:Q45403344;
wikibase:rank ?r1].


?item wdt:P227 ?x2;
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)
}
ORDER BY ASC(?qid)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?iri"):::projected v7("?item"):::projected v8("?qid"):::projected v6("?r1") v4("?x1") v2("?x2") v5("?y1"):::projected v3("?y2"):::projected a1((" ")) c3(["wd:Q45403344"]):::iri f0[["?x2 = ?y2"]] f0 --> v2 f0 --> v3 f1[["?x1 = ?y1"]] f1 --> v4 f1 --> v5 f2[["str(?x1) < str(?x2)"]] f2 --> v4 f2 --> v2 a1 --"p:statement/P227"--> v4 a1 --"p:qualifier/P2241"--> c3 a1 --"wikibase:rank"--> v6 v7 --"p:P227"--> a1 v7 --"p:direct/P227"--> v2 v7 --"p:direct/P7902"--> v5 v7 --"p:direct/P7902"--> v3 bind3[/"http://www.w3.org/2001/XMLSchema#integer(substring(str(?item),'33^^xsd:integer'))"/] v7 --o bind3 bind3 --as--o v8 bind4[/"concat(str(?item),'#P227')"/] v7 --o bind4 bind4 --as--o v8