Re: SQL in R2RML mappings

David,

Please take a look at the example involving LIKES table (Sec 2.3 [1] and 
Sec A.2.3 [2]) to see if the technique used would be useful for the 
WORKS table in your example.
The main idea here is that the predicate to be used for a column-value 
in a row is obtained from the value in another column. That is, the 
predicate is not just a constant URI.

    rr:predicateObjectMap 
    [ 
      rr:predicateMap [ rr:column "empLikes" ];
      rr:objectMap    [ rr:column "likedObj" ]
    ]

In the following example shown with some sample data, typically WORKS 
table will have a foreign key: WORKS(name) references PERSON(name):

PERSON Table (used in a Triplesmap TM1):
<name,      age>
---------------
John            29
Brad           35

WORKS Table (used in TriplesMap TM2):
<name,   activity,          item>
----------------------------------
John      composed      "Rock Song"
John      wrote             "Java Book"
Brad      composed      "Pop Song"

Is this the kind of scenario you are thinking about?

Thanks,
- Souri/Seema.

[1] http://www.w3.org/2001/sw/rdb2rdf/r2rml/#sec-likestable-pre
[2] http://www.w3.org/2001/sw/rdb2rdf/r2rml/#sec-likestable_mapping

David McNeil wrote:
> Souri/Seema -
>
> Thank you for your response, see my responses inline below.
>  
>
>     (A specific question about your issue #1: we are not sure what is
>     the requirement for "generate multiple subjects" ? If you meant
>     multiple TriplesMaps, then we can understand that the requirement
>     is to re-use the SQL query in those TriplesMaps.)
>
>
> Yes, re-using a SQL query in multiple TriplesMaps is what I mean.
>  
>
>     Not clear to us. Could you please clarify this requirement with a
>     concise example.
>
>
> Consider a PERSON table with a TriplesMap on top of it. Consider also 
> a WORKS table with a TriplesMap on it. The WORKS table describes 
> creative works produced by the person (e.g. books, songs, etc.). Each 
> of these TriplesMaps produces a variety of triples describing the 
> people and the works respectively.
>
> A triple is needed to tie people to their works like this: [:personA 
> :wrote :work1] [:personB :composed :work2]. In this example the 
> predicate tying the two TriplesMaps together depends on data that 
> comes from the logical table of the "object". Specifically if the 
> object is a book then the predicate is :wrote, whereas if the object 
> is a song then the predicate is :composed.
>
> However, as I read the R2RML specification, I do not see how to create 
> a RefPredicateObjectMap on the PERSON TriplesMap that references a 
> column under the WORKS TriplesMap (perhaps this capability was 
> intended by the specification and I am just not reading it properly?). 
> In general, I am looking for R2RML to support arbitrarily complex 
> expressions for predicates based on columns from both the subject and 
> the object logical tables.
>  
>
>     It is already assumed to be opaque.
>
>
> Ah, I did not realize that. Perhaps it would be worth explicitly 
> stating this in the spec (or maybe it is and I missed it?).
>
> Thanks again.
> -David 

Received on Tuesday, 25 January 2011 18:59:53 UTC