[mercury-users] Assert/Retract
Daniel Elenius
elenius at csl.sri.com
Fri Jan 27 15:19:02 AEDT 2006
Ralph Becket wrote:
> 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
>
>
No, because *new* policies can be loaded at runtime. New code has to be
loaded into the mercury or prolog engine, and I don't want to have to
reload all the policies whenever a new one comes in.
> 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
> --------------------------------------------------------------------------
>
--------------------------------------------------------------------------
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