Re: R2RML/RML for CSV

Dear Dan,

> Q: Can [R2]RML expand a single row into multiple interconnected
> subject-nodes. I thought maybe
> http://www.w3.org/TR/r2rml/#dfn-referencing-object-map is relevant but
> haven't figured it out.
Yes it is.
> Example:
>
> 1. data
> https://github.com/w3c/csvw/blob/gh-pages/examples/tests/scenarios/events/events-listing.csv
>
> 2. target triples
> https://github.com/w3c/csvw/blob/gh-pages/examples/tests/scenarios/events/expected-triples.txt
For your example, a mapping document (with the input specified in RML) 
would be as follows (not complete but shows how the referencing object 
map is used compared to the regular object map):

@prefix rr:     <http://www.w3.org/ns/r2rml#>.
@prefix rml:    <http://semweb.mmlab.be/ns/rml#> .
@prefix ql:     <http://semweb.mmlab.be/ns/ql#> .
@prefix schema: <http://schema.org/> .

  <#Event>
     rml:logicalSource [
         rml:source "events-listing.csv";
         rml:referenceFormulation ql:CSV
     ];

     rr:subjectMap [
         rr:termType rr:BlankNode
     ];

     rr:predicateObjectMap [
         rr:predicate schema:location;
         rr:objectMap [
             rr:parentTriplesMap <#Location>
         ]
     ];

     rr:predicateObjectMap [
         rr:predicate schema:name;
         rr:objectMap [
             rml:reference "Name";
         ]
     ].

   <#Location>
     rml:logicalSource [
         rml:source "events-listing.csv";
         rml:referenceFormulation ql:CSV
     ];

     rr:subjectMap [
         rr:termType rr:BlankNode
     ];

     rr:predicateObjectMap [
         rr:predicate schema:address;
         rr:objectMap [
             rml:reference "location_address";
         ]
     ].
> My suspicion is that R2RML is optimised for the case where tables like
> this are denormalized and related using relational keys.
In general in [R2]RML, one can generate triples with more than one 
subject per row.Moreover, the Referencing Object Map can be used to 
combine two different tables (for R2RML, or data sources for RML) but 
those two can be the same table (as in this case), too. Relational keys 
are required if you want to express a join condition.
>   I don't see a
> way to create three different "subject maps" for these typed entities.
> But I'm new to the specs and still exploring. Any clues welcomed!
> Experiment so far is still all in one directory at
> https://github.com/w3c/csvw/tree/gh-pages/examples/tests/scenarios/events
> and uses the RMLProcessor tool I described in
> http://lists.w3.org/Archives/Public/public-csv-wg/2014Oct/0002.html
>
> cheers,
>
> Dan
>

Kind regards,
Anastasia

-- 

Anastasia Dimou
@natadimou | mmlab.be | iminds.be | rml.io
Semantic Web - Linked Open Data Researcher
Ghent University, Belgium - Multimedia Lab - iMinds
G. Crommenlaan 8 bus 201, B-9050 Ghent, Belgium

Received on Tuesday, 7 October 2014 07:30:01 UTC