- From: Juan Sequeda <juanfederico@gmail.com>
- Date: Wed, 19 Jan 2011 09:18:27 -0600
- To: Alexandre Bertails <bertails@w3.org>
- Cc: RDB2RDF WG <public-rdb2rdf-wg@w3.org>
- Message-ID: <AANLkTimWtBo8A1wpqgKUm1TZ4mhCqPOtRGj6cOGawaW5@mail.gmail.com>
Alex and all I see your point. And actually I found a bug, when it comes to generate a blank node. For this example, this falls into the section 4.2.3 Table does not have a primary key. The rule is Triple(s, p, yj) ← r(y1, ..., yn), generateRowBlankNode("r", [y1, ..., yn], s), generateColumnIRI("r", ["bj"], p) So the instances are: debt(Juan, 50) debt(Juan, 50) The bug I see is the way generateRowBlankNode works. In this case, it takes as input all the values in the row. In this case, different rows have the same value, therefore the same blank node would be generated for different rows... which is wrong. We have not defined the way to automatically generate a Blank Node. What we have here was our proposal... which is wrong so thanks for helping us find it. So lets assume the input to generateBlankNode is going to be the row id (assuming that each row id is unique regardless if all the values are the same in different rows). Having that said then.... the applied rule would be Triple(s, p, name) <-- debt(name,_), generateBlankNode(debt, rowid, s), generateColumIRI(debt, name, p) Triple(s, p, amount) <-- debt(_,amount), generateBlankNode(debt, rowid, s), generateColumIRI(debt, amount, p) Note that debt(name, _) is equivalent to SELECT name FROM debt. When applied to your example the answer is +-------------+ | name | +-------------+ | Juan | +-------------+ | Juan | +-------------+ Furthermore, debt(_, account) is equivalent to SELECT account FROM debt. When applied to your example the answer is +-------------+ | amount | +-------------+ | 50 | +-------------+ | 50 | +-------------+ and we assume that each row comes with its unique row id. Therefore the output would be Triple(_:b1, foo:bar#name, Juan) Triple(_:b1, foo:bar#amount, 50) Triple(_:b2, foo:bar#name, Juan) Triple(_:b2, foo:bar#amount, 50) I want to clarify that the rules do not necessarily need to be implemented in a rule language (you can but you don't have to). The english semantics, for example of 4.2.3 is IF table does not have a primary key THEN IF given a relation r(y1, ... , yn) AND generating the blank node for the row generateBlankNode(r, rowid, s) AND generating a predicate IRI for the attribute generateColumnIRI(r, bj, p) THEN A triple is formed where the subject is the blank node, the predicate is the predicate IRI and the object is the value Let me know what you think Juan Sequeda +1-575-SEQ-UEDA www.juansequeda.com On Tue, Jan 18, 2011 at 2:25 PM, Alexandre Bertails <bertails@w3.org> wrote: > On Tue, 2011-01-18 at 12:56 -0600, Juan Sequeda wrote: > > what do you mean by "go through all the phases"? > > In your case, I would imagine something like: > 1. RDB as CREATE + INSERT statements > 2. Datalog rules + facts > 3. triples as the result of firing the Datalog rules > 4. serialized RDF > > Alexandre. > > > > > > Juan Sequeda > > +1-575-SEQ-UEDA > > www.juansequeda.com > > > > > > On Tue, Jan 18, 2011 at 12:05 PM, Alexandre Bertails <bertails@w3.org> > > wrote: > > > > > > > > mhausenblas: questions for all the editors > > > ... I quite often go through the ML > > > > > > <mhausenblas> > > > > > > > > [19] > http://lists.w3.org/Archives/Public/public-rdb2rdf-wg/2010Nov/0086. > > > html > > > > > > mhausenblas: here is a link to a discussion between > > ericP, betehess, > > > you... > > > ... regarding set vs multiset > > > ... I'm not that deep in what in means > > > ... but I'd like to understand if this needs an issue for > > that > > > > > > juansequeda: not sure if that need a issue > > > ... I'll look at that that > > > > > > <mhausenblas> > > [20]http://www.w3.org/2001/sw/rdb2rdf/track/issues/ > > > > > > juansequeda: ok to check an action on this issue > > > > > > mhausenblas: ok to split in many issues > > > ... and one on the multiset issue > > > ... so we can speak about that next week > > > > > > betehess: please use the ML so we can help you :-) > > > ... especially because ericP and I initiated the thread > > > > > > Juan, in order to help you with your action, I would like you > > to > > considerer the following: > > > > [[ > > CREATE TABLE Debts ( > > Name varchar(50), > > Amount Integer > > ); > > INSERT INTO Debts (Name, Amount) VALUES("juan", 50); > > INSERT INTO Debts (Name, Amount) VALUES("juan", 50); > > ]] > > > > Using this very simple RDB [1] example, can you go through all > > the > > phases that lead to the RDF where I owe you 100? > > > > Alexandre. > > > > [1] > > http://www.w3.org/TR/2010/WD-rdb-direct-mapping-20101118/#Rel > > > > > > > > >
Received on Wednesday, 19 January 2011 15:19:16 UTC