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.
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:
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:
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:
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 <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
.
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 <#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>.