Re: negative test case question

Juan,

On 10 Feb 2012, at 03:16, Souripriya Das wrote:
> Whether the following mapping will fail or not will depend upon the data:
> 
> <TriplesMap1>
>     a rr:TriplesMap;
>     rr:logicalTable [ rr:tableName "Employees" ];
> 	rr:subjectMap [ rr:column "FirstName" ]; 
> 	rr:predicateObjectMap
>     [ 
>       rr:predicate foaf:name; 
>       rr:objectMap    [ rr:column "FirstName" ]
>     ]
> 
> For example, it will not fail for the following data (with uncommon first names) in the EMPLOYEES table:
> 
> FirstName
> -----------
> http://example.com/ns#John
> http://example.com/ns#Mary

What Souri says is absolutely correct, but the story continues. As usual, the details are in Section 11:
http://www.w3.org/2001/sw/rdb2rdf/r2rml/#generated-rdf-term

[[
2. Otherwise, if the term map's term type is rr:IRI:
    1. Let value be the natural RDF lexical form corresponding to value.
    2. If value is a valid absolute IRI [RFC3987], then return an IRI generated
       from value.
    3. Otherwise, prepend value with the base IRI. If the result is a valid
       absolute IRI [RFC3987], then return an IRI generated from the result.
    4. Otherwise, raise a data error.
]]

So, even if Employees.FirstName contains just the string "John", it will yield a valid IRI because that string is appended to the base IRI. If the base is http://example.com/base/ then this will yield http://example.com/base/John.

If the column contains strings like "Hans Christian" then we have a problem because the result is "http://example.com/base/Hans Christian" and that's not a valid IRI because spaces are not allowed in IRIs (and we intentionally don't %-encode the value, in order to not screw up the use case where the column actually contains IRIs already; if you want %-encoding then use an IRI template). So for "Hans Christian" we get a data error.

Data errors are an important concept in R2RML, so I suggest careful study of the relevant section which should answer most questions surrounding them:
http://www.w3.org/2001/sw/rdb2rdf/r2rml/#dfn-data-error

The important bit is that presence of data errors doesn't make a mapping non-conforming. Hence my request on the call the other day where I said we need to distinguish three outcomes of a test case:

1. non-conforming R2RML mapping
2. conforming R2RML mapping with expected result
3. conforming R2RML mapping with data error (and no result)

Hope that helps to clear things up.

Richard

Received on Friday, 10 February 2012 10:21:17 UTC