PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ub: <http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#>
SELECT ?X ?Y
WHERE {
 <http://www.Department0.University0.edu/AssociateProfessor0> ub:teacherOf ?Y .
 ?Y rdf:type ub:Course .
 ?X ub:takesCourse ?Y .
 ?X rdf:type ub:Student
}