selStudents(X,Y,Z) :- graduateStudent(X), memberOf(X,Z), ugDegreeFrom(X,Y), univ(Y), dept(Z), subOrgOf(Y,Z).

graduateStudent(X) :- &dlC["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#GraduateStudent"](X).
memberOf(X,Y) :- &dlR["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#memberOf"](X,Y).
ugDegreeFrom(X,Y) :- &dlR["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#undergraduateDegreeFrom"](X,Y).
univ(X) :- &dlC["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#University"](X).
dept(X) :- &dlC["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#Department"](X).

baseOrg(X,Y) :- &dlR["lubm_lite_kb_10k.owl",a,b,c,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#subOrganizationOf"](X,Y).
updateSubOrg(X,Y) :- baseOrg(X,Y).
updateSubOrg(X,Z) :- updateSubOrg(X,Y), updateSubOrg(Y,Z).

subOrgOf(X,Y) :- &dlR["lubm_lite_kb_10k.owl",a,b,updateRole,d,"http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#subOrganizationOfTC"](X,Y).

updateRole(X,Y,Z) :- u_roletc(Y), updateSubOrg(X,Z).
u_roletc("http://www.lehigh.edu/~zhp2/2004/0401/univ-bench.owl#subOrganizationOfTC").
