The Prolog interface is based on the idea of a Prolog server that
provides its service by answering queries from external applications
(typically Java applications). The Prolog interface in PrologBeans
is defined in
library(prologbeans), which implements the
Prolog server and exports the following predicates:
starts the Prolog server using the options specified. Options should be a list of zero or more of:
is a variable then some unused port will be selected by the OS, the actual port number can be obtained with
get_server_property/1, typically from a
:- start([port(7500), accepted_hosts(['127.0.0.1','188.8.131.52'])]).
shuts down the server and closes the sockets and the streams after processing all available input. There are three modes:
registers a query and the corresponding predicate. Before the registration
any previously registered query matching
Query will be removed (as if
unregister_query(Query) was called). The predicate,
PredicateToCall will be called, as if by
once(PredicateToCall), when a query matching
Query is received. Before calling the query, the variable
SessionVar, if given, is bound to the id of the current
session. Session ids are typically generated in web applications that
track users and mark all consecutive web-accesses with the same
returns the value of a given parameter in a given session. If no value exists, it will return the default value. Arguments:
stores the value of the given parameter. Please note: any pre-existing
value for this parameter will be overwritten. Note that
session_put/3 will not be undone when backtracking (the current
implementation is based on
to be called (as if by
)) when the event matching
(event matching is on principal functor only). If the goal fails or
raises an exception a warning is written to
user_error but the failure
or exception is otherwise ignored. Arguments:
unregister_event_listener/1to remove this event listener.
The predefined events are as follows:
Attempt to register an event listener for other events than the predefined events will throw an exception.
More than one listeners can be defined for the same event. They will be
called in some unspecified order when the event occurs.
Unregister a previously registered event listener. The Id is the
value returned by the corresponding call to
register_event_listener/3. It is an error to attempt to
unregister an event listener more than once.