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.
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:
skos:inScheme
, and whose object
is the RDF node representing the translation schemeskos:notation
properties
whose values are literals, then for each lexical form l
of such a literal:
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:
Code | IRI |
---|---|
1 | http://chef.example.com/cuisines/indian |
2 | http://chef.example.com/cuisines/thai |
3 | http://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:notation
s
for some concepts.
Code | IRI |
---|---|
1 | http://chef.example.com/cuisines/asian |
2 | http://chef.example.com/cuisines/asian |
3 | http://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.