我有事实:
studies(it, da). // IT branch studies the module DA studies(it, pm). studies(ie, pm). studies(it, plc). studies(it, se). studies(cs, plc). studies(cs, da). studies(cs, se).
我需要编写查询:
学生学习了多少科目?
哪个分支研究受试者pm和plc?
aggregate_all(count, studies(cs, X), Count). (见Prolog count the number of times a predicate is true)
aggregate_all(count, studies(cs, X), Count).
studies(X, pm), studies(X, plc).
1 回答
aggregate_all(count, studies(cs, X), Count).
(见Prolog count the number of times a predicate is true)studies(X, pm), studies(X, plc).