prolog function to infer new facts from data

断了今生、忘了曾经 提交于 2020-01-06 02:50:07

问题


I have a dataset containing "facts" recognizable to prolog, i.e.:

'be'('mr jiang', 'representative of china').
'support'('the establishment of the sar', 'mr jiang').
'be more than'('# distinguished guests', 'the principal representatives').
'end with'('the playing of the british national anthem', 'hong kong').
'follow at'('the stroke of midnight', 'this').
'take part in'('the ceremony', 'both countries').
'start at about'('# pm', 'the ceremony').
'end about'('# am', 'the ceremony').

I want the system to recognize that 'mr jiang' is referenced in both of the following "facts":

'be'('mr jiang', 'representative of china').
'support'('the establishment of the sar', 'mr jiang').

Subsequently the system should then infer:

'support'('the establishment of the sar', 'representative of china').

I've spent some time looking at the FOIL algorithm, do you think that would do the trick? But I guess that's overkill.

Would something like this work:

'X'('Y', 'Z') :-
     'A'('Y', 'B') ∧ '0'('B', 'Z');

Is it possible to make such a general "rule" like that? Or does it have to be more specific?

来源:https://stackoverflow.com/questions/28102112/prolog-function-to-infer-new-facts-from-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!