selStudents(X) :- advisor(X,Y), teacherOf(Y,Z), takesCourse(X,Z), student(X), faculty(Y), course(Z), not fullprof(Y).

takesCourse(X,Y) :-  &dlR["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#takesCourse"](X,Y).
advisor(X,Y) :- &dlR["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#advisor"](X,Y).
teacherOf(X,Y) :- &dlR["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#teacherOf"](X,Y).
student(X) :- &dlC["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#Student"](X).
faculty(X) :- &dlC["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#Faculty"](X).
course(X) :- &dlC["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#Course"](X).
fullprof(X) :- &dlC["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#Fullprof"](X).
