I’m using SWI-Prolog v 9.3.29
Why am I receiving success events with two different structures from the same Pengine ?
After starting my local Pengines server,
If I use this code:
% Test client for the pengines server
test_local_pengine :-
% Create a pengine connected to local server
pengine_create([
server('http://localhost:3030'),
application(genealogist),
ask(ancestor_descendant(mike, _X))
]),
pengine_event_loop(handle_result, []).
handle_result(success(ID, Bindings, More)) :-
...
I get success events that look like this: success(ID, Bindings, More)
On the other hand, if I use this code:
% Test specific queries
test_genealogist_queries :-
pengine_create([
server('http://localhost:3030'), % not required if on the same host
application(genealogist),
id(ID),
destroy(false) % keep pengine alive for multiple queries
]),
% Test multiple queries
test_query(ID, q1, 'Find all ancestors of sally', ancestor_descendant(X, sally)),
pengine_destroy(ID),
writeln('<--- Destroy pengine after all queries').
test_query(ID, QueryName, Description, Query) :-
format('~n--- ~w: ~w ---~n', [QueryName, Description]),
pengine_ask(ID, Query, []),
format('<--- Ask: ~w: ~w~n', [QueryName, Query]),
collect_all_solutions(ID, QueryName).
% in seconds
timeout(0.1).
collect_all_solutions(ID, QueryName) :-
timeout(Timeout),
pengine_event(Event, [listen(ID), timeout(Timeout)]),
...
I get events with this structure: `success(_, Bindings, _Projection, _Time, More)
`
Thanks.