2.1 library(pengines): Pengines: Web Logic Programming Made Easy
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • Pengines: Web Logic Programming Made Easy
        • Pengine libraries
          • library(pengines): Pengines: Web Logic Programming Made Easy
            • pengine_create/1
            • pengine_ask/3
            • pengine_next/2
            • pengine_stop/2
            • pengine_abort/1
            • pengine_destroy/1
            • pengine_destroy/2
            • pengine_self/1
            • pengine_application/1
            • current_pengine_application/1
            • pengine_property/2
            • pengine_output/1
            • pengine_debug/2
            • thread_pool:create_pool/1
            • pengine_done/0
            • prepare_module/3
            • prepare_goal/3
            • not_sandboxed/2
            • pengine_pull_response/2
            • pengine_input/2
            • pengine_respond/3
            • pengine_event_loop/2
            • pengine_rpc/2
            • pengine_rpc/3
            • prompt/3
            • output/2
            • portray_blob/2
            • write_result/3
            • add_error_details/3
            • event_to_json/3
            • authentication_hook/3
            • pengine_user/1
Availability::- use_module(library(pengines)).(can be autoloaded)
Source[det]pengine_ask(+NameOrID, @Query, +Options)
Asks pengine NameOrID a query Query.

Options is a list of options:

template(+Template)
Template is a variable (or a term containing variables) shared with the query. By default, the template is identical to the query.
chunk(+Integer)
Retrieve solutions in chunks of Integer rather than one by one. 1 means no chunking (default). Other integers indicate the maximum number of solutions to retrieve in one chunk.
bindings(+Bindings)
Sets the global variable’$variable_names' to a list of Name = Var terms, providing access to the actual variable names.

Any remaining options are passed to pengine_send/3.

Note that the predicate pengine_ask/3 is deterministic, even for queries that have more than one solution. Also, the variables in Query will not be bound. Instead, results will be returned in the form of event terms.

success(ID, Terms, Projection, Time, More)
ID is the id of the pengine that succeeded in solving the query. Terms is a list holding instantiations of Template. Projection is a list of variable names that should be displayed. Time is the CPU time used to produce the results and finally, More is either true or false, indicating whether we can expect the pengine to be able to return more solutions or not, would we call pengine_next/2.
failure(ID)
ID is the id of the pengine that failed for lack of a solutions.
error(ID, Term)
ID is the id of the pengine throwing the exception. Term is the exception's error term.
output(ID, Term)
ID is the id of a pengine running the query that called pengine_output/1. Term is the term that was passed in the first argument of pengine_output/1 when it was called.
prompt(ID, Term)
ID is the id of the pengine that called pengine_input/2 and Term is the prompt.

Defined in terms of pengine_send/3, like so:

pengine_ask(ID, Query, Options) :-
    partition(pengine_ask_option, Options, AskOptions, SendOptions),
    pengine_send(ID, ask(Query, AskOptions), SendOptions).