# Pengines success event produced with two different term structures

**URL:** <https://swi-prolog.discourse.group/t/pengines-success-event-produced-with-two-different-term-structures/9270>\
**Category:** General\
**Tags:** discussion\
**Created:** [September 12, 2025, 8:22pm UTC](https://swi-prolog.discourse.group/t/pengines-success-event-produced-with-two-different-term-structures/9270 "2025-09-12T20:22:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CarlosLang](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/carloslang/32/7484_2.png) [@CarlosLang](https://swi-prolog.discourse.group/u/CarlosLang)\
**Post date:** [September 12, 2025, 8:22pm UTC](https://swi-prolog.discourse.group/t/pengines-success-event-produced-with-two-different-term-structures/9270/1 "2025-09-12T20:22:41Z")

</div>

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:

```prolog
% 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:

```prolog
% 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.
