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

graduateStudent(X) :- &dlQS["queries/lubm_query1.rq"](X).
memberOf(X,Y) :- &dlQS["queries/lubm_query9.rq"](Y,X).
ugDegreeFrom(X,Y) :- &dlQS["queries/lubm_query10.rq"](Y,X).
univ(X) :- &dlQS["queries/lubm_query11.rq"](X).
dept(X) :- &dlQS["queries/lubm_query12.rq"](X).

baseOrg(X,Y) :- &dlQS["queries/lubm_query13.rq"](X,Y).
updateSubOrg(X,Y) :- baseOrg(X,Y).
updateSubOrg(X,Z) :- updateSubOrg(X,Y), updateSubOrg(Y,Z).

subOrgOf(X,Y) :- &dlQU["data/lubm_query14.rq",+,,+,updateRole,+,](Y,X).

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