RMLViewer is a proof-of-concept implementation for RML Logical Views. For more information we refer to our paper.
The code is written and tested using Python 3.12.3. To install the needed libraries, run below command.
pip install -r requirements.txtThe 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 "./"
- 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)
- CSV
- JSON
- XML
Examples of mapping rules that can be handled with this implementation, can be found in the test cases and use cases.
| Test Case ID | Covered? |
|---|---|
| ./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 |
The resulting mapping file is normalized.
| Shorthand | Expanded Form | Transformation |
|---|---|---|
rml:subject |
rml:subjectMap |
Creates blank node with rml:constant |
rml:class |
rml:predicateObjectMap |
Creates nested structure with rdf:type |
rml:predicate |
rml:predicateMap |
Creates blank node with rml:constant |
rml:object |
rml:objectMap |
Creates blank node with rml:constant |
rml:child |
rml:childMap |
Creates blank node with rml:reference |
rml:parent |
rml:parentMap |
Creates blank node with rml:reference |
rml:datatype |
rml:datatypeMap |
Creates blank node, sets termType=Literal |
rml:language |
rml:languageMap |
Creates blank node, sets termType=Literal |
rml:TriplesMap- for triple map subjectsrml:SubjectMap- for subject mapsrml:PredicateObjectMap- for predicate-object mapsrml:PredicateMap- for predicate mapsrml:ObjectMap- for object mapsrml:RefObjectMap- for referencing object mapsrml:TermMap- for term mapsrml:GraphMap- for graph maps