query-e7fe5cf79bfd2cc61a3541ce3e56ae64
Stations along the Tōkaidō, the road from Tokyo) to Kyoto, with images of the print series
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
PREFIX bd: <http://www.bigdata.com/rdf#>
# Stations along the Tōkaidō, the road from Tokyo to Kyoto, with images of the print series
#defaultView:Map
SELECT ?ord ?dist_km ?item ?itemLabel ?itemDescription ?today ?todayLabel ?todayimage ?coor ?hascoord ?print ?printimg
{
?item wdt:P31 wd:Q75093704 .
OPTIONAL { ?item p:P31 [ ps:P31 wd:Q75093704 ; pq:P1545 ?ord ] }.
OPTIONAL { ?item wdt:P625 ?coor0 . BIND("y" as ?hascoord) }
OPTIONAL { ?item wdt:P131 ?today .
OPTIONAL { ?today wdt:P625 ?coor1 }
OPTIONAL { ?today wdt:P18 ?todayimage }
}
BIND( COALESCE ( ?coor0, ?coor1 ) as ?coor )
OPTIONAL { ?print wdt:P179 wd:Q19258119 ; wdt:P180 ?item . OPTIONAL { ?print wdt:P18 ?printimg } }
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
wd:Q1490 wdt:P625 ?c0 . BIND( round(geof:distance(?c0, ?coor)) as ?dist_km)
}
ORDER BY ?dist_km ?ord
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v12("?c0")
v9("?coor"):::projected
v4("?coor0")
v7("?coor1")
v13("?dist_km"):::projected
v5("?hascoord"):::projected
v3("?item"):::projected
v2("?ord"):::projected
v10("?print"):::projected
v11("?printimg"):::projected
v6("?today"):::projected
v8("?todayimage"):::projected
a1((" "))
c10(["wd:Q19258119"]):::iri
c15(["en"]):::literal
c13(["bd:serviceParam"]):::iri
c16(["wd:Q1490"]):::iri
c2(["wd:Q75093704"]):::iri
v3 --"p:direct/P31"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
a1 -."p:statement/P31".-> c2
a1 --"p:qualifier/P1545"--> v2
v3 --"p:P31"--> a1
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P625".-> v4
bind0[/"'y'"/]
bind0 --as--o v5
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P131".-> v6
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:direct/P625".-> v7
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:direct/P18".-> v8
end
end
bind1[/"?coor0?coor1"/]
v4 --o bind1
v7 --o bind1
bind1 --as--o v9
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v10 -."p:direct/P179".-> c10
v10 --"p:direct/P180"--> v3
subgraph optional6["(optional)"]
style optional6 fill:#bbf,stroke-dasharray: 5 5;
v10 -."p:direct/P18".-> v11
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c13 --"wikibase:language"--> c15
end
c16 --"p:direct/P625"--> v12
bind2[/"numeric-round(http://www.opengis.net/def/function/geosparql/distance(?c0,?coor))"/]
v12 --o bind2
v9 --o bind2
bind2 --as--o v13