<!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>Exploiting Wide Property Tables Empowered by Inverse Properties for E cient Distributed SPARQL Query Evaluation</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Guilherme Schievelbein</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Victor Anthony Arrascue Ayala</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Fang Wei-Kleiner</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Georg Lausen</string-name>
          <email>lauseng@informatik.uni-freiburg.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Freiburg</institution>
          ,
          <addr-line>Georges-Kohler Allee, Geb. 51, 79110 Freiburg</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Translating SPARQL to Spark SQL has been proposed to achieve better scalability in query evaluation. Recent investigations show that the database design for storing the RDF-graph plays a signi cant role in the performance, due to intrinsic characteristics of Spark's computation model. The analysis points to the interesting fact that a Wide Property Table (WPT), a single-table design with one row for each subject and one column for each property, has very nice properties for storing RDF-graphs. In addition to WPT's simplicity, SPARQL queries, in particular those with many joins on subjects, are translated to an e cient Spark execution plan. We aim to extend the WPT with inverse properties to broaden this bene t to other kinds of queries. Thus, in this paper we propose a framework which can leverage one or a combination of WPTs extensions. Our experiments on a widely used benchmark reveal that a combination of three di erent kinds of WPT together leads to the best performance for almost all query types but the linear-shaped ones.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Translation from SPARQL to Spark SQL is widely researched because it makes it
possible to bene t from the robustness and scalability of cloud computing
infrastructure. In Spark, a database design involves a collection of DataSets, which
are at the physical level divided into partitions (set of rows), and distributed
and replicated among cluster nodes. An example of such a design is the Wide
Property Table (WPT), a very sparse single-table design with one row for each
subject and as many columns as the number of distinct properties. Some notable
examples of systems on top of Spark are: S2RDF [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] and SPARQLGX [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ] which
use another design based on vertically partitioning by predicate (VP), PRoST [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]
and the approach by Hassan et al. [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ] which combine VP and WPT, the second
even multiple subsets of WPTs. As pointed out by a recent analysis by Arrascue
et al. [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], the superior performance of the WPT design is due to its favorable
Copyright c 2019 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0).
characteristics: 1) since a WPT partition has all information related to a set
of subjects, star-shaped queries with many on-subject joins are not translated
to Spark SQL joins, which might eventually require shu ing. Instead, they are
translated to operations which can be solved locally and result in a reduced
number of stages in the execution plan; 2) the number of partitions is large enough
to take full advantage of the parallelism. Thus, we aim to extend the WPT with
inverse properties so that even more graph pattern bindings can locally occur
within a single partition. Our proposed framework makes it possible to leverage
multiple of these WPT extensions. This allowed us to carry out a performance
evaluation and nd out how to best make use of WPTs with inverse properties.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Approach</title>
      <p>We propose a framework capable of using multiple WPT extensions from the
same RDF-graph to evaluate SPARQL queries. We achieve this by generating
an intermediate abstract tree of operation nodes to represent a given SPARQL
query. The central criterion to build it is the minimization of the number of
join operations. In this tree each node can independently use an available WPT
design. The leaves contain a graph pattern (a single or conjunction of triple
patterns), that can be evaluated without a Spark SQL join operation in a given
database. Intermediate nodes represent join operations on the common variables
of their children nodes. Thus, to minimize the number of join operations
necessary for the query evaluation the algorithm takes all available designs given as
input into account. Given that WPT works well for on-subject joins, we consider
here also its object counterpart, the Inverse Wide Property Table (iWPT). An
iWPT contains one distinct column for each property of the RDF-graph and
each row contains the information about an object. Therefore, graph patterns
with a common object resource can be processed with a single scan of the iWPT.
These two tables, WPT and iWPT, can be joined to have in a single row all
information connected one-hop away from a resource, regardless of the predicate
direction. Therefore, we consider here two variations, one obtained through a
full outer join (jWPT-outer) and an inner join (jWPT-inner) between the WPT
and iWPT. The schema of the WPT, iWPT, and jWPT, given an RDF-graph
with n distinct properties, is shown in Table 1.</p>
      <p>WPT iWPT jWPT
s p0 ... pn pn 1 ... p0 1 o pn 1 ... p0 1 r p0 ... pn</p>
      <p>Table 1: Schema of a WPT, iWPT, and jWPT.</p>
      <p>
        An example of how the abstract tree is generated on top of some of these
WPT extensions is provided in Figure 1. Input to our algorithm is the SPARQL
query (A) which results in the graph pattern illustrated in (B), and the set of
database designs where the operations can be executed. As the gure shows,
when only WPT is available (C) all on-subject patterns are grouped together,
while others are executed independently on the same table. When also the iWPT
is available, the same occurs with on-object joins, which are now grouped in one
leaf (D). Finally, the complete graph pattern is placed in a single leaf when the
jWPT is available (E).
We performed our tests on a small cluster of 10 machines, 1 master and 9
workers, connected via Gigabit Ethernet connection. Each machine is equipped with
32GB of memory, 4TB of disk space and with a 6 Core Intel Xeon E5-2420
processor. The cluster runs Cloudera CDH 5.10.0 with Spark 2.2 on Ubuntu 14.04.
Yarn, the resource manager, in total uses 198 GB and 108 virtual cores. The
tests were run with using a WatDiv dataset [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] with around 100M triples. In
Table 2 we show the approximate size and number of rows of the created tables.
The evaluation results are displayed in the graphs from Figure 2. We compare
the execution times of the queries using 4 di erent combinations of enabled data
models: WPT only (C1), WPT and iWPT (C2), jWPT-outer only (C3), and
WPT, iWPT and jWPT-inner (C4). We tried other combinations, such as
using VP with WPT variations, but we report only the combinations that led to
the best performance. The query set is evaluated 25 times in random orders.
We prune execution time outliers using the interquartile range (IQR) to set an
upper fence. Finally, the results are aggregated by the query shapes available in
Watdiv: complex (Wat-C), snow ake (Wat-F), linear (Wat-L), and star (Wat-S).
      </p>
      <p>The graph (A) in Figure 2 shows the average time when considering the entire
Watdiv benchmark query set. Since Watdiv is strongly biased towards queries
which only contain on-subject joins, we show in the graph (B) the performance
evaluation on a reduced Watdiv query set whose queries contain at least two
joins, one on a subject and one on an object, and excluding completely
linearshaped ones. This allows us to closely analyse the bene t of jWPT, which reduces
the number of Spark SQL join operations the most. We can observe from the
graphs that the combination of WPT and iWPT in C2 performs slightly worse
than WPT only (C1), except for complex queries, but the di erence is not very
signi cant. In the case of C3, jWPT-outer only, when considering the reduced
query set, there is an improvement over C1 and C2 for all query shapes but
the complex ones. Interestingly, the same does not occur when considering the
full query set. This can be attributed to the higher number of rows present in
the jWPT-outer. Finally, C4, the combination of WPT, iWPT and jWPT-inner,
resulted in the best performance for all query shapes, but the linear-shaped ones,
showing that further improvements can be made for the e cient evaluation of
this speci c type of query.</p>
      <p>Data model Size Tuples
WPT 1.1GB 5.2M
iWPT 1.2GB 9.7M
jWPT-outer 2.3GB 10.2M
jWPT-inner 1.8GB 4.7M
Table 2: Tables statistics.</p>
      <p>C1 C2 C3 C4
(A) full</p>
      <p>C1 C2 C3 C4</p>
      <p>(B) reduced
Wat-C Wat-F Wat-L Wat-S
at-C
W
at-F
W
at-S
W</p>
    </sec>
    <sec id="sec-3">
      <title>Conclusions and Future Work</title>
      <p>
        In this paper we show the bene t of extending WPTs with inverse properties.
Similar ideas can be found in a commercial system [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], which however are not
suitable for a computer cluster. Our experiments not only demonstrate the
applicability of our approach to leverage multiple designs from the same RDF-graph,
but it made it possible to extend the performance analysis to combinations which
were never tried before. The results show that the combination of three di erent
designs WPT, iWPT, jWPT-inner (C4) leads to the best performance for most
query types, while there is still room for improvement to process linear ones.
This indicates that when dealing with multiple designs there exists a trade-o
between the number of joins, and the number of rows in all involved tables.
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Aluc</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hartig</surname>
            ,
            <given-names>O.</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>O</given-names>
            zsu, M.T.,
            <surname>Daudjee</surname>
          </string-name>
          ,
          <string-name>
            <surname>K.</surname>
          </string-name>
          :
          <article-title>Diversi ed stress testing of RDF data management systems</article-title>
          .
          <source>In: ISWC</source>
          (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Ayala</surname>
            ,
            <given-names>V.A.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Koleva</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Alzogbi</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          , et al.:
          <article-title>Relational schemata for distributed SPARQL query processing</article-title>
          .
          <source>In: SBD@SIGMOD</source>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Bornea</surname>
            ,
            <given-names>M.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dolby</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kementsietsidis</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          , et al.:
          <article-title>Building an e cient RDF store over a relational database</article-title>
          .
          <source>In: SIGMOD</source>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Cossu</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          , Farber,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Lausen</surname>
          </string-name>
          , G.:
          <article-title>Prost: Distributed execution of SPARQL queries using mixed partitioning strategies</article-title>
          .
          <source>In: EDBT</source>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Graux</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jachiet</surname>
            ,
            <given-names>L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Geneves</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          , Layada, N.:
          <article-title>SPARQLGX: e cient distributed evaluation of SPARQL with apache spark</article-title>
          .
          <source>In: ISWC</source>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Hassan</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bansal</surname>
            ,
            <given-names>S.K.</given-names>
          </string-name>
          :
          <article-title>Data partitioning scheme for e cient distributed RDF querying using apache spark</article-title>
          .
          <source>In: ICSC</source>
          (
          <year>2019</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. Schatzle,
          <string-name>
            <given-names>A.</given-names>
            ,
            <surname>Przyjaciel-Zablocki</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Skilevic</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            ,
            <surname>Lausen</surname>
          </string-name>
          , G.:
          <article-title>S2RDF: RDF querying with SPARQL on spark</article-title>
          .
          <source>PVLDB</source>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>