query-2953cf0bf3bace439a0e0501ff6661ee
Get all entries from the star trek encyclopedia
SELECT ?statement ?entry ?page WHERE { VALUES (?publication) {(wd:Q63217791)} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?statement ps:P1343 ?publication. OPTIONAL { ?statement pq:P1810 ?entry. } OPTIONAL { ?statement pq:P304 ?pagesString. BIND(xsd:integer(IF(CONTAINS(?pagesString,'-'), STRBEFORE(?pagesString, '-'), ?pagesString)) as ?page) } } ORDER BY ASC(?page)
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Get all entries from the star trek encyclopedia
SELECT ?statement ?entry ?page WHERE {
VALUES (?publication) {(wd:Q63217791)}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?statement ps:P1343 ?publication.
OPTIONAL { ?statement pq:P1810 ?entry. }
OPTIONAL {
?statement pq:P304 ?pagesString.
BIND(xsd:integer(IF(CONTAINS(?pagesString,'-'), STRBEFORE(?pagesString, '-'), ?pagesString)) as ?page)
}
}
ORDER BY ASC(?page)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?entry"):::projected
v6("?page"):::projected
v5("?pagesString")
v2("?publication")
v3("?statement"):::projected
c2(["bd:serviceParam"]):::iri
c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?publication/]
bind0-->v2
bind00(["wd:Q63217791"])
bind00 --> bind0
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c2 --"wikibase:language"--> c4
end
v3 --"ps:P1343"--> v2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."pq:P1810".-> v4
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."pq:P304".-> v5
bind1[/"http://www.w3.org/2001/XMLSchema#integer(if(contains(?pagesString,'-'),substring-before(?pagesString,'-'),?pagesString))"/]
v5 --o bind1
bind1 --as--o v6
end