query-b70910f9533b546e33cd06e6feb0d0b5
TODO
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX bd: <http://www.bigdata.com/rdf#>
select ?item ?itemLabel ?isbn13 ?isbn_13 ?article ?wen
where{
values ?item { wd:Q4356108} #remove this row when used in anger
?item wdt:P212 ?isbn13.
bind(if(substr(?isbn13,1,1)!="-",substr(?isbn13,1,1),"") as ?1)
bind(if(substr(?isbn13,2,1)!="-",substr(?isbn13,2,1),"") as ?2)
bind(if(substr(?isbn13,3,1)!="-",substr(?isbn13,3,1),"") as ?3)
bind(if(substr(?isbn13,4,1)!="-",substr(?isbn13,4,1),"") as ?4)
bind(if(substr(?isbn13,5,1)!="-",substr(?isbn13,5,1),"") as ?5)
bind(if(substr(?isbn13,6,1)!="-",substr(?isbn13,6,1),"") as ?6)
bind(if(substr(?isbn13,7,1)!="-",substr(?isbn13,7,1),"") as ?7)
bind(if(substr(?isbn13,8,1)!="-",substr(?isbn13,8,1),"") as ?8)
bind(if(substr(?isbn13,9,1)!="-",substr(?isbn13,9,1),"") as ?9)
bind(if(substr(?isbn13,10,1)!="-",substr(?isbn13,10,1),"") as ?10)
bind(if(substr(?isbn13,11,1)!="-",substr(?isbn13,11,1),"") as ?11)
bind(if(substr(?isbn13,12,1)!="-",substr(?isbn13,12,1),"") as ?12)
bind(if(substr(?isbn13,13,1)!="-",substr(?isbn13,13,1),"") as ?13)
bind(if(substr(?isbn13,14,1)!="-",substr(?isbn13,14,1),"") as ?14)
bind(if(substr(?isbn13,15,1)!="-",substr(?isbn13,15,1),"") as ?15)
bind(if(substr(?isbn13,16,1)!="-",substr(?isbn13,16,1),"") as ?16)
bind(if(substr(?isbn13,17,1)!="-",substr(?isbn13,17,1),"") as ?17)
bind(concat(?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17) as ?isbn_13)
filter(?isbn_13 in ("9784163191409","9784163191410", "9780709706922", "9788466305853", "9780688065706")) #add ISBNs here
optional { ?wen schema:about ?item . ?wen schema:name ?article. ?wen schema:inLanguage "en".}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?1")
v13("?10")
v14("?11")
v15("?12")
v16("?13")
v17("?14")
v18("?15")
v19("?16")
v20("?17")
v5("?2")
v6("?3")
v7("?4")
v8("?5")
v9("?6")
v10("?7")
v11("?8")
v12("?9")
v22("?article"):::projected
v3("?isbn13"):::projected
v21("?isbn_13"):::projected
v2("?item"):::projected
v21("?wen"):::projected
c10(["en"]):::literal
c12(["bd:serviceParam"]):::iri
c14(["#91;AUTO_LANGUAGE#93;,en"]):::literal
list0c5(["9780688065706"]):::literal
list0c2(["9784163191410"]):::literal
list0c3(["9780709706922"]):::literal
list0c4(["9788466305853"]):::literal
list0c1(["9784163191409"]):::literal
list0c1 --o f0
list0c2 --o f0
list0c3 --o f0
list0c4 --o f0
list0c5 --o f0
f0[[" in "]]
f0 --> v21
bind1[/VALUES ?item/]
bind1-->v2
bind10(["wd:Q4356108"])
bind10 --> bind1
v2 --"wdt:P212"--> v3
bind2[/"if(substring(?isbn13,'1^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'1^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind2
bind2 --as--o v4
bind3[/"if(substring(?isbn13,'2^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'2^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind3
bind3 --as--o v5
bind4[/"if(substring(?isbn13,'3^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'3^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind4
bind4 --as--o v6
bind5[/"if(substring(?isbn13,'4^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'4^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind5
bind5 --as--o v7
bind6[/"if(substring(?isbn13,'5^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'5^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind6
bind6 --as--o v8
bind7[/"if(substring(?isbn13,'6^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'6^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind7
bind7 --as--o v9
bind8[/"if(substring(?isbn13,'7^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'7^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind8
bind8 --as--o v10
bind9[/"if(substring(?isbn13,'8^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'8^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind9
bind9 --as--o v11
bind10[/"if(substring(?isbn13,'9^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'9^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind10
bind10 --as--o v12
bind11[/"if(substring(?isbn13,'10^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'10^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind11
bind11 --as--o v13
bind12[/"if(substring(?isbn13,'11^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'11^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind12
bind12 --as--o v14
bind13[/"if(substring(?isbn13,'12^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'12^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind13
bind13 --as--o v15
bind14[/"if(substring(?isbn13,'13^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'13^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind14
bind14 --as--o v16
bind15[/"if(substring(?isbn13,'14^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'14^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind15
bind15 --as--o v17
bind16[/"if(substring(?isbn13,'15^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'15^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind16
bind16 --as--o v18
bind17[/"if(substring(?isbn13,'16^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'16^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind17
bind17 --as--o v19
bind18[/"if(substring(?isbn13,'17^^xsd:integer','1^^xsd:integer') != '-',substring(?isbn13,'17^^xsd:integer','1^^xsd:integer'),'')"/]
v3 --o bind18
bind18 --as--o v20
bind19[/"concat(?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,?12,?13,?14,?15,?16,?17)"/]
v4 --o bind19
v5 --o bind19
v6 --o bind19
v7 --o bind19
v8 --o bind19
v9 --o bind19
v10 --o bind19
v11 --o bind19
v12 --o bind19
v13 --o bind19
v14 --o bind19
v15 --o bind19
v16 --o bind19
v17 --o bind19
v18 --o bind19
v19 --o bind19
v20 --o bind19
bind19 --as--o v21
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v21 -."schema:about".-> v2
v21 --"schema:name"--> v22
v21 --"schema:inLanguage"--> c10
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c12 --"wikibase:language"--> c14
end