W3C

Revised DERI Propopsal for R2RML Translation Tables


9 Looking up IRIs in Translation Schemes (rr:translationScheme)

Databases often contain application-specific codes as data values. When mapping the database to RDF, such codes are often mapped to IRIs, which may have to be looked up in lists of code-to-IRI mappings. This can be achieved in R2RML using translation schemes. Translation schemes are based on SKOS concept schemes [SKOS]. When a logical table column is mapped to RDF using a translation scheme, then the scheme is searched for concepts whose skos:notation matches the column value. If such a concept is found, then its IRI is used in the RDF output. If no matching concept is found, then it is a data error.

Diagram: Translation schemes

Figure 6: Translation schemes

R2RML translation schemes are defined using two properties from the SKOS vocabulary: skos:inScheme and skos:notation. The presence of other SKOS terms in the mapping graph has no effect on R2RML processing, an no further knowledge of SKOS besides what is presented in this section is required to author R2RML mappings.

A column-valued term map or template-valued term map MAY have one or more associated translation schemes, specified using the rr:translationScheme property, whose values MUST be translation schemes.

A translation scheme is a set of one or more string-IRI pairs. The pairs are determined as follows:

  1. Let notations be an empty list
  2. Find all triples in the mapping graph whose predicate is skos:inScheme, and whose object is the RDF node representing the translation scheme
  3. For each subject s of such a triple:
    • If s has any skos:notation properties whose values are literals, then for each lexical form l of such a literal:
      1. Add l to the notations list
      2. If s is an IRI, add the pair <l, s> to the translation scheme

Evaluating the algorithm above MUST NOT result in a notations list that contains the same value more than once.

The following example term map translates database codes in the cuisine column to IRIs:

CodeIRI
1http://chef.example.com/cuisines/indian
2http://chef.example.com/cuisines/thai
3http://chef.example.com/cuisines/italian
[] rr:column "cuisine";
     rr:translationScheme <#cuisineScheme>.
 
 <http://chef.example.com/cuisines/indian>
     skos:inScheme <#cuisineScheme>;
     skos:notation 1.
 <http://chef.example.com/cuisines/thai>
     skos:inScheme <#cuisineScheme>;
     skos:notation 2.
 <http://chef.example.com/cuisines/italian>
     skos:inScheme <#cuisineScheme>;
     skos:notation 3.

In the following example, database codes don't correspond directly to IRIs; multiple codes are translated to the same IRI. This is achieved by defining multiple skos:notations for some concepts.

CodeIRI
1http://chef.example.com/cuisines/asian
2http://chef.example.com/cuisines/asian
3http://chef.example.com/cuisines/italian
[] rr:column "cuisine";
    rr:translationScheme <#cuisineScheme>.

<http://chef.example.com/cuisines/asian>
    skos:inScheme <#cuisineScheme>;
    skos:notation 1, 2;
<http://chef.example.com/cuisines/italian>
    skos:inScheme <#cuisineScheme>;
    skos:notation 3.