Re: A simple notation, again
From: Lennart <erik.lennart.jonsson_at_gmail.com>
Date: Wed, 18 Jul 2007 21:52:32 +0200
Message-ID: <f7lr20$t4v$1_at_registered.motzarella.org>
> True, but order is imposed here simply to associate each element of each
> tuple with its designation. It is used only as a shorthand.
>
Date: Wed, 18 Jul 2007 21:52:32 +0200
Message-ID: <f7lr20$t4v$1_at_registered.motzarella.org>
Brian Selzer wrote:
[...]
>> You imply order (adjacency) when relation attributes should not be >> subjected to any.... >> >>
> True, but order is imposed here simply to associate each element of each
> tuple with its designation. It is used only as a shorthand.
>
I've been playing with Dee (http://www.quicksort.co.uk/) on and off for a while and there it is possible to do it /both/ ways:
http://www.quicksort.co.uk/DeeDoc.html#relations
To assign a relation value to a relation variable, use the standard Python syntax, e.g.
>>> IS_CALLED = Relation(["StudentId", "Name"],
... [{"StudentId":'S1', "Name":'Anne'}, ... {"StudentId":'S2', "Name":'Boris'}, ... {"StudentId":'S3', "Name":'Cindy'}, ... {"StudentId":'S4', "Name":'Devinder'}, ... {"StudentId":'S5', "Name":'Boris'}, ... ])
[...]
or alteratively, a more concise option is available which relies on the order of the body attributes matching the order of the heading:
>>> IS_CALLED = Relation(["StudentId", "Name"], ... [('S1', 'Anne'), ... ('S2', 'Boris'), ... ('S3', 'Cindy'), ... ('S4', 'Devinder'), ... ('S5', 'Boris'), ... ])
Since I'm a lousy typist I tend to use the latter ;-)
/Lennart Received on Wed Jul 18 2007 - 21:52:32 CEST