http://epi-training.epimorphics.net/qlassroom
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
prefix lu-c: <http://training.epimorphics.com/transport/london-underground/connection/>
prefix lu-l: <http://training.epimorphics.com/transport/london-underground/line/>
prefix lu-s: <http://training.epimorphics.com/transport/london-underground/station/>
prefix metro: <http://training.epimorphics.com/transport/def/metro/>
prefix qb: <http://purl.org/linked-data/cube#>
prefix passengers: <http://training.epimorphics.com/transport/def/passenger-count/>
prefix museum: <http://training.epimorphics.com/culture/london/museum/>
prefix dbpedia: <http://dbpedia.org/ontology/>
prefix transport: <http://training.epimorphics.com/transport/def/metro/>
http://training.epimorphics.com/course-materials/1-5-QueryingLinkedData.pdf
ASK {
lu-s:paddington a transport:UndergroundStation
}
DESCRIBE lu-s:paddington
SELECT ?line WHERE {
?line rdf:type transport:UndergroundLine .
}
SELECT ?station WHERE {
?station rdf:type transport:UndergroundStation .
}
SELECT ?station ?stationName WHERE {
?station rdf:type transport:UndergroundStation ;
rdfs:label ?stationName .
}
SELECT ?stationName ?lineName WHERE {
?station rdf:type transport:UndergroundStation ;
rdfs:label ?stationName ;
transport:incomingConnection/transport:onLine ?line .
?line rdfs:label ?lineName .
}
SELECT DISTINCT ?stationName ?lineName WHERE {
?station rdf:type transport:UndergroundStation ;
rdfs:label ?stationName ;
transport:incomingConnection/transport:onLine ?line .
?line rdfs:label ?lineName .
}
SELECT DISTINCT ?stationName WHERE {
?station rdf:type transport:UndergroundStation ;
rdfs:label ?stationName ;
transport:incomingConnection/transport:onLine lu-l:bakerloo_line .
}
SELECT DISTINCT ?stationName WHERE {
?station rdf:type transport:UndergroundStation ;
rdfs:label ?stationName ;
transport:incomingConnection/transport:onLine lu-l:bakerloo_line ;
geo:lat ?lat .
}
ORDER BY ASC(?stationName)
SELECT DISTINCT ?stationName WHERE {
?station rdf:type transport:UndergroundStation ;
rdfs:label ?stationName ;
transport:incomingConnection/transport:onLine lu-l:bakerloo_line ;
geo:lat ?lat .
}
ORDER BY DESC(?lat)
SELECT (COUNT( ?station) AS ?count) WHERE {
?station rdf:type transport:UndergroundStation
}
SELECT ?lineName (COUNT(DISTINCT ?station) AS ?numStations) WHERE {
?station rdf:type transport:UndergroundStation ;
rdfs:label ?stationName ;
transport:incomingConnection/transport:onLine ?line .
?line rdfs:label ?lineName .
}
GROUP BY ?lineName order by ?numStations
SELECT (COUNT(DISTINCT ?station) AS ?numStations) WHERE {
?station rdf:type transport:UndergroundStation ;
rdfs:label ?stationName ;
transport:incomingConnection/transport:onLine lu-l:bakerloo_line ;
geo:lat ?lat .
lu-s:oxford_circus geo:lat ?oc_lat .
FILTER ( ?lat < ?oc_lat)
}