<!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>
      <journal-title-group>
        <journal-title>International Workshop on Knowledge Graph Construction, May</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Simon Bin</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Claus Stadler</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Lorenz Bühmann</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Institute for Applied Informatics (InfAI)</institution>
          ,
          <addr-line>Leipzig</addr-line>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2023</year>
      </pub-date>
      <volume>28</volume>
      <issue>2023</issue>
      <fpage>0000</fpage>
      <lpage>0001</lpage>
      <abstract>
        <p>This is the report of our participation in the KGCW2023 Challenge @ ESWC 2023 with our RDFProcessingToolkit/Sansa system which won the “fastest” tool award. The challenge was about the construction of RDF knowledge graphs from RML specifications with varying complexity in regard to the mix of input formats, characteristics of the data and the needed join operations. We detail how we integrated our tool into the provided benchmark framework. Thereby we also report on the issues and shortcomings we encountered as a base for future improvements. Furthermore, we provide an analysis of the data measured with the benchmark framework.</p>
      </abstract>
      <kwd-group>
        <kwd>eol&gt;RML</kwd>
        <kwd>SPARQL</kwd>
        <kwd>RDF</kwd>
        <kwd>Knowledge Graph</kwd>
        <kwd>Big data</kwd>
        <kwd>Semantic Query Optimisation</kwd>
        <kwd>Apache Spark</kwd>
        <kwd>Challenge</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
    </sec>
    <sec id="sec-2">
      <title>2. Setting up RPT/Sansa with the KGCW Challenge Tool</title>
      <p>Accompanying the challenge, a pipeline tool3 was provided. The benchmark tool is built on
Python, JSON, and Docker. It was strongly encouraged to use the tool and of course, the promise
of its provisioning is to ease the evaluation of the system under test and have a common ground
for comparing results.</p>
      <p>
        After installing the benchmark tool, first we had some issues getting it to work. One major
point of critique, which was also shared by other challenge participants, is that the provided
version of the benchmark tool proceeded to delete all Docker containers on the system, even
those that were not related to the challenge. For this reason, we had to patch our own fork
of the benchmark tool such that only containers that were also created by it were removed.
Additionally, the included MySQL component caused the following three noteworthy troubles:
(
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) the benchmark tool created a MySQL database setup in the host computer’s /tmp directory
which was not cleaned up, leading to hard-to-debug version conflicts later on. (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) MySQL
failed to start unless the file bench_executor/config/mysql/mysql-secure-file-prive.cnf
was made read-only. (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) the Python package cryptography was missing from the provided
requirements.txt, leading to another exception in the MySQL adaptor.
      </p>
      <p>
        Then, it was needed to integrate RPT/Sansa. The steps involved were:
1. Creation of a Docker image for RPT. As RPT already ships with several packaging options,
including Docker,4 there was no additional work needed.
2. Writing of a Python file that connects RPT to the benchmark tool. The file is
bench_executor/rpt.py and was suficiently easy to create by copying and adapting
the rmlmapper.py file. However, there were some dificulties: (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) Class names must not
start with lowercase, otherwise it is silently ignored. (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) The benchmark tool did not
support running multiple steps with the same tool. However, RPT/Sansa required multiple
invocations of the RPT tool for converting RML to a SPARQL workload, optimising the
SPARQL workload and finally executing it. As a workaround we added a global instance
counter. (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) Our container required configuring a working directory (Docker command
line flag -w); this was not supported by the benchmark tool so we had to extend the base
ContainerManager class.
3. Setting up the pipeline files ( metadata.json) for the 63 test cases that execute the case
using RPT.
      </p>
      <p>The challenge dataset comes with 63 metadata.json files which use RMLMapper as the
reference to implement the necessary steps. At first, we pondered if a search and replace
operation on these files would be suficient to run RPT, however it is easy to make mistakes in
the process, which would have been detrimental to our challenge run. So instead we examined
all files and identified the common patterns. On this basis, we reverse-extracted two YAML
templates from those 63 files, one for each major part of the challenge. Then we continued to
implement a template-to-metadata.json program which generates all 63 files from those two
templates as required.5
3https://github.com/kg-construct/challenge-tool
4Maven artefact rdf-processing-toolkit-pkg-docker-cli
5https://github.com/SimonBin/kgc-challenge-tool-template</p>
      <p>Because we also wanted to be able to run and compare multiple tools using the benchmark
tool, we furthermore changed the pipeline filename from metadata.json to my-tool.json, and
added a command line switch to the benchmark tool to change the filename that it will read.</p>
      <sec id="sec-2-1">
        <title>2.1. Fixing and Adapting the Mapping Files</title>
        <p>
          The RML mappings provided in the challenge sufered from the following issues, which we
resolved using SPARQL Update queries: (
          <xref ref-type="bibr" rid="ref1">1</xref>
          ) Invalid combinations of constant string and IRI type
were replaced with constant IRIs.6 (
          <xref ref-type="bibr" rid="ref2">2</xref>
          ) The invalid JSON iterator [*] was replaced with $.[*].7
        </p>
        <p>Next, we also replaced R2RML in the mappings with RML and changed the table names to
the CSV file names, as RPT / Sansa did not support relational databases (RDB) at the time of the
challenge. It is noteworthy that this adaption was also made by at least one more participant.
In this case, separate tasks for RDB and CSV would have been desirable.</p>
      </sec>
      <sec id="sec-2-2">
        <title>2.2. Verifying the Results</title>
        <p>We verified the RDF output of our tool by comparing it to the ground truth provided by [ 3]. For
this purpose, we harmonised our output and the reference data as sorted n-quads and performed
a simple line-based white-space ignoring comparison using the diff command. Although the
number of triples matched up, there were lines that difered. Manual inspection revealed that
there were issues with the ground truth:
• Many numbers in the ground truth are replaced with 999.999, one example from
GTFSMadrid-Bench, scale_100:
&lt;http://transport.linkeddata.es/madrid/metro/shape_point/00000000000000000001-1000803&gt;
&lt;http://www.w3.org/2003/01/geo/wgs84_pos#long&gt;
"999.999999999999999"ˆˆ&lt;http://www.w3.org/2001/XMLSchema#double&gt; .</p>
        <p>Correct answer: "3971182"ˆˆ&lt;http://www.w3.org/2001/XMLSchema#double&gt;
• Data types were present in the ground truth which were not specified in the mapping
ifles. One example from GTFS-Madrid-Bench, heterogeneity_files:
&lt;http://transport.linkeddata.es/madrid/metro/trips/000000000000000009kc&gt;
&lt;http://vocab.gtfs.org/terms#direction&gt;
"1"ˆˆ&lt;http://www.w3.org/2001/XMLSchema#integer&gt; .</p>
        <p>Correct answer: "1" (as a string)</p>
      </sec>
      <sec id="sec-2-3">
        <title>2.3. Data Quality Issues</title>
        <p>There is one more caveat with the GTFS benchmark: wrong use of data types. The arrival_time
and departure_time are mapped to xsd:duration, however their values are not a valid duration.
(Example: 0000000000000000006l; valid duration example: PT2M10S). This causes systems that
validate RDF terms, such as ours which is based on Apache Jena, to spend a significant amount
of time emitting warning messages. Thus, a recommendation for the future would be to improve
6https://github.com/oeg-upm/gtfs-bench/issues/142#issuecomment-1453784200
7https://rml.io/specs/rml/#examples
the benchmark with only well-formed RDF terms and/or have dedicated tasks for mappings
that produce malformed ones.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Performance Results</title>
      <p>
        In this section we present the results which we obtained for RPT/Sansa using the benchmark
tool. Unfortunately, for this challenge it was not possible to evaluate all participating tools on
the same hardware. Each participant executed their own tool on their own system. Our system
was an AMD Ryzen 9 5950X with 128 GB RAM, of which Java was allowed to use 50% of the
RAM. The benchmark tool generated 126 CSV files when giving the command ./exectool
stats. To that end, we wrote a program to first extract these files in an automated way and then
to draw plots of the measured values of RPT. Otherwise it would be laborious and error-prone
to create the charts. We also calculated the number of triples resulting from the mapping as well
as the input sizes of the source files processed by the mapping (these values are not present in
the CSV files created by the benchmark tool). For a comparison of RPT to other systems please
refer to our system paper [1]. In the following we only show selected plots. All plots, as well as
the raw data, can be found in the RPT supplements repository.8
How to read the plots. Each of the following plots captures all of the following information.
In order to assist the reader, we added circled numbers to Figure 1 which correspond to the
numbers of this list:
1. The challenge was organised into multiple directories with diferent tasks. The parent
directory/task is displayed on the left outer legend, the left y-axis shows the
directory/different parameter configurations for this task.
2. The thick bar next to the parameter configuration is the main bar. It records the run-time
of RPT. The total run-time in seconds is also printed at the end of the bar, and the run-time
is also displayed on the bottom x-axis.
3. Each task “pipeline” can be configured to consist of multiple steps. We configured RPT to
use six steps, the duration of each step corresponding to the diferent coloured segments on
the main bar. (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) fix the mappings (see section 2.1), (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) configure the CSV “NULL” value
(meaning unbound in SPARQL), (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) run the XML mappings (not parallelised), (4) convert
the RML mapping into an equivalent SPARQL SERVICE query (see [1]), (5) run source
optimisation on the SPARQL query, (6) execute the SPARQL query mapping description
using RPT/Sansa.
4. The right y-axis shows the CPU time scale factor. This shows the distributedness of the
execution (higher = more distributed). It was calculated by dividing the CSV column
cpu_user_system_diff by the duration.
5. A red  mark shows the value of the memory_ram_max CSV column (memory consumption).
      </p>
      <p>The memory consumption is also displayed on the top x-axis. Note, that the measurement
has very limited informative value because the benchmark tool captures the initial virtual
memory claimed by the Java Virtual Machine (JVM, 28 GiB) and not the actually used
memory. We have no reason to suspect that less memory would be a problem for RPT.
8https://github.com/AKSW/RdfProcessingToolkit-Resources/tree/main/2023-05-28-KGCW-at-ESWC
6. and 7. The small bar above the main bar and the small bar below the main bar are to be
read from top to bottom. They display the relative size of the input data on top and the
relative size of the output triple count on the bottom of the main bar (blue). In the case of
heterogeneous input formats, the top bar is colour coded for the size of the XML, JSON and
CSV input. Note that while the raw numbers are absolute, the plot only gives a relative
perception of the input and output sizes, with a size of 0% on the far left.</p>
      <p>The tasks join 1-1, join 1-N, join 1-10, join N-1, and join 10-1 (which test scaling the number of
joins) as well as empty-values (which test the handling of empty/unbound values in the dataset)
do not exhibit much variation. RPT requires roughly 20 seconds to complete them, with a
CPU time scale of × 4.4. (Of these, approx. 12 seconds are start-up overhead of Docker/the
system.) None of the parameter variations seem to have much influence here, which might
suggest the data/size/test case is too small for RPT. For the tasks join N-M, with N, M ̸= 1, we
can detect a slight increase in run-time depending on the number of joining triples and thus also
the resulting triple count (see Figure 1). For the duplicated-values, RPT’s performance slightly
decreases the fewer duplicates there are because more time needs to be spent on writing. This
is not observed for empty-values, because there are always 100 000 unique id values whereas in
the duplicated-values task % of the IDs are duplicates. (See supplements for figures.)
5 memory consumption in GiB
28
32
36
40
44
48
52
56
60
64
1
5
5
n
i
o
j
,
M
N
n
i
o
j
100%
75%
50%
csv input size 6
fix sparql opt.</p>
      <p>map step 3
3
10</p>
      <p>15 20
run-time in sec.
50% —— i/o size —— 100%
25</p>
      <p>The mappings task sought to evaluate the balance between multiple triple maps (TM) and
property-object maps (POM). Before running the task, we assumed that the resulting graphs
should be equivalent and thus the run-time of RPT identical, since the source CSV and the
triple counts are identical. However, the mappings provided are quite diferent. In the case of
15TM 1POM there are 1.5 mio. entities with exactly the same property :p1 generated whereas
in the 1TM 15POM case, we have only 100 000 entities with 15 properties each. Hence for
15TM 1POM the distinct operation is more expensive and cannot be parallelised well, as is
evident in Figure 2.
28.52
21.07</p>
      <p>files
mixed
tabular
 mem
160
 mem
xml json</p>
      <p>csv input size
fix
xml sparql opt.</p>
      <p>The second part of the challenge was the GTFS-Madrid-Bench. We have also used this
benchmark in [1], but we did not test RPT with heterogeneous GTFS Bench (n.b. there seems to
be a mismatch between the description of the challenge and the actual content, we found the
composition to be: csv+sql (tabular), xml,json,csv+sql (mixed), xml,json,csv (files), and xml,json
(nested)). From Figure 3 we can see that CSV (tabular) has a much smaller input size. This
benefits RPT two-fold, making it the fastest configuration of this task group. JSON files take the
</p>
      <p>34.73
91.74</p>
      <p>
2,500
3,000</p>
      <p>3,500
 Sansa  ARQ mem
× 5.8
 mem
triples(log)
y
t
i
e
n
e
g
o
r
e
t
e
h
,
h
c
n
e
B
S
F
T
G
1000
100
10
1
100
csv input size(log)
fix</p>
      <p>files
mixed
tabular
28</p>
      <p>32
129.67
majority of the input data for all the other cases. In the nested configuration there is three times
more XML than in the other two cases. Here, we can also observe that our XML processing
time (second step) takes 6.5 seconds as compared to 4.2 seconds or 2.9 seconds (when no XML
is present; start-up overhead). Additionally, with this data size the parallelism can be utilised,
leading to a CPU time scale of × 16.</p>
      <p>When scaling the GTFS Bench, we can see RPT shine. The GTFS Bench can generate input
data for multiples of 395 953 output triples. For scale 1000 that amounts to almost 400 mio.
triples. The performance of RPT can be seen in Figure 4. We changed to a logarithmic scale
(x-axis) to make it easier to compare diferences in the order of magnitude. Similar to the scaling
of records, the GTFS Bench at scale 100 takes 91.7 seconds, and at ten times it takes 727 seconds
(an increase of only × 8). The parallelism is also increased once more from a CPU time scale of
× 18 for GTFS scale 100 to × 25 for GTFS scale 1000. That means in number of CPU seconds, for
a ten-fold increase in output triples we have a still satisfactory eleven-fold increase.</p>
      <p>Figure 5 shows a bonus plot comparing the execution time of RPT/Sansa to that of RPT/ARQ,
another execution engine which is running on the same infrastructure as RPT/Sansa but with
Jena ARQ instead of Apache Spark as the execution engine. This is a single-process execution
engine without distributed/parallel computation.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusions and Future Work</title>
      <p>We initially expected that all contenders in the challenge would create configurations for the
benchmark tool such that Docker containers could be easily run with diferent Knowledge
Graph Construction tools on the same hardware. However, this efort has yet to happen. It
would have been great if the benchmark tool were capable of generating a statistics report
similar to the one we described automatically (ideally even with support for comparing multiple
systems). So far the benchmark tool only collected data in a set of CSV files but all further
interpretation had to be done individually by each participant. Finally, as apparent in the results,
RPT/Sansa executes most tasks in around 20 seconds. As such, by comparing RPT only to itself
there are not many interesting diferences to be seen from which insights could be derived
besides that RPT executes those tasks in a stable and reliable way. Still, for future challenge
runs, it may be worthwhile to refine the tasks further such as by scaling them up to larger sizes
in order to see whether this leads to significant diferences.</p>
    </sec>
    <sec id="sec-5">
      <title>Acknowledgments</title>
      <p>The authors acknowledge the financial support by the German Federal Ministry for Economic
Affairs and Energy in the project CoyPu (project number 01MK21007A) and by the German Federal
Ministry of Education and Research in the project StahlDigital (project number 13XP5116B).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>C.</given-names>
            <surname>Stadler</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Bühmann</surname>
          </string-name>
          , L.-P. Meyer, M. Martin,
          <string-name>
            <surname>Scaling RML</surname>
          </string-name>
          and
          <article-title>SPARQL-based knowledge graph construction with Apache Spark</article-title>
          ,
          <source>in: Proceedings of the 4th International Workshop on Knowledge Graph Construction, ESWC</source>
          ,
          <year>2023</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>D.</given-names>
            <surname>Chaves-Fraga</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Priyatna</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Cimmino</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Toledo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Ruckhaus</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Corcho</surname>
          </string-name>
          ,
          <string-name>
            <surname>GTFS-MadridBench</surname>
          </string-name>
          :
          <article-title>A benchmark for virtual knowledge graph access in the transport domain</article-title>
          ,
          <source>Journal of Web Semantics</source>
          <volume>65</volume>
          (
          <year>2020</year>
          )
          <fpage>100596</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>D.</given-names>
            <surname>Van Assche</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Chaves-Fraga</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Dimou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>U.</given-names>
            <surname>Şimşek</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Iglesias</surname>
          </string-name>
          ,
          <source>KGCW 2023 Challenge @ ESWC</source>
          <year>2023</year>
          ,
          <year>2023</year>
          . doi:
          <volume>10</volume>
          .5281/zenodo.7837289.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>