Re: Understanding some issues on the denotational semantics

Thanks! Let me try to get some bandwidth to go over this asap.

Juan Sequeda
+1-575-SEQ-UEDA
www.juansequeda.com


On Wed, Feb 16, 2011 at 1:53 PM, Alexandre Bertails <bertails@w3.org> wrote:

> On Wed, 2011-02-16 at 14:26 -0500, Alexandre Bertails wrote:
> > Hi Juan,
> >
> > On Wed, 2011-02-16 at 13:15 -0600, Juan Sequeda wrote:
> > > Alex, Eric
> > >
> > >
> > > Can you guys clarify some issues that I'm not understanding correctly.
> >
> > It's funny you ask these things right after I sent [1] :-)
> >
> > I suggest you follow [2] instead of what you found in the current draft.
> > This is an updated version (far simpler and much more complete) and I'll
> > be happy to help you going through it.
>
> Actually, I can go through the example myself!
>
> The first step is to translate (meaning "parse") the SQL concrete
> syntax. You obtain an object living in the RDB ADT:
>
> [[
> db = {addresses, people}
> addresses = ({("ID", Int), ("city", String), ("state", String)},
>             [["ID"]],
>             ∅,
>             adresses_body)
> addresses_body = [[{("ID", 18), ("city", "Cambridge"), ("state", "MA")}]]
> people = ({("ID", Int), ("fname", String), ("addr", Int)},
>          [["ID"]],
>          {(["addr"], addresses, [["ID"]])},
>          people_body)
> people_body = [[{("ID", 7), ("fname", "Bob"), ("addr", 18)},
>                {("ID", 8), ("fname", "Sue"), ("addr", NULL)}]]
> ]]
>
> Then I'll let you focus on the function ⟦ ⟧rowφ. This is where
> everything happens! The specification of the functions are part of the
> RDB abstract model, in my document.
>
> Tell me if you cannot apply it, it's pretty straightforward at that
> point.
>
> Alexandre Bertails.
>
>
> >
> > Alexandre Bertails.
> >
> > [1] http://www.w3.org/mid/1297880900.11894.25.camel@simplet
> > [2] http://www.w3.org/2011/02/16-DM-denotational-rdf-semantics
> >
> > >
> > >
> > > Thanks!
> > >
> > >
> > > I'm going to use this as my
> > > example:
> http://www.w3.org/TR/2010/WD-rdb-direct-mapping-20101118/#lead-ex
> > >
> > >
> > > First, I'm going to define a Database Model, following:
> > > http://www.w3.org/TR/2010/WD-rdb-direct-mapping-20101118/#Rel
> > >
> > >
> > > Database = {"Address -> Table1, "People" -> Table2}
> > >
> > >
> > > Table1 = (Header1, 0, [id], 0, Body1)
> > > Header1 = {id -> int, city -> char, state ->char}
> > > Body1 = [Tuple1, Tuple2]
> > > Tuple1 = {id -> 18, city -> Cambridge, state -> MA}
> > > Tuple2 = {id -> 19, city -> Austin, state -> TX}
> > >
> > >
> > > Table2 = {Header2, 0, [id], FK2, Body2)
> > > Header2 = {id -> int, fname -> char, addr -> int}
> > > FK2 = { [addr] -> (Table1, [id]) }
> > > Body2 = [Tuple3, Tuple4, Tuple5]
> > > Tuple3 = {id -> 7, fname -> Bob, addr -> 18}
> > > Tuple4 = {id -> 8, fname -> Sue, addr -> null}
> > > Tuple5 = {id -> 9, fname -> Joe, addr -> 19}
> > >
> > >
> > > So lets start!
> > > [23]
> > > directDB()
> > > ≝
> > > { directR(R, M) ∣
> > > R ∈ DB }
> > >
> > >
> > > First of all, I do not know what M is. I'm assuming that DB is the
> > > Database, therefore:
> > >
> > >
> > > R = {"Address -> Table1, "People" -> Table2}
> > >
> > >
> > > If I understand the notation correctly, then:
> > >
> > >
> > > directDB() = {directR("Address -> Table1, M), directR("People" ->
> > > Table2, M)}
> > >
> > >
> > > so let's do the first directR
> > >
> > >
> > > 24]
> > > directR(R, M)
> > > ≝
> > > { directT(T, R,
> > > M) ∣ T ∈ R.Body }
> > >
> > > I'm still unclear what is M
> > >
> > >
> > > What is R.Body? I'm assuming you are retrieving Body. Therefore Body
> > > of Table1 is [Tuple1, Tuple2], therefore I assume:
> > >
> > >
> > > T = [Tuple1, Tuple2]
> > >
> > >
> > > now we have:
> > >
> > >
> > > directR("Address -> Table1, M) = { directT([Tuple1, Tuple2], "Address
> > > -> Table1, M) }
> > >
> > >
> > > now let's go to the definition of directT
> > >
> > >
> > > 25]
> > > directT(T, R, M)
> > > ≝
> > > { directS(S, T,
> > > R, M) ∣ S =
> > > subject(T, R,
> > > M) }
> > >
> > >
> > > now we need to know what is S
> > >
> > >
> > > 26]
> > > subject(T, R, M)
> > > ≝
> > > if (pk(R) =
> > > ∅) then new blank
> > > node else rowIRI(R, T[pk(R)]) # references the ultimate referent of
> hierarchical key
> > >
> > >
> > > What is pk(R)?
> > >
> > >
> > > now we have:
> > >
> > >
> > > subject([Tuple1, Tuple2], "Address -> Table1, M) = if (pk("Address ->
> > > Table1) = 0
> > >
> > >          then new blank node
> > >
> > >      else
> > >
> > >          rowIRI("Address -> Table1, T[pk("Address -> Table1)])
> > >
> > >
> > >
> > >
> > > I'm assuming tat pk("Address -> Table1) will return the primary key,
> > > then we have
> > >
> > >
> > > pk("Address -> Table1) = [id]
> > >
> > >
> > > Now we have
> > >
> > >
> > > subject([Tuple1, Tuple2], "Address -> Table1, M) = rowIRI("Address ->
> > > Table1, T[[id]])
> > >
> > >
> > > Now let's go to the definition of rowIRI
> > >
> > >
> > > [31]
> > > rowIRI(R, As)
> > > ≝
> > > IRI(UE(R.name) +
> > > "/" + (join(',',
> > > UE(A.name) + "="
> > > + UE(A.value)) ∣
> > > A ∈ As ) + "#_")
> > >
> > >
> > > What is UE()?
> > >
> > >
> > > What is R.name? Where is it defined?
> > >
> > >
> > > Ok, I'm stopping here.
> > >
> > >
> > > p.s. By the time I finished doing all of this, I saw that Alex sent an
> > > email with a new version of the denotational semantics. I'm guessing I
> > > should re-do what I just did with the new version?
> > >
> > >
> > > Thanks guys for the clarifications!
> > >
> > >
> > > Juan Sequeda
> > > +1-575-SEQ-UEDA
> > > www.juansequeda.com
> > >
> > >
> >
> >
> >
> >
>
>
>
>

Received on Wednesday, 16 February 2011 19:56:47 UTC