- From: Juan Sequeda <juanfederico@gmail.com>
- Date: Fri, 29 Jul 2011 08:36:34 -0500
- To: bvillazon@fi.upm.es
- Cc: Richard Cyganiak <richard@cyganiak.de>, public-rdb2rdf-wg@w3.org
- Message-ID: <CAMVTWDwyb1+p-e5cwBTDn8RPsmKT26xdrOzkyk=2kihj8cHyNw@mail.gmail.com>
Boris,
Thanks! I should have figured it out by myself that I could have done this
in a SQL query.
Part of me says that this is kind of a hack. Shouldn't R2RML have enough
expressivity to represent this, instead of writing it in a SQL query? Maybe
I'm wrong. I was just expecting it.
The relationship Student-Course is represented in a referencing object map
which is represented by exactly one rr:parentTriplesMap and it may have one
or more rr:joinCondition. Therefore, I could imagine seeing the following:
<#TriplesMap1>
rr:logicalTable [ rr:tableName "student"; ]
rr:subjectMap [
rr:template "http://data.example.com/student/{s_id}";
rr:class ex:Student;
];
rr:predicateObjectMap [
rr:predicateMap [ rr:predicate ex:name; ];
rr:objectMap [ rr:column "name" ];
];
rr:predicateObjectMap [
rr:predicateMap [ rr:predicate ex:isEnrolled ] ;
rr:refObjectMap [ rr:parentTriplesMap <#TriplesMap2> ];
].
<#TriplesMap2>
rr:logicalTable [ rr:tableName "course"; ]
rr:subjectMap [
rr:template "http://data.example.com/course/{c_id}";
rr:class ex:Course;
];
rr:predicateObjectMap [
rr:predicateMap [ rr:predicate ex:title; ];
rr:objectMap [ rr:column "title" ];
];
rr:predicateObjectMap [
rr:predicateMap [ rr:predicate ex:hasStudent ] ;
rr:refObjectMap [ rr:parentTriplesMap <#TriplesMap1> ];
].
And the mapping author is going to expect this to work. Is this r2rml wrong?
Or is this just an implementation issue?
I would suggest to add the many-to-many example in the spec and if my
previous r2rml is not wrong, create and Test Case for it.
Thanks!
Juan Sequeda
+1-575-SEQ-UEDA
www.juansequeda.com
On Fri, Jul 29, 2011 at 8:23 AM, Boris Villazon-Terrazas <
boris.villazon@deri.org> wrote:
> Hi Juan
>
> Thanks for asking!
>
> We have a Test Case for this
>
> http://www.w3.org/2001/sw/rdb2rdf/test-cases/TCOverview.html#D011-M2MRelations
> It includes the Direct Graph and R2RML mapping, and it is a good
> opportunity to check it.
>
> The associated files to this test case are here
> https://dvcs.w3.org/hg/rdb2rdf-tests/file/fd8f7c555644/D011-M2MRelations
>
> Thanks
>
> Boris
>
>
>
>
> On 29/07/2011 14:10, Juan Sequeda wrote:
>
> Richard, all
>
>
> This may be a dumb question, but I haven't been able to figure out how to
> represent a many-to-many relationship in r2rml. For example:
>
> Student(s_id, name)
> Course(c_id, title)
> Enrolled(s_id, c_id)
>
> Where Enrolled is the many-to-many relationship.
>
> These are the TripleMaps for the Student and Course table:
>
> <#TriplesMap1>
> rr:logicalTable [ rr:tableName "student"; ]
> rr:subjectMap [
> rr:template "http://data.example.com/student/{s_id}";
> rr:class ex:Student;
> ];
> rr:predicateObjectMap [
> rr:predicateMap [ rr:predicate ex:name; ];
> rr:objectMap [ rr:column "name" ];
> ].
>
> <#TriplesMap2>
> rr:logicalTable [ rr:tableName "course"; ]
> rr:subjectMap [
> rr:template "http://data.example.com/course/{c_id}";
> rr:class ex:Course;
> ];
> rr:predicateObjectMap [
> rr:predicateMap [ rr:predicate ex:title; ];
> rr:objectMap [ rr:column "title" ];
> ].
>
> I assume that I should add a predicateObjectMap to TriplesMap1 (student)
> which is going to connect to TriplesMap2 (course), but the joinCondition is
> on the enrolled table.
>
> <#TriplesMap1>
> rr:predicateObjectMap [
> rr:predicateMap [ rr:predicate ex:isEnrolled; ];
> rr:objectMap [
> rr:parentTriplesMap <#TriplesMap2>;
> rr:joinCondition [
> rr:child "?????";
> rr:parent "???";
> ];
> ].
>
> How is this suppose to be done? And could you add an example in the
> specs.
>
> Thanks!
>
> Juan Sequeda
> +1-575-SEQ-UEDA
> www.juansequeda.com
>
>
>
Received on Friday, 29 July 2011 13:37:28 UTC