who built the locomotive for the new south wales d50 class locomotive?
Entity Entity Entity Entity
m.02ykn2 m.04qp9t m.0532kq m.0cbjr5
Dübs and Company North British Locomotive Company Beyer, Peacock and Company Neilson and Company
class entity
rail.locomotive_builder m.04mz5qr
rail.locomotive_builder rail.locomotive_class
Locomotive builder New South Wales D50 class locomotive
none none
rail.locomotive_builder.locomotive_classes_built
Locomotive classes built
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.locomotive_builder . 
VALUES ?x1 { :m.04mz5qr } 
?x0 :rail.locomotive_builder.locomotive_classes_built ?x1 . 
FILTER ( ?x0 != ?x1  )
}
}
(AND rail.locomotive_builder (JOIN rail.locomotive_builder.locomotive_classes_built m.04mz5qr))