<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>RocketRML - A NodeJS Implementation of a Use-Case Speci c RML Mapper</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Semantic Technology Institute Innsbruck Department of Computer Science, University of Innsbruck</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>The creation of Linked Data from raw data sources is, in theory, no rocket science (pun intended). Depending on the nature of the input and the mapping technology in use, it can become a quite tedious task. For our work on mapping real-life touristic data to the schema.org vocabulary, we used RML but soon encountered, that the existing Java mapper implementations reached their limits and were not su cient for our use cases. In this system paper, we describe a new implementation of an RML mapper. Written with the JavaScript-based NodeJS framework it performs quite well for our use cases where we work with large XML and JSON les. The performance testing and the execution of the RML test cases have shown that the implementation has great potential to perform heavy mapping tasks in reasonable time, but comes with some limitations regarding JOINs, Named Graphs and inputs other than XML and JSON - which is ne at the moment, due to the nature of the given use cases1.</p>
      </abstract>
      <kwd-group>
        <kwd>RML</kwd>
        <kwd>RML Mapper</kwd>
        <kwd>RDF generation</kwd>
        <kwd>NodeJS</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        During our work on the semantify.it platform [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] we were implementing
mappings from di erent data sources to schema.org pragmatically. When we started
our work on the Tyrolean Tourism Knowledge Graph [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], the number of data
sources, data providers and use cases grew, and it quickly turned out, that the
programmatic approach does not scale. In a literature review we found out that
RML [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] looked very promising and would t our needs perfectly. As an extension
of R2RML, RML not only supports relational database inputs, but also other
sources like XML and JSON. While working with real-life data from touristic IT
solution providers, we encountered the challenge that the input data may exceed
500MB. A list of hotel room o ers in a region for a given time span or a list of
events of a given region for half a year, are quite some data to process. Soon
      </p>
    </sec>
    <sec id="sec-2">
      <title>1 Copyright ©2019 for this paper by its authors. Use permitted under Creative Com</title>
      <p>mons License Attribution 4.0 International (CC BY 4.0).
we encountered that existing RML mapper implementations reached a certain
performance limit that made it infeasible to work with for our use cases.</p>
      <p>For another project of ours, the MindLab2 project, we additionally realized
another requirement that some of the data we have do not contain necessary
primary and foreign keys for joins (e.g. a local business and its address). After we
collected requirements from di erent use cases, we decided to implement an RML
mapper that covers our needs. The requirements to the new implementation were
(in arbitrary order):
{ supporting XML and JSON input primarily, then expanding to other formats
{ handling nested objects that do not have any elds to join
{ working with larger les (e.g. &gt;500MB)
{ integrating with our existing NodeJS infrastructure</p>
      <p>In this paper we describe RocketRML, a use case speci c NodeJS
implementation of the RML mapper. The implementation does not cover the RML
specication 100%. It does, for example, not (yet) support JOINs or Named Graphs.
It introduce two additional features to the standard RML Mapper
implementation, namely a global language tag for string literals and mapping nested objects
where no identi ers exist.</p>
      <p>The remainder of the paper is structured as follows: Section 2 describes our
tool, its limitations and customizations, Section 3 describes the results of running
our mapper against the RML test cases3 and Section 4 discusses the
implementation and our next steps and concludes our paper.
2</p>
      <sec id="sec-2-1">
        <title>Tool Presentation</title>
        <p>RocketRML4 is a NodeJS implementation of the RML mapper. It supports a
subset of the RML speci cation that is needed for our use cases described in
Section 1. It covers most of the functionality the RML Mapper5 provides. In
this section, we explain the current limitations/deviations of our implementation
comparing to the standard RML Mapper implementation and the results of our
preliminary performance tests.
2.1</p>
        <sec id="sec-2-1-1">
          <title>Limitations</title>
          <p>No support for JOINs The main motivation of currently not supporting JOINs
for our use case is that the data we obtain from a good portion of IT solution
providers in tourism eld. The objects are typically nested and do not have any
eld that could serve as a joining point. Therefore applying joins between two
mappings (e.g. joining hotels and their rooms) is not possible without bene ting
from the structure of objects (i.e. how they are nested). For this purpose, we
customized the way iterators work in our implementation (see Section 2.3).</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>2 https://mindlab.ai</title>
    </sec>
    <sec id="sec-4">
      <title>3 https://github.com/RMLio/rml-test-cases</title>
    </sec>
    <sec id="sec-5">
      <title>4 https://github.com/semantifyit/RML-mapper</title>
    </sec>
    <sec id="sec-6">
      <title>5 https://github.com/RMLio/rmlmapper-java</title>
      <p>
        No support for Named Graphs Although we make heavy use of named graphs
[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] for provenance tracking and versioning purposes, in our use case, the named
graphs and provenance information are not part of generating RDF from a raw
data source at the moment. Therefore RocketRML currently does not support
generating quads.
      </p>
      <p>Only JSON and XML formats are supported in a logical source In all of our
current use cases, the logical sources are JSON and XML les. Therefore currently
we only support these two formats as input. This means the relation database
speci c features like SQL Views as logical source are also not supported. We will
add support for new logical sources (e.g. CSV les) as we need it.
Only JavaScript function implementations are supported We support the
function extension of RML, however the function implementation must be provided
in JavaScript.
2.2</p>
      <sec id="sec-6-1">
        <title>Performance tests</title>
        <p>One motivation for developing RocketRML was the performance issues we had
with large les. This was mainly due to the external libraries used in the Java
based implementations to parse the input les. We did a preliminary performance
test to compare three implementations, namely the legacy RML Mapper
(RMLMapper), RML Mapper Java (rmlmapper-java) and RocketRML (Figure 1 and
2)6. We measured how the time required for mapping changes as the number of
objects to map increases. We tested all implementations with the same array of
randomly generated objects for both XML and JSON inputs7. For each object,
the same mapping le has been used. Each JSON and XML object produces 5
triples. The tests have been run on a Lenovo T470s laptop with 16GB RAM
and Intel Core i7 2.7 GHz Quad-Core CPU. The results show that RocketRML
runs signi cantly faster for our use case. It can be also seen that RocketRML
performs with JSON input especially better, due to the native JSON support of
NodeJS. In fact, we convert the mapping les to JSON-LD in the beginning for
easier manipulation. Additionally, the generated RDF data is initially in
JSONLD format. Another reason we can think of is the lack of certain features like
JOINs. This would reduce the overhead of separately mapping all objects and
then joining the relevant ones. On top of that, Java implementations may be
performing poorly due to the limitations of external libraries used for parsing
input les and applying JSONPath and XPath queries. Such components may
be tested separately to isolate the bottleneck.</p>
      </sec>
    </sec>
    <sec id="sec-7">
      <title>6 See here for detailed test results</title>
    </sec>
    <sec id="sec-8">
      <title>7 Similar to the generation in https://github.com/semantifyit/RML</title>
      <p>mapper/blob/master/tests/performanceTest.js
Listing 1: An example data snippet in JSON format from an IT solution provider
2.3</p>
      <sec id="sec-8-1">
        <title>Customizations</title>
        <p>In this section we talk about our iterator implementation in detail. Additionally,
we explain the small implementation tweaks we made to cover some needs of our
use case.</p>
        <p>
          Custom Iterator Implementation In our use case, the raw data is mostly
coming from IT solution providers in the tourism domain. We have cases where
the objects represented in the data do not have any elds to join, instead the
parent and child objects are nested. Since we do not prefer to use RDF containers
for nested objects, an implementation with nested term mappings as in xR2RML
[
          <xref ref-type="bibr" rid="ref5">5</xref>
          ] would not solve this issue. Therefore we needed to customize how iterators
are interpreted in the mapper, in order to link instances of di erent types in
RDF output based on the nested structure of the input le.
        </p>
        <p>For example, the data in Listing 1 shows an array that contains SkiResort
objects that have multiple Address objects. The relationship between SkiResort
and Address is only provided by the nested structure of JSON elements. In a
typical mapping le, for example a SkiResortMapping and an AddressMapping
with iterators $.* and $.*.contactDetails.*.address would be de ned and a join
condition would specify on which elds the two resulting RDF graphs could be
joined. Since our data do not have such elds, the output of the mapping would
be wrong when there are multiple SkiResort objects with di erent addresses in
the array8. In order to overcome this issue, we customized the way iterators are
interpreted in our mapper (Algorithm 1).</p>
        <p>Algorithm 1 Custom iterator algorithm
1: result fg
2: function map(mappingObj; iterator; input; result)
3: input input.select(iterator)
4: result = subjectMapping(mapping, input, result)
5: for all pOM 2 mapping:getP redicateObjectM appings() do
6: if pOM:parentT ripleM ap then
7: childMapping pOM.parentTripleMap.getMapping()
8: predicate pOM.getPredicate()
9: source childMapping.getLogicalSource()
10: nestedIterator childMapping.getSubIterator(iterator)
11: result[predicate] = map(childMapping, nestedIterator, input, result)
12: else
13: result[predicate] = doMapping(pOM, iterator, input, result)
reference, template, constant...
.</p>
        <p>The main goal of the mapping algorithm with the customized iterator
handling is to recursively generate a JSON-LD object according to the mapping le.
The algorithm starts with a base mapping, which is explicitly speci ed before
running the mapper. After the subject mapping is done, the mapping function
iterates over all predicate-object mappings. Whenever a parent triple mapping
is encountered, it is processed recursively by the iterator of the nested mapping
and the result is attached to the parent JSON-LD object on the corresponding
predicate.</p>
        <p>Other Customizations The data in the tourism domain often comes with
a lot of string literal valued properties in di erent languages. This requires to
attach a language tag on many string values, which may be a tedious task in a
big mapping le. As a workaround, we have a global language option parameter
in our mapper that attaches the speci ed language tag to every string literal
during the mapping process.</p>
      </sec>
    </sec>
    <sec id="sec-9">
      <title>8 It would still be possible to use joins for cases where only parent has an ID eld</title>
      <p>by traversing from the child to the parent. For this the JSONPath implementation
should support this feature.</p>
      <sec id="sec-9-1">
        <title>Results of the Test Cases</title>
        <p>Our implementation passes all the test cases for JSON and XML format except
the ones that require joins and consider named graphs9.
Table 1 gives a summary of the failed
tests. The rst group fails because
of the lack of named graph support. Test Case Reason for Failure
Note that, some of the tests that con- RMLTC006a-*
tain graph mappings actually create RMLTC007e h-* No Named Graph Support
ftorirpeletsheiyn pthroedudceefauthlte gsraamphe, otuhtepruet- RRRMMMLLLTTTCCC000000998aab---XX*MMLL No JOIN Support
as our implementation. However, we
still consider them as failed tests since Table 1. A summary of the failed test
we do not support the graph map- cases. The asterisk (*) indicates both JSON
ping. The second group fails because and XML formats for the same test case.
of the lack of JOIN support. Although The underscore ( ) indicates a range of test
our implementation can handle nested cases (e.g. from e to h)
objects with the custom iterator
implementation, we cannot handle two
sources that are conceptually related but are not in the same tree (e.g. students
and sports they practice are in di erent les) at the moment.
4</p>
      </sec>
      <sec id="sec-9-2">
        <title>Conclusion and Discussion</title>
        <p>Generating RDF data from various (semi-)structured data is a crucial task for
endeavours like building knowledge graphs. Choosing a mapping framework for
this purpose is not only about the performance of the tool, but also about the
convenience and usability of the mapping language. We found RML convenient
in terms of mapping language as well as amount of available documentation
and examples. RML allows us to create RDF data from heterogeneous tourism
related data sources in a reusable and a rather scalable way. Due to the nature of
our use cases we could not use RML as it is. With RocketRML we have created a
new implementation of an RML mapper which performs well considering certain
use cases. Current limitations do not give a full coverage of RML speci cations.</p>
        <p>For our future work on the mapper, we are implementing JOINs, in order to
increase our coverage of RML speci cation and support some of our future use
cases that will require joins. However, the reality of a good portion of our data
sources will not change, so we need to still support the case where there are no
elds to join. Therefore we are going to generate arti cial unique identi ers for
objects during the mapping process and join them similar to the standard RML
implementation. We will then observe how the tool performance is a ected by
the implementation of JOIN support.</p>
        <p>Our use cases also showed, that having the input le's name hardcoded in
the mapping le is not always practical. Sometimes it is required to use the</p>
      </sec>
    </sec>
    <sec id="sec-10">
      <title>9 Full results available online.</title>
      <p>same mapping le for di erent input les during runtime. A standard way to
parameterize the input le for logical sources could be useful.</p>
      <p>Moreover, we will implement more performance tests under considerations
of simple, at le structures as well as deeply nested XML and JSON les. We
will run those tests on our implementation as well as other implementations and
publish the results.</p>
      <sec id="sec-10-1">
        <title>Acknowledgements</title>
        <p>This work is partially supported by the MindLab project10. Umutcan Simsek is
supported also by the 2018 netidee11 grant. The authors would like to thank
to all our developers, especially Thibault Gerrier and Philipp Hausle for their
implementation, support and helpful comments. We would like to also thank
Ioan Toma and Jurgen Umbrich from Onlim GmbH for fruitful discussions.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Carroll</surname>
            ,
            <given-names>J.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bizer</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hayes</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Stickler</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          :
          <article-title>Named graphs, provenance and trust</article-title>
          .
          <source>In: Proceedings of the 14th International Conference on World Wide Web</source>
          . pp.
          <volume>613</volume>
          {
          <fpage>622</fpage>
          . WWW '05,
          <string-name>
            <surname>ACM</surname>
          </string-name>
          , New York, NY, USA (
          <year>2005</year>
          ). https://doi.org/10.1145/1060745.1060835, http://doi.acm.
          <source>org/10</source>
          . 1145/1060745.1060835
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Dimou</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Vander</surname>
            <given-names>Sande</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Colpaert</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            ,
            <surname>Verborgh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            ,
            <surname>Mannens</surname>
          </string-name>
          , E., Van de Walle, R.:
          <article-title>RML: A Generic Language for Integrated RDF Mappings of Heterogeneous Data</article-title>
          .
          <source>In: Proceedings of the 7th Workshop on Linked Data on the Web (Apr</source>
          <year>2014</year>
          ), http://events.linkeddata.org/ldow2014/papers/ldow2014 paper 01.pdf
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3. Karle, E.,
          <string-name>
            <surname>Simsek</surname>
            ,
            <given-names>U.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fensel</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <article-title>: semantify.it, a Platform for Creation, Publication and Distribution of Semantic Annotations</article-title>
          .
          <source>In: SEMAPRO 2017: The Eleventh International Conference on Advances in Semantic Processing</source>
          . pp.
          <volume>22</volume>
          {
          <fpage>30</fpage>
          . New York: Curran Associates, Inc.
          <source>(Jun</source>
          <year>2017</year>
          ), http://arxiv.org/abs/1706.10067
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4. Karle, E.,
          <string-name>
            <surname>Simsek</surname>
            ,
            <given-names>U.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Panasiuk</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Fensel</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          :
          <article-title>Building an ecosystem for the tyrolean tourism knowledge graph</article-title>
          . In: Pautasso,
          <string-name>
            <given-names>C.</given-names>
            ,
            <surname>Sanchez-Figueroa</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Systa</surname>
          </string-name>
          <string-name>
            <surname></surname>
          </string-name>
          ,
          <string-name>
            <surname>K.</surname>
          </string-name>
          , Murillo Rodr guez, J.M. (eds.) Current Trends in Web Engineering. pp.
          <volume>260</volume>
          {
          <fpage>267</fpage>
          . Springer International Publishing,
          <string-name>
            <surname>Cham</surname>
          </string-name>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Michel</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Djimenou</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Faron-Zucker</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Montagnat</surname>
          </string-name>
          , J.:
          <article-title>Translation of relational and non-relational databases into RDF with xr2rml</article-title>
          . In: Monfort,
          <string-name>
            <given-names>V.</given-names>
            ,
            <surname>Krempels</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            ,
            <surname>Majchrzak</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T.A.</given-names>
            ,
            <surname>Turk</surname>
          </string-name>
          ,
          <string-name>
            <surname>Z</surname>
          </string-name>
          . (eds.)
          <source>WEBIST 2015 - Proceedings of the 11th International Conference on Web Information Systems and Technologies</source>
          , Lisbon, Portugal,
          <fpage>20</fpage>
          -22 May,
          <year>2015</year>
          . pp.
          <volume>443</volume>
          {
          <fpage>454</fpage>
          .
          <string-name>
            <surname>SciTePress</surname>
          </string-name>
          (
          <year>2015</year>
          ). https://doi.org/10.5220/0005448304430454, https://doi.org/10. 5220/0005448304430454
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>