[mercury-users] Assert/Retract

Ralph Becket rafe at cs.mu.OZ.AU
Fri Jan 27 15:06:32 AEDT 2006


Daniel Elenius, Thursday, 26 January 2006:
> We are developing a "policy reasoner". Policies would be Mercury modules 
> (currently they are Prolog modules), and can be loaded on/unloaded from 
> the reasoner at runtime. Hence the (perceived) need for assert/retract.
> 
> Requests are sent to the reasoner in the form of lists of facts 
> (currently Prolog lists of Prolog atoms). The reasoner does 
> goal-directed search (normal Prolog query) over the loaded policies, 
> with the list of atoms as a parameter, and answers yes or no to the 
> requests.

Hmm.  Can't you implement each policy as a separate Mercury predicate
and then just check for each query that at least one policy accepts it?
Which policies are currently in effect is handled by only calling those
policy predicates.  That is, have something like

check_some_policy(Policies, Query) :-
	member(N, Policies),
	check_policy(Policies, N, Query).

check_policy(Policies, 1, Query) := check_policy_1(Policies, Query).
check_policy(Policies, 2, Query) := check_policy_2(Policies, Query).
...
check_policy(Policies, N, Query) := check_policy_N(Policies, Query).

where check_policy_i/2 implements the corresponding policy checks.

-- Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list