--
You received this message because you are subscribed to the Google Groups "categoricaldata" group.
To unsubscribe from this group and stop receiving emails from it, send an email to categoricaldata+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
schema S = literal : sql {
entities
a b
foreign_keys
has_a : b -> a
attributes
i : a -> Varchar
j : a -> Varchar
k : b -> Varchar
m : b -> Varchar
}
schema T = literal : sql {
entities
c d
foreign_keys
has_c : d -> c
attributes
i : c -> Varchar
j : d -> Varchar
k : c -> Varchar
m : d -> Varchar
}
schema X = literal : sql {
entities
ac ad bc bd
foreign_keys
attributes
i : ac -> Varchar
j : ad -> Varchar
k : bc -> Varchar
m : bd -> Varchar
}
mapping F = literal : X -> S {
entity ac -> a
attributes i -> i
entity ad -> a
attributes j -> j
entity bc -> b
attributes k -> k
entity bd -> b
attributes m -> m
}
mapping G = literal : X -> T {
entity ac -> c
attributes i -> i
entity ad -> d
attributes j -> j
entity bc -> c
attributes k -> k
entity bd -> d
attributes m -> m
}
instance Js = literal : S {
generators
a1 a2 : a
b1 : b
equations
a1.i = "a1i" a1.j = "a1j"
b1.has_a = a1 b1.k = "b1k" b1.m = "b1m"
a2.i = "a2i" a2.j = "a2j"
}
instance Jx = delta F Js
instance Jt = sigma G Jx
instance Jt_goal = literal : T {
generators
c1 c2 : c
d1 d2 : d
equations
c1.i = "a1i" c1.k = "b1k"
d1.has_c = c1 d1.j = "a1j" d1.m = "d1m"
c2.i = "a2i" c2.k = "null"
d2.has_c = c2 d2.j = "a2j" d2.m = "null"
}
Your X wasn't quite right; you forgot to include the foreign keys, so it generated fresh things you didn't want. Here's the thing that seems at least closer.
Is it what you want?
If it's not what you want, it's probably because you're trying to use a sigma when you should really be using pi. In fact, you really should just be using a query (which is a pi and a delta). Ryan or I can send you the query text if you want.
In fact, you really should just be using a query (which is a pi and a delta). Ryan or I can send you the query text if you want.
schema S = literal : sql {
entities
a b
foreign_keys
has : b -> a
attributes
i : a -> Varchar
j : a -> Varchar
k : b -> Varchar
m : b -> Varchar
}
schema T = literal : sql {
entities
c d
foreign_keys
has_c : d ->
c
has_d : c -> d
attributes
i : c -> Varchar
j : d -> Varchar
k : c -> Varchar
m : d -> Varchar
}
schema X = literal : sql {
entities
n
foreign_keys
attributes
i : n -> Varchar
j : n -> Varchar
k : n -> Varchar
m : n -> Varchar
}
mapping F = literal : S -> X {
entity a -> n
attributes
i -> i
j -> j
entity b -> n
foreign_keys has -> n
attributes
k -> k
m -> m
}
mapping G = literal : T -> X {
entity c -> n
foreign_keys has_d -> n
attributes
i -> i
k -> k
entity d -> n
foreign_keys has_c -> n
attributes
j -> j
m -> m
}
instance Js = literal : S {
generators
a1 a2 a3 a4 : a
b1 b2 : b
equations
a1.i = "a1i" a1.j = "a1j"
b1.has = a1 b1.k = "b1k" b1.m = "b1m"
a2.i = "a2i" a2.j = "a2j"
a3.i = "a3i" a3.j = "a3j"
b2.has = a3 b2.k = "b2k" b2.m = "b2m"
a4.i = "a4i" a4.j = "a4j"
}
instance JxPi = eval (toCoQuery F) Js
instance JxSigma = sigma F Js
instance Jt = delta G JxSigma
query Q = literal : S -> T {
entity c -> {
from ca:a cb:b
attributes
i -> i(ca)
k -> k(cb)
foreign_keys
has_d -> {db -> db}}
entity d -> {
from da:a db:b
attributes
j -> j(da)
m -> m(db)
foreign_keys
has_c -> {cb -> da}
}
}
On Jan 19, 2018, at 6:48 PM, Ryan Wisnesky <wisn...@gmail.com> wrote:
I fixed the query one way - not sure if that’s the intended semantics or not.
<fred.aql><Screen Shot 2018-01-19 at 6.47.36 PM.png>
--
You received this message because you are subscribed to the Google Groups "categoricaldata" group.
To unsubscribe from this group and stop receiving emails from it, send an email to categoricalda...@googlegroups.com.
Enter code here...
schema S = literal : sql {
entities
a b
foreign_keys
has : b -> a
attributes
i : a -> Varchar
j : a -> Varchar
k : b -> Varchar
m : b -> Varchar
}
schema T = literal : sql {
entities
c d
foreign_keys
has_c : d -> c
has_d : c -> d
attributes
i : c -> Varchar
j : d -> Varchar
k : c -> Varchar
m : d -> Varchar
}
instance Js = literal : S {
generators
a1 a2 a3 a4 : a
b1 b2 : b
equations
a1.i = "a1i" a1.j = "a1j"
b1.has = a1 b1.k = "b1k" b1.m = "b1m"
a2.i = "a2i" a2.j = "a2j"
a3.i = "a3i" a3.j = "a3j"
b2.has = a3 b2.k = "b2k" b2.m = "b2m"
a4.i = "a4i" a4.j = "a4j"
}
instance JxPi = pi F Js
instance JtCospan = delta G JxPi
query QSTComputed = [ toCoQuery F ; toQuery G ]
query QST = literal : S -> T {
entity c -> {
from B1: b
attributes
i -> B1.has.i
k -> B1.k
foreign_keys
has_d -> {
B2 -> B1
}
}
entity d -> {
from
B2 : b
attributes
j -> B2.has.j
m -> B2.m
foreign_keys
has_c -> {
B1 -> B2
}
}
}
instance JtQuery = eval QST Js
instance JxSigma = sigma F Js
--
You received this message because you are subscribed to the Google Groups "categoricaldata" group.
To unsubscribe from this group and stop receiving emails from it, send an email to categoricaldata+unsubscribe@googlegroups.com.
Hi Fred,Can you say which output instance you would like to get?
instance JtGoal = literal : T {
generators
c1 c2 c3 c4 : c
d1 d2 d3 d4 : d
equations
c1.i = "a1i" c1.k = "b1k" c1.has_d = d1
c2.i = "a2i" c2.has_d = d2
c3.i = "a3i" c3.k = "b2k" c3.has_d = d3
c4.i = "a4i" c4.has_d = d4
d1.j = "a1j" d1.m = "b1m" d1.has_c = c1
d2.j = "a2j" d2.has_c = c2
d3.j = "a3j" d3.m = "b2m" d3.has_c = c3
d4.j = "a4j" d4.has_c = c4
}
instance JtSigma = delta G sigma F Js