rr:TranslationScheme, rr:translationMap, rr:TranslationMap)Sometimes the generated RDF terms produced by column-valued or template-valued term maps may be rather cryptic and user may want to translate them to different and usually more meaningful RDF terms. Such a translation scheme may require enumeration of the mapping pairs: (fromTerm, toTerm). This can be achieved in R2RML by associating one or more translation schemes with a term map. A translation scheme is a set of RDF term pairs. Each such mapping pair is specified as a translation map. A term map MAY be associated with one or more translation schemes, but the term-to-term mapping scheme represented by these translation schemes as a whole MUST be a bijection.
Consider the following database table that stores some proprietary code values for various cuisines:
| CuisineCode |
|---|
1 |
2 |
3 |
The following example object map translates the code values in the
CuisineCode column to some (rather cryptic) IRIs:
[] rr:predicate <http://chef.example.com/cuisineName> ;
rr:objectMap [ rr:template "http://chef.example.com/cuisines/Code/{CuisineCode}" ; rr:termType rr:IRI ] .
To make the IRIs more meaningful, user may want to create the following translation scheme:
| IRI_generated_by_object_map | translated_IRI |
|---|---|
http://chef.example.com/cuisines/Code/1 | http://chef.example.com/cuisines/indian |
http://chef.example.com/cuisines/Code/2 | http://chef.example.com/cuisines/thai |
http://chef.example.com/cuisines/Code/3 | http://chef.example.com/cuisines/italian |
The above translation scheme may be included in an R2RML mapping document by associating a translation scheme with the relevant term map as follows:
[] rr:column "cuisine";
rr:translationScheme <http://chef.example.com/cuisines> .
<http://chef.example.com/cuisines> rr:translationMap
[ rr:fromTerm <http://chef.example.com/cuisines/Code/1> ;
rr:toTerm <http://chef.example.com/cuisines/indian>
] ,
[ rr:fromTerm <http://chef.example.com/cuisines/Code/2> ;
rr:toTerm <http://chef.example.com/cuisines/thai>
] ,
[ rr:fromTerm <http://chef.example.com/cuisines/Code/3> ;
rr:toTerm <http://chef.example.com/cuisines/italian>
] .