W3C

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 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

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 resource that represents 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
      3. If s is the subject of any triples whose predicate is skos:exactMatch, skos:closeMatch or skos:broadMatch, and whose objects are IRIs, then for each of these objects o, add the pair <l, o> 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 <http://chef.example.com/cuisines>.
 
 <http://chef.example.com/cuisines> a skos:ConceptScheme.
 
 <http://chef.example.com/cuisines/indian> a skos:Concept;
     skos:inScheme <http://chef.example.com/cuisines>;
     skos:notation 1.
 <http://chef.example.com/cuisines/thai> a skos:Concept;
     skos:inScheme <http://chef.example.com/cuisines>;
     skos:notation 2.
 <http://chef.example.com/cuisines/italian> a skos:Concept;
     skos:inScheme <http://chef.example.com/cuisines>;
     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 a SKOS concept scheme whose three concepts directly correspond to the three database value, and then mapping this “local” scheme to the desired IRIs using the SKOS mapping property skos:broadMatch.

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

<#db-cuisines> a skos:ConceptScheme.

[] a skos:Concept;
    skos:inScheme <#db-cuisines>;
    skos:notation 1;
    skos:broadMatch <http://chef.example.com/cuisines/asian>.
[] a skos:Concept;
    skos:inScheme <#db-cuisines>;
    skos:notation 2;
    skos:broadMatch <http://chef.example.com/cuisines/asian>.
[] a skos:Concept;
    skos:inScheme <#db-cuisines>;
    skos:notation 3;
    skos:exactMatch <http://chef.example.com/cuisines/italian>.