Oleg, maybe it is obvious to others but I am not able to understand
what you want to state here.
Would it be right to restate this as :
-------------------------------------------------------------------------------------------
One can think of relational algebra as applicable to the fundamental
constructs of J language if one makes the following conceptual
associations -
Relational-Table <-> J Locale
Relational-Table-Attributes <-> J Locale-Names
{Since I have not followed much after that I assume you are proving
the above statements using an example}
So, by defining the operators of relational algebra, one can work
across J Locales.
-------------------------------------------------------------------------------------------
Would this mean that a 'natural' mapping between Relational Constructs
and J Constructs are as above?
How will this mapping help?
Or is it more an observation that brings together the fundamental
concepts of Relational Algebra and J Constructs together?
A little more on this would help. Thanks!
On 10/24/06, Oleg Kobchenko <[EMAIL PROTECTED]> wrote:
J has relational namespace layout:
locales as tables and names as attributes.
NB. =========================================================
require 'strings'
cocurrent 'T1'
B=: s: ','cut'one,two,three,four,five,six,seven,eight'
C=: 100+(#B)[EMAIL PROTECTED] 5
E=: 'ab'{~(#B) [EMAIL PROTECTED] 2
cocurrent 'T2'
D=: s: ','cut'uno,dos,tres,cuatro,cinco,seis,siete,ocho'
C=: 100+(#D)[EMAIL PROTECTED] 5
E=: 'ab'{~($D) [EMAIL PROTECTED] 2
cocurrent 'base'
jndx=: (0 , [EMAIL PROTECTED]) #: [: I.@, =/
sel=: ,.@:{
0 : 0
B_T1_ (,[EMAIL PROTECTED];]) C_T1_ ;&,. E_T1_
C_T2_ (,[EMAIL PROTECTED];]) D_T2_ ;&,. E_T2_
]'j1 j2'=. |:C_T1_ jndx C_T2_
(j1 sel B_T1_);(j1 sel C_T1_);(j2 sel D_T2_)
]'j1 j2'=. |:(C_T1_ jndx C_T2_) (e.#[) E_T1_ jndx E_T2_
(j1 sel B_T1_);(j1 sel C_T1_);(j1 sel E_T1_);(j2 sel D_T2_)
)
NB. =========================================================
B_T1_ (,[EMAIL PROTECTED];]) C_T1_ ;&,. E_T1_
+------+---+-+
|`one |101|a|
|`two |100|b|
|`three|104|b|
|`four |102|a|
|`five |104|a|
|`six |104|b|
|`seven|100|a|
|`eight|102|b|
+------+---+-+
C_T2_ (,[EMAIL PROTECTED];]) D_T2_ ;&,. E_T2_
+---+-------+-+
|101|`uno |a|
|100|`dos |b|
|104|`tres |b|
|102|`cuatro|a|
|104|`cinco |a|
|104|`seis |b|
|100|`siete |a|
|102|`ocho |b|
+---+-------+-+
]'j1 j2'=. |:C_T1_ jndx C_T2_
0 1 1 2 2 2 3 3 4 4 4 5 5 5 6 6 7 7
0 1 6 2 4 5 3 7 2 4 5 2 4 5 1 6 3 7
(j1 sel B_T1_);(j1 sel C_T1_);(j2 sel D_T2_)
+------+---+-------+
|`one |101|`uno |
|`two |100|`dos |
|`two |100|`siete |
|`three|104|`tres |
|`three|104|`cinco |
|`three|104|`seis |
|`four |102|`cuatro|
|`four |102|`ocho |
|`five |104|`tres |
|`five |104|`cinco |
|`five |104|`seis |
|`six |104|`tres |
|`six |104|`cinco |
|`six |104|`seis |
|`seven|100|`dos |
|`seven|100|`siete |
|`eight|102|`cuatro|
|`eight|102|`ocho |
+------+---+-------+
]'j1 j2'=. |:(C_T1_ jndx C_T2_) (e.#[) E_T1_ jndx E_T2_
0 1 2 2 3 4 5 5 6 7
0 1 2 5 3 4 2 5 6 7
(j1 sel B_T1_);(j1 sel C_T1_);(j1 sel E_T1_);(j2 sel D_T2_)
+------+---+-+-------+
|`one |101|a|`uno |
|`two |100|b|`dos |
|`three|104|b|`tres |
|`three|104|b|`seis |
|`four |102|a|`cuatro|
|`five |104|a|`cinco |
|`six |104|b|`tres |
|`six |104|b|`seis |
|`seven|100|a|`siete |
|`eight|102|b|`ocho |
+------+---+-+-------+
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm