问题
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