find locomotives of class gwr 4073 class.
Entity Entity
m.04wmk7 m.0b0332
GWR 4073 Class 5051 Earl Bathurst GWR 4073 Class 5043 Earl of Mount Edgcumbe
class entity
rail.locomotive m.01lwgv
rail.locomotive rail.locomotive_class
Locomotive GWR 4073 Class
none none
rail.locomotive.locomotive_class
Locomotive class
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 . 
VALUES ?x1 { :m.01lwgv } 
?x0 :rail.locomotive.locomotive_class ?x1 . 
FILTER ( ?x0 != ?x1  )
}
}
(AND rail.locomotive (JOIN rail.locomotive.locomotive_class m.01lwgv))