In TurboPrologwe can use next construction:
goal:
father('Tom', X).
How use same in SWI-Prolog?
If I recall what goal does, I suggest to use the ISO-Prolog built-in initialization/1:
Call Goal after loading the source file in which this directive appears has been completed.
:- initialization((father('Tom', X), writeln(X))).
I've added a visualization of the value obtained - if any. Also some error handling should be added...
initialization/1as directive. - false