greenwich is the terminus of what railway?
Entity
m.03bx642
London and Greenwich Railway
class entity
rail.railway m.0nqv1
rail.railway rail.railway_terminus
Railway Greenwich
none none
rail.railway.terminuses
Terminuses
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX : <http://rdf.freebase.com/ns/> 
SELECT (?x0 AS ?value) WHERE {
SELECT DISTINCT ?x0  WHERE { 
?x0 :type.object.type :rail.railway . 
VALUES ?x1 { :m.0nqv1 } 
?x0 :rail.railway.terminuses ?x1 . 
FILTER ( ?x0 != ?x1  )
}
}
(AND rail.railway (JOIN rail.railway.terminuses m.0nqv1))