RDF Mapping Language (RML)


The RDF Mapping language (RML) is a generic mapping language defined to express the rules that map data in heterogeneous structures and serializations to the RDF data model. RML deals with the mapping definitions in a uniform, modular, interoperable and extensible fashion.

In RML, the mapping of data to the RDF data model is based on one or more Triples Maps that defines how the triples will be generated. A Triples Map defines a rule to generate zero or more RDF triples sharing the same subject for each extract of data from the input source. A Triples Map consists of the Logical Source, the Subject Map and zero or more Predicate-Object Maps.

Logical Source
The Logical Source of a Triples Map

The Logical Source consists of the reference to the input source to be mapped, the Reference Formulation that specifies how references to the data occur and the iterator that specifies how to iterate over the input data. RML scales over different data formats as it uses a uniform way to define the mapping rules but does not refer to the extracts of the data in a uniform way. Instead RML uses references relevant to the input source, e.g. XPath for XML, to refer to the extracts of the input data. Currently, the following reference formulations: rr:sqlQuery, ql:CSV, ql:XPath, ql:CSS3 and ql:JSONPath are predefined.

Logical Source
The Subject Map of a Triples Map is defined according to the defined template.


The Subject Map consists of the template that defines the URI pattern used to generate the subject of the triple and optionally its type. The references to the input data occurs using valid references according to reference formulation specified. In that case, full or relative XPath expressions are used.

Logical Source
A Predicate Object Map consists of a Predicate Map that defines the predicate and an Object Map that defines the object of the triple to be generated.


Triples are generated using Predicate Object Maps. A Predicate Object Map consists of a Predicate Map that specifies the predicate of the triple and an Object Map that specifies the object(s) of the triple.

Appendix

The aforementioned examples refer to the following JSON file and generate the following RDF representation.
For more detailed examples visit here.

Input in JSON format

[ ...
  { "Title": "Apollo 11 Crew",
    "Sitter": [
      { "name": "Neil Armstrong",
        "birth_date": "1930-08-05" },
      { "name": "Buzz Aldrin",
        "birth_date": "1930-01-20" },
      { "name": "Michael Collins" } ],
        "DateOfWork": "1969" },
  { "Title": "Neil Armstrong",
    "Sitter": [
      { "name": "Neil Armstrong"  ,
        "birth_date": "1930-08-05" } ] ,
        "DateOfWork": "2009" } , 
... ]
Output RDF representation

ex:Neil+Armstrong a ex:Person ;
  ex:birth_date "1930-08-05"^^xsd:Date.

ex:Buzz+Aldrin a ex:Person ;
  ex:birth_date "1930-01-20"^^xsd:Date.

ex:Michael+Collins a ex:Person .