query-10a9f24738c11bf6bbd77cf6277d775e
Propertiesmaintained by WikiProject (P6104)number of pages (P1104)page(s) (P304)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT
?qs
# ?paper ?pages ?start_page ?end_page ?number_of_pages
WHERE {
{ BIND("qid,P1104,S887" AS ?qs) }
UNION
{
SERVICE bd:sample { ?paper wdt:P6104 wd:Q56241615 .bd:serviceParam bd:sample.limit 10000 }
MINUS { ?paper wdt:P1104 [] }
?paper wdt:P304 ?pages .
FILTER REGEX(?pages, "^[1-9][0-9]*-[1-9][0-9]*$")
BIND(xsd:integer(STRBEFORE(?pages, "-")) AS ?start_page)
BIND(xsd:integer(STRAFTER(?pages, "-")) AS ?end_page)
FILTER (STRLEN(?end_page) < STRLEN(?start_page))
BIND(?end_page - ?start_page + 1 AS ?number_of_pages)
FILTER (?number_of_pages > 0)
BIND(CONCAT(SUBSTR(STR(?paper), 32), ",", STR(?number_of_pages), ",Q110768064") AS ?qs)
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v7("?end_page")
v7("?number_of_pages")
v5("?pages")
v6("?paper")
v7("?qs"):::projected
v7("?start_page")
a1((" "))
c6(["bd:serviceParam"]):::iri
c5(["wd:Q56241615"]):::iri
c8(["10000^^xsd:integer"]):::literal
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
f0[["?number_of_pages > '0^^xsd:integer'"]]
f0 --> v7
f1[["string-length(?end_page) < string-length(?start_page)"]]
f1 --> v7
f1 --> v7
f2[["regex(?pages,'^#91;1-9#93;#91;0-9#93;*-#91;1-9#93;#91;0-9#93;*$')"]]
f2 --> v5
subgraph s1["http://www.bigdata.com/rdf#sample"]
style s1 stroke-width:4px;
v6 --"wdt:P6104"--> c5
c6 --"bd:sample.limit"--> c8
end
subgraph minus3["MINUS"]
style minus3 stroke-width:6px,fill:pink,stroke:red;
v6 --"wdt:P1104"--> a1
end
v6 --"wdt:P304"--> v5
bind4[/"http://www.w3.org/2001/XMLSchema#integer(substring-before(?pages,'-'))"/]
v5 --o bind4
bind4 --as--o v7
bind5[/"http://www.w3.org/2001/XMLSchema#integer(substring-after(?pages,'-'))"/]
v5 --o bind5
bind5 --as--o v7
bind6[/"?end_page - ?start_page + '1^^xsd:integer'"/]
v7 --o bind6
v7 --o bind6
bind6 --as--o v7
bind7[/"concat(substring(str(?paper),'32^^xsd:integer'),',',str(?number_of_pages),',Q110768064')"/]
v6 --o bind7
v7 --o bind7
bind7 --as--o v7
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
bind8[/"'qid,P1104,S887'"/]
bind8 --as--o v7
end
union0r <== or ==> union0l
end