Examples of mappings with RML

Mapping data combining XML and JSON sources

Input data

Input data in JSON format

{ ... ,
 "Performance" :
  { "Perf_ID": "567",
     "Venue": { 
      "Name": "STAM",
      "Venue_ID": "78" }
    "Location": { 
      "lat": "51.043611" ,
      "long": "3.717222” } 
    }, 
... }
Input data in XML format

<Events> ...
 <Exhibition id="398">
 <Venue>STAM</Venue>
  <Location>
   <lat>51.076891</lat>
   <long>3.717222</long>
  </Location>
 </Exhibition> ...
</Events>

Reusing mapping definitions for data of different formats

<#PerformancesMapping>
  rml:logicalSource [
    rml:source "http://ex.com/performances.json";
    rml:referenceFormulation ql:JSONPath;
    rml:iterator "$.Performance.[*]" ];

  rr:subjectMap [ 
     rr:template “http://ex.com/{Perf_ID}”];
 
 rr:predicateObjectMap [ 
   rr:predicate ex:location;
   rr:objectMap [ 
     rr:parentTriplesMap <#LocationMapping> ] ].
<#EventsMapping>
  rml:logicalSource [
    rml:source "http://ex.com/events.xml";
    rml:referenceFormulation ql:XPath;
    rml:iterator "/Events/Exhibition" ];

  rr:subjectMap [ 
    rr:template "http://ex.com/{@id}" ];
  
rr:predicateObjectMap [ 
    rr:predicate ex:location;
    rr:objectMap [ 
      rr:parentTriplesMap <#LocationMapping> ] ].
<#LocationMapping>
  rr:subjectMap [ 
    rr:template "http://ex.com/{lat},{long}"];

  rr:predicateObjectMap [ 
    rr:predicate ex:long;
    rr:objectMap [ rml:reference "long" ] ];

  rr:predicateObjectMap [ 
    rr:predicate ex:lat;
    rr:objectMap [ rml:reference "lat" ] ] .
ex:51.043611,3.717222
   ex:lat “3.717222”,   ex:long “51.043611”.

ex:51.076891,3.717222
   ex:lat “3.717222”,   ex:long “51.076891”.

Primary interlinking

<#PerformancesMapping>
  rr:subjectMap [ 
     rr:template “http://ex.com/{Perf_ID}”];
 
 rr:predicateObjectMap [ 
     rr:predicate ex:venue;
     rr:objectMap [ 
       rr:parentTriplesMap <#VenueMapping> ] ].
<#VenueMapping>
  rml:logicalSource [
    rml:source "http://ex.com/performances.json";
    rml:referenceFormulation ql:JSONPath;
    rml:iterator "$.Performance.Venue.[*]" ];
    
rr:subjectMap [ 
      rr:template "http://ex.com/{Venue_ID}";
      rr:class ex:Venue ].
<#EventsMapping>
  rr:subjectMap [ 
    rr:template "http://ex.com/{@id}" ];
  
 rr:predicateObjectMap [ 
    rr:predicate ex:venue;
    rr:objectMap [ 
      rr:parentTriplesMap <#VenueMapping>;
        rr:joinCondition [
          rr:child "$.Performance.Venue.Name";
          rr:parent "/Events/Exhibition/Venue" ]
] ] .
Without interlinking while mapping:
ex:567 ex:venue ex:78.
ex:398 ex:venue ex:STAM.
ex:78 owl:sameAs ex:STAM

Interlinking while mapping:
ex:567 ex:venue ex:78.
ex:398 ex:venue ex:78.

More examples with RML

Contact details of cities in Flanders

Beveren - input sources in XML format Destelbergen - input sources in CSV and XML format Ingelmunster - input sources in CSV format Knokke-Heist - input sources in HTML format Kortrijk - input sources in CSV format Roeselare - input sources in CSV format

Flemish company register

Demographic, Statistical and Geographic data of Flanders