[m-dev.] for review: Aditi update doc extract

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Jul 3 18:18:44 AEST 1999


On 02-Jul-1999, Simon Taylor <stayl at cs.mu.OZ.AU> wrote:
> Aditi update notes
> ..................
> 
>    There must be a `:- pragma base_relation' declaration for any
> relation to be updated.
> 
>    It is currently up to the application to ensure that any
> modifications do not change the determinism of a base relation.  Updates
> of relations with unique B-tree indexes are checked to ensure that a
> key is not given multiple values. The transaction will abort if this
> occurs.

Hmm.  This is a little bit ambiguous.  If I have a `nondet' base
relation with two clauses

	foo(1).
	foo(2).

and I then delete the second clause, does this change the determinism
of the base relation?

Perhaps you should say "do not violate the declared determinism of the
base relation" rather than "do not change the determinism ...".

If I have a `det' base relation, does it make any sense to do insertions
or deletions on it?  Modifications make sense, but I think any insertions
(except perhaps inserting tuples that are already present) or deletions
will always violate the declared determinism, won't they?

> Insertion
> .........
> 
>      aditi_insert(PREDNAME(VAR1, VAR2, ...), DB0, DB).
>      
>      aditi_insert(FUNCNAME(VAR1, VAR2, ...) = RETVAR, DB0, DB).
> 
>    Insert the specified tuple into a relation. The tuple to be inserted
> must have the same type signature as the relation. All the arguments of
> the tuple have mode `in', except the `aditi__state' argument which has
> mode `unused'.

You should state here what `PREDNAME', `FUNCNAME', `VAR1', `VAR2', ...,
`RETVAR', `DB0', and `DB' are.

Presumably `PREDNAME' is a predicate name, `FUNCNAME' is a function name,
and `VAR1', `VAR2', ..., and `RETVAR' are variables, but in those cases
you should be explicit, and in addition it's not clear what `DB0' and `DB'
are supposed to be.

...
>    Examples:
>      insert_example_1(DB0, DB) :-
>              aditi_insert(p(_, 1, 2), DB0, DB).
>      
>      insert_example_2(DB0, DB) :-
>              aditi_insert(f(_, 1) = 2, DB0, DB).

The examples are inconsistent with the documentation, which implies that
the arguments here must be variables.

The same comments apply to the syntax for the other Aditi update primitives.

> Modification
> ............
> 
>      aditi_modify(
>              (PREDNAME(VAR1, VAR2, ...) ==> PREDNAME(VAR3, VAR4, ...) :-
>                      GOAL
>              ),
>              DB0, DB).
>      
>      aditi_modify(
>              ((FUNCNAME(VAR1, VAR2, ...) = RETVAR0) ==>
>              (PREDNAME(VAR3, VAR4, ...) = RETVAR) :-
>                      GOAL
>              ),

Shouldn't `PREDNAME' here be `FUNCNAME'?

Also, I suggest using the names
	OLDVAR1, OLDVAR2, ..., OLDRETVAR, NEWVAR1, NEWVAR2, ..., NEWRETVAR.
or 
	OLDARG1, OLDARG2, ..., OLDRETVAL, NEWARG1, NEWARG2, ..., NEWRETVAL.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list