Proposal for “per-row blank node maps” in R2RML

Hi all,

This is a proposal to add support for “per-row blank node maps” to R2RML. This would allow the expression of the entire DM in R2RML.

Let's start by looking at what we already can do in R2RML. Currently, a term map that generates blank nodes looks like this:

   rr:subjectMap [
       rr:termType rr:BlankNode;
       rr:column "ID";
       rr:class db1:IOU;
   ];

This would generate blank nodes based on the logical table's ID column. Instead of rr:column, one could also use rr:template or rr:constant. (In practice, one usually wants to use rr:template to make sure that the generated labels don't clash with blank nodes coming from some other subject map.)

The proposal is to allow omitting the rr:column/rr:template/rr:constant if the term type is rr:BlankNode. This would mean that the subjects are a new and distinct blank node for each row:

   rr:subjectMap [
       rr:termType rr:BlankNode;
       rr:class db1:IOU;
   ];

Below are proposed changes to the R2RML spec that would be needed to add this feature.

Best,
Richard



ADD a new Section 7.4 within Section 7, “Creating RDF Terms with Term Maps”:

[[
7.4 Blank Nodes for Each Row of a Logical Table

A per-row blank node map is a term map that generates a fresh blank node for each row of the logical table. In the case of logical tables that contain duplicate rows, this allows generating distinct subjects for the duplicate rows. A per-row blank node map is represented by a resource that has an rr:termType property with value rr:BlankNode, and does not have any of the properties rr:column, rr:template or rr:constant.

Per-row blank node maps are only allowed as subject maps or object maps.

The referenced columns of a per-row blank node map is the empty set.

Conforming R2RML processors MAY treat R2RML mappings that use per-row blank node maps over R2RML views as an error.

It is possible to define multiple per-row blank node maps over a single logical table. In this case, each of the maps produce distinct blank nodes. In the following example, two unique blank nodes are generated for each logical table row, one as the subject and one of the object of the generated ex:p triples.

    <#map1> a rr:TriplesMap;
        rr:logicalTable <#someLogicalTable>;
        rr:subjectMap [ rr:termType rr:BlankNode; ];
        rr:predicateObjectMap [
            rr:property ex:p;
            rr:objectMap [ rr:termType rr:BlankNode; ];
        ];
        .

But in the following example, each generated triple will have the same blank node as subject and object, because the same per-row blank node map is reference as the subject map and object map.

    <#map1> a rr:TriplesMap;
        rr:logicalTable <#someLogicalTable>;
        rr:subjectMap <#blankNodes>;
        rr:predicateObjectMap [
            rr:property ex:p;
            rr:objectMap <#blankNodes>;
        ];
        .
    <#blankNodes> rr:termType rr:BlankNode.
]]


ADD one line to the definition of “term map”:
http://www.w3.org/2001/sw/rdb2rdf/r2rml/#dfn-term-map

[[
A term map must be exactly one of the following:

	• a constant-valued term map,
	• a column-valued term map,
	• a template-valued term map.
	• a per-row blank node map.  <<< ADD THIS
]]


ADD a new clause to the definition of “generated RDF term”:
http://www.w3.org/2001/sw/rdb2rdf/r2rml/#dfn-generated-rdf-term

[[
	• If the term map is a per-row blank node map, then the generated RDF term is a blank node that is unique to the logical table row and to the term map.
]]

Received on Tuesday, 8 May 2012 20:46:06 UTC