我有一个规则,我必须检查一个部门工作的人是否也为其大学和大学工作 . 示例知识库如下:

university(xxx). /*the university*/
col(scienceAndMath,xxx). /*the college of the university*/
dept_col(biology,scienceAndMath). /*the department of the college*/
dept_faculty(michael,biology). /*the faculty member of the department*/

我必须制定一个规则,即 works_for(X,Y) 来检查为一个部门工作的人,也为其大学和大学工作 . 我试图以下面的方式做到这一点,但无济于事 .

works_for(X,Y):-dept_faculty(X,Y).  
works_for(X,Y):-dept_col(works_for(X,Y),Y).
/*also tried works_for(X,Y):-dept_col(dept_faculty(X,Y),Y)./*

例如,对于查询 works_for(michael,X). ,结果应如下:

X = biology
X = scienceAndMath

我如何将事实作为论点传递给另一个事实?目前,查询的答案如下:

X = biology
false.