RMLViewer

May 8, 2026 ยท View on GitHub

RMLViewer is a proof-of-concept implementation for RML Logical Views. For more information we refer to our paper.

Prerequisites

The code is written and tested using Python 3.12.3. To install the needed libraries, run below command.

pip install -r requirements.txt

Use

The script takes as input an RML mapping (conform with https://kg-construct.github.io/rml-resources/portal/) and returns an equivalent normalized mapping without logical views (named mapping_without_views.ttl).
The normalizations steps are described here.
All logical views are converted to logical sources with JSON files as source.
These JSON files are the materialization of the original logical views.
The new mapping file together with the original input data and the newly generated JSON files can be processed by any RML mapping engine that supports JSON source data.

Compared to the initial RML-view-to-CSV version (till v1.2.0), the legacy options --optimize and --no_ref_object_map are currently not supported in RMLViewer.

usage: rmlviewer.py [-h] [--version] [--mapping MAPPING] [--output_dir OUTPUT_DIR]

Copyright by (c) Els de Vleeschauwer (2024), available under the MIT license
options:
  -h, --help                show this help message and exit
  --version                 show program's version number and exit
  --mapping MAPPING         The mapping file that needs to be converted.
  --output_dir OUTPUT_DIR   Directory to which the output is saved, default is "./"

Implemented features

  • Flattening of nested data structures
  • Handling of mixed data formats
  • Extended joining of data sources
  • Field indexes
  • Templates and constants in Expression Fields
  • Natural datatype mapping (for datatypes supported by JSON)

Supported data formats

  • CSV
  • JSON
  • XML

Examples

Examples of mapping rules that can be handled with this implementation, can be found in the test cases and use cases.

COVERAGE of RML-LV TEST CASES

Test Case IDCovered?
./RMLLVTC0000a/True
./RMLLVTC0000b/True
./RMLLVTC0000c/True
./RMLLVTC0001a/True
./RMLLVTC0001b/True
./RMLLVTC0001c/True
./RMLLVTC0001d/True
./RMLLVTC0002a/True
./RMLLVTC0002b/True
./RMLLVTC0002c/True
./RMLLVTC0003a/True
./RMLLVTC0003b/True
./RMLLVTC0003c/True
./RMLLVTC0004a/True
./RMLLVTC0004b/True
./RMLLVTC0004c/True
./RMLLVTC0004d/True
./RMLLVTC0005a/True
./RMLLVTC0005b/True
./RMLLVTC0005c/True
./RMLLVTC0006a/True
./RMLLVTC0006b/True
./RMLLVTC0006c/True
./RMLLVTC0006d/True
./RMLLVTC0006e/True
./RMLLVTC0006f/True
./RMLLVTC0007a/True
./RMLLVTC0007b/True
./RMLLVTC0007c/True
./RMLLVTC0008a/True
./RMLLVTC0008b/True
./RMLLVTC0008c/True
./RMLLVTC0008d/True
./RMLLVTC0009a/True
./RMLLVTC0009b/True
./RMLLVTC0009c/True
./RMLLVTC0010a/True
./RMLLVTC0010b/True
./RMLLVTC0010c/True
./RMLLVTC0010d/True
./RMLLVTC0010e/True

Normalization

The resulting mapping file is normalized.

Properties Normalized

ShorthandExpanded FormTransformation
rml:subjectrml:subjectMapCreates blank node with rml:constant
rml:classrml:predicateObjectMapCreates nested structure with rdf:type
rml:predicaterml:predicateMapCreates blank node with rml:constant
rml:objectrml:objectMapCreates blank node with rml:constant
rml:childrml:childMapCreates blank node with rml:reference
rml:parentrml:parentMapCreates blank node with rml:reference
rml:datatyperml:datatypeMapCreates blank node, sets termType=Literal
rml:languagerml:languageMapCreates blank node, sets termType=Literal

Type Declarations Added

  • rml:TriplesMap - for triple map subjects
  • rml:SubjectMap - for subject maps
  • rml:PredicateObjectMap - for predicate-object maps
  • rml:PredicateMap - for predicate maps
  • rml:ObjectMap - for object maps
  • rml:RefObjectMap - for referencing object maps
  • rml:TermMap - for term maps
  • rml:GraphMap - for graph maps