R2RML mapping with values from another table
<p>I want to use R2RML and Virtuoso to map some tables from a MySql source.
I have a table with "Things" and I want them to have predicates that are not URIs but coming from the name column from a table "Values" connected via the thingID. 
I can map the table "Values" via the ID of a "Thing" to the thingId of "Values" - but with this mapping I only get the URI of the respective "Values" entry. What I want to have is the string stored in the column "Value".</p>

<p>The expected resulting triple should be for example:</p>

<pre><code>&lt;http://localhost:8890/ex/things/1&gt; rdf:type &lt;http://localhost:8890/ex/types/vmware&gt; ;
ex:hasValue "Name from the table Values" .
</code></pre>

<hr>

<pre><code>Example of Things table: 
ID  typeId 
1   3

Example of the Types table: 
ID   Name 
3    vmware
</code></pre>

<p>Example of the Values table:</p>

<pre><code>ID   thingId   Value 
1    1         VMware Virtual Platform
</code></pre>

<p>That is my mapping so far:</p>

<pre><code>&lt;#TriplesMapThings&gt; a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "exdb" ; rr:tableOwner "ex" ; rr:tableName "Things" ]; 
rr:subjectMap [ rr:termType rr:IRI  ; rr:template "http://localhost:8890/ex/things/{id}"; rr:class ex:Things; rr:graph &lt;http://localhost:8890/ex_test#&gt; ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant ex:id ] ; rr:objectMap [ rr:column "id" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant ex:typeid ] ; rr:objectMap [ rr:column "typeId" ]; ] ;

rr:predicateObjectMap [ rr:predicateMap [ rr:constant rdf:type ] ; rr:objectMap [ rr:parentTriplesMap &lt;#TriplesMapTypes&gt;; rr:joinCondition [rr:child "typeId"; rr:parent "id";]; ];] ;

rr:predicateObjectMap [ rr:predicateMap [ rr:constant ex:hasValue ] ; rr:objectMap [ rr:parentTriplesMap &lt;#TriplesMapValues&gt;; rr:joinCondition [rr:child "id"; rr:parent "thingId";]; ];] .





&lt;#TriplesMapTypes&gt; a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "exdb" ; rr:tableOwner "ex" ; rr:tableName "Types" ]; 
rr:subjectMap [ rr:termType rr:IRI  ; rr:template "http://localhost:8890/ex/types/{nameUri}"; rr:class owl:Class; rr:graph &lt;http://localhost:8890/ex_test#&gt; ];
rr:predicateObjectMap [ rr:predicateMap [ rr:constant ex:id ] ; rr:objectMap [ rr:column "id" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant ex:name ] ; rr:objectMap [ rr:column "name" ]; ] .





&lt;#TriplesMapValues&gt; a rr:TriplesMap; rr:logicalTable [ rr:tableSchema "exdb" ; rr:tableOwner "ex" ; rr:tableName "Values" ]; 
rr:subjectMap [ rr:termType rr:IRI  ; rr:template "http://localhost:8890/ex/values/{id}"; rr:class ex:Values; rr:graph &lt;http://localhost:8890/ex_test#&gt; ];

rr:predicateObjectMap [ rr:predicateMap [ rr:constant rdf:type ] ; rr:objectMap [ rr:parentTriplesMap &lt;#TriplesMapAttributes&gt;; rr:joinCondition [rr:child "attributeId"; rr:parent "id";]; ];]  ;

rr:predicateObjectMap [ rr:predicateMap [ rr:constant ex:hasThing ] ; rr:objectMap [ rr:parentTriplesMap &lt;#TriplesMapThings&gt;; rr:joinCondition [rr:child "thingId"; rr:parent "id";]; ];]  ;

rr:predicateObjectMap [ rr:predicateMap [ rr:constant ex:id ] ; rr:objectMap [ rr:column "id" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant ex:thingid ] ; rr:objectMap [ rr:column "thingId" ]; ] ;
rr:predicateObjectMap [ rr:predicateMap [ rr:constant ex:value ] ; rr:objectMap [ rr:column "value" ]; ] .
</code></pre>