<!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>OneQL: An Ontology-based Architecture to Efficiently Query Resources on the Semantic Web</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Tomas Lampo</string-name>
          <email>tomas@ldc.usb.ve</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Edna Ruckhaus</string-name>
          <email>ruckhaus@ldc.usb.ve</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Javier Sierra</string-name>
          <email>javier@ldc.usb.ve</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Mar´ıa-Esther Vidal</string-name>
          <email>mvidal@ldc.usb.ve</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Amad´ıs Mart´ınez</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Universidad Simo ́n Bol ́ıvar</institution>
          ,
          <addr-line>Caracas</addr-line>
          ,
          <country country="VE">Venezuela</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Universidad de Carabobo</institution>
          ,
          <addr-line>Valencia</addr-line>
          ,
          <country country="VE">Venezuela</country>
        </aff>
      </contrib-group>
      <fpage>65</fpage>
      <lpage>80</lpage>
      <abstract>
        <p>The widespread explosion of Web accessible resources has led to new problems on the traditional tasks of query evaluation and efficient data access. With this is mind, we have developed the ontology-based OneQL system which provides optimization and query evaluation techniques to scale up to large RDF/RDFS documents and complex queries, i.e., queries of any shape and with a large number of triple patterns. Efficiency of OneQL relies on the following components: - Query optimization and evaluation techniques that focus on cost models to estimate the execution time of a plan, and on searching the space of plans of any shape, i.e., bushy plans can be generated according to their estimated cost. - Bhyper: A directed hypergraph-based representation of RDF documents to directly access triples that share the same subject and property values, or the same property and object values. We report on the quality of the developed strategies, and have observed that implementing RDF documents with Bhyper and producing low estimated cost bushy plans, can speed up the evaluation time by up to four orders of magnitude.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>
        Emerging infrastructures such as the Semantic Web, the Semantic Grid and Service
Oriented architectures, support on-line access to a wealth of ontologies, data sources
and Web services. Ontologies play an important role in the Semantic Web and provide
the basis for the definition of concepts and relationships that make information
integration possible. Knowledge represented in ontologies can be used to annotate data,
distinguish similar concepts, and generalize and specialize concepts published by data
sources or produced by Web services. A great number of ontologies have become
available under the umbrella of the Semantic Web; some of these ontologies can be very
large, impacting in this way the tasks of ontology query answering and reasoning; for
instance, MeSH, NCI Cancer, and GO are good examples of ontologies comprised of
thousands of concepts. Furthermore, the number of available Web data sources and
services has exploded during the last few years. For example, currently, the
molecular biology databases collection includes 1,078 databases [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ], that is 110 more than
the previous year [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ]; tools and services as well as the number of instances published
by these resources, follow a similar progression [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. In addition, thanks to this wealth,
users rely more on various digital tasks such as data retrieval from public data sources
and data analysis with Web tools or services organized in complex workflows. Thus, in
order to be capable of scaling up, Web architectures have to be tailored for query
processing on large number of resources and instances. We have aimed at these problems,
and have proposed the OneQL system.
      </p>
      <p>
        OneQL is based on query optimization and evaluation techniques to efficiently
execute SPARQL queries. Ontologies are implemented as a deductive database whose
predicates represent knowledge explicitly expressed in the ontology, and the
semantics of the vocabulary terms. To efficiently store and index the RDF documents where
ontologies are defined, we have proposed a directed hypergraph formal model named
Bhyper. Basically, a Bhyper structure is defined by a set of nodes and a set of hyperarcs;
each hyperarc connects a set of source nodes to a set of target nodes. In a Bhyper
structure, the information is stored only in the nodes, and the hyperarcs preserve the role of
each node and the concept of direction of RDF graphs. Thus, each resource (subject,
property, or value) is stored only once, and the space complexity of an RDF document is
reduced if a resource appears several times in the document. Besides, Bhyper structures
define implicit position-based indices [
        <xref ref-type="bibr" rid="ref25">25</xref>
        ] for an RDF document, which can support
efficient evaluation of queries over the document.
      </p>
      <p>This paper is comprised of seven sections. The next section summarizes the related
work. In section 3 we briefly describe the OneQL system architecture. We then
discuss our research in query optimization and evaluation. Section 5 describes Bhyper,
a hypergraph-based representation for RDF documents. The experimental study is
reported in section 6, and finally, section 7 outlines our conclusions and future work.
2</p>
    </sec>
    <sec id="sec-2">
      <title>Related Work</title>
      <p>
        In the context of the Semantic Web, several query engines have been developed to
access RDF documents efficiently [
        <xref ref-type="bibr" rid="ref13 ref14 ref15 ref16 ref20 ref31 ref4">4, 13–16, 20, 31</xref>
        ]. Jena [
        <xref ref-type="bibr" rid="ref15 ref32">15, 32</xref>
        ] provides a
programmatic environment for SPARQL, and it includes the ARQ query engine and indices
which provide an efficient access to large datasets. The ARQ-Optimizer is a system that
implements heuristics for selectivity-based Basic Graph Pattern optimization, proposed
by Stocker et al. [
        <xref ref-type="bibr" rid="ref28">28</xref>
        ]. These heuristics range from simple triple pattern variable
counting to more sophisticated selectivity estimation techniques; the optimization process
is based on a greedy optimization algorithm which may explore a reduced portion of
the space of possible plans, i.e., only left linear plans. Hence, ARQ-Optimizer query
plans can sometimes be far from the optimal plans. Tuple Database or TDB [
        <xref ref-type="bibr" rid="ref16">16</xref>
        ] is a
persistent graph storage layer for Jena. TDB works with the Jena SPARQL query
engine (ARQ) to support SPARQL together with a number of extensions (e.g., property
functions, aggregates, arbitrary length property paths). It is a pure-Java component that
employs memory mapped I/O, and a customized implementation of B+-trees to index
three different triple patterns permutations, i.e., spo, pos, and osp.
      </p>
      <p>
        Sesame [
        <xref ref-type="bibr" rid="ref31">31</xref>
        ] is an open source Java framework for storage and querying RDF data.
It supports SPARQL and SeRQL queries which are translated to Prolog; the join
operator is implemented as sideways-passing of variable bindings, which is similar to our
Index Nested Loop Join (NJoin) operator. YARS2 (Yet Another RDF Store, Version
2) [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] is a federated repository for queries against indexed RDF documents. YARS2
supports three types of indices that enable keyword lookups, perform atomic lookup
operations on RDF documents, and speed up combinations of patterns or values.
Indices are implemented by using an in-memory sparse index data structure that refers
to on-disk block entries which contain the indexed entry; six combinations of triple
patterns are indexed. A general query processor on top of a distributed Index Manager
was implemented, and SPARQL queries are supported; however, no SPARQL specific
optimization or evaluation techniques have been developed.
      </p>
      <p>
        RDF-3X [
        <xref ref-type="bibr" rid="ref20">20</xref>
        ] focuses on an index system, and its optimization techniques were
developed to explore the space of plans that benefit from these index structures. RDF-3X
query optimizer implements a dynamic programming-based algorithm for plan
enumeration, which imposes restrictions on the size of queries that can be optimized and
evaluated. Indeed, in certain cases, these index-based plans could coincide with OneQL
optimized plans; however, the RDF-3X optimization strategies are not tailored to
identify any type of bushy plans or to scale up to queries with at least one Cartesian product.
      </p>
      <p>
        AllegroGraph [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] uses a native object store for on-disk binary tree-based storage of
RDF triples. AllegroGraph also maintains six indices to manage all the possible
permutations of subject (s), predicate (p) and object (o). The standard indexing strategy is to
build indices whenever there are more than a certain number of triples. The query
optimizer is based on join ordering for the generation of execution plans; no bushy plans
are generated. Hexastore [
        <xref ref-type="bibr" rid="ref30">30</xref>
        ] is a main memory indexing technique that uses the triple
nature of RDF as an asset. RDF data is also indexed in six possible ways, one for each
possible triple pattern permutation. However, the prime drawback of the Hexastore lies
in storage space usage; it may require a five-fold increase in storage space compared to
a triple table; also, the same resource can appear in multiple indices. Furthermore, two
second memory index-based representations and evaluation techniques are presented in
[
        <xref ref-type="bibr" rid="ref19 ref8">8, 19</xref>
        ]. [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] propose indexing the universe of RDF resource identifiers, regardless of
the role played by the resource; although they are able to reduce the storage costs of
RDF documents, since the proposed join implementations are not closed, the properties
of the index-based structures can only be exploited in joins on basic graph patterns. In
contrast, [
        <xref ref-type="bibr" rid="ref19">19</xref>
        ] propose an index-based representation for RDF documents that
maintains the results for subject-subject joins, object-object joins and subject-object joins.
Although these structures can speed up the evaluation of joins, this solution may not
scale up to strongly connected very large RDF graphs.
      </p>
      <p>
        GiaBATA [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] is a SPARQL engine built on top of the dlvhex reasoning engine
for HEX-programs, and the DLVDB [
        <xref ref-type="bibr" rid="ref29">29</xref>
        ] ASP solver with persistent storage. GiaBATA
does not implement an RDF-based cost model, but purely relies on join reordering
optimizations of DLV and optimizations of the underlying relational database system.
      </p>
      <p>
        Finally, [
        <xref ref-type="bibr" rid="ref1 ref2 ref27">1, 2, 27</xref>
        ] propose different RDF store schemas to implement an RDF
management system on top of a relational database system. They empirically show that a
physical implementation of vertically partitioned RDF tables, may outperform the
traditional physical schema of RDF tables. Similarly to some of the existing state-of-the-art
RDF systems, the optimization techniques are not tailored to identify bushy plans.
      </p>
    </sec>
    <sec id="sec-3">
      <title>Architecture</title>
    </sec>
    <sec id="sec-4">
      <title>Optimizing and Evaluating SPARQL queries</title>
      <p>OneQL implements optimization and evaluation techniques to support the execution of
SPARQL queries. The proposed optimization techniques are based on a cost model that
estimates the execution time or facts inferred during query evaluation; they are able to
produce query plans of any shape.</p>
      <p>
        The Query Planner component in OneQL (Figure 1) is built on top the following
two sub-components [
        <xref ref-type="bibr" rid="ref22 ref23 ref24">22–24</xref>
        ]: a hybrid cost model that estimates the cardinality and
evaluation cost of the predicates that represent the ontology’s explicit and implicit facts,
and a twofold optimization strategy to identify bushy plans. The Query Engine relies
on several physical operators and Bhyper-based indices to efficiently evaluate SPARQL
queries.
4.1
      </p>
      <sec id="sec-4-1">
        <title>The Hybrid Cost Model</title>
        <p>
          In the hybrid cost model, evaluation cost is measured in terms of the number of
intermediate inferred facts, and the cardinality corresponds to the number of valid answers of
the query pattern. This model estimates the cost and cardinality of explicit and implicit
facts, as follows:
– To estimate the cardinality and cost of the intensional predicates that represent
implicit facts, we have applied the Adaptive Sampling Technique [
          <xref ref-type="bibr" rid="ref17">17</xref>
          ]. This method
does not need to extract, store or maintain information about the data that satisfies
a particular predicate, and does not make any assumptions about statistical
characteristics of the data, such as distribution. Sampling stop conditions are defined to
ensure that the estimates are within an appropriate confidence level.
– To estimate the cardinality and cost of the extensional predicates, and the cost of
a query plan, we use a cost model a` la System R [
          <xref ref-type="bibr" rid="ref26">26</xref>
          ]. Similarly to System R, we
store information about the number of ground facts corresponding to an extensional
predicate, and the number of different values (constants) of each predicate variable.
Formulas for computing the cost and cardinality are similar to the different physical
join formulas in relational queries.
4.2
        </p>
      </sec>
      <sec id="sec-4-2">
        <title>The TwoFold Optimization Technique</title>
        <p>A twofold optimization strategy that combines cost-based optimization and Magic Sets
techniques was developed. In the first stage of the query optimization component,
dynamic-based or randomized algorithms can be applied to identify a good ordering or
grouping of the patterns in a SPARQL query. On one hand, the dynamic-programming
algorithm works on iterations, and during each iteration the best intermediate sub-plans
are chosen based on the cost and the cardinality that were estimated using the hybrid
cost model. In the last iteration of the algorithm, final plans are constructed and the
best plan is selected in terms of the estimated cost. This optimal ordering reflects the
minimization of the number of intermediate inferred facts using a top-down evaluation
strategy. This dynamic-based algorithm is performed on queries with a small number of
triple patterns in the where clause, and it is able to produce only left-linear plans which
are not always the best solution for RDF-based queries.</p>
        <p>On the other hand, the randomized algorithm performs random walks over the
search space of bushy execution plans; the query optimizer implements a Simulated
Annealing algorithm. Random walks are performed in stages, where each stage
consists of an initial plan generation step followed by one or more plan transformation
steps. An equilibrium condition or a number of iterations determines the number of
transformation steps. At the beginning of each stage, a query execution plan is
randomly created in the plan generation step. Then, successive plan transformations are
applied to the query execution plan during the plan transformation steps, in order to
obtain new plans. The probability of transforming a current plan p into a new plan p!
is specified by an acceptance probability function P(p, p!, T ), that depends on a global
time-varying parameter T called the temperature; it reflects the number of stages to be
executed. The function P may be nonzero when cost(p!) &gt; cost(p), meaning that the
optimizer can produce a new plan even when it is worse than the current one, i.e., it
has a higher cost. This feature prevents the optimizer from becoming stuck in a local
minimum. Temperature T is decreased during each stage and the optimizer concludes
when T = 0. Transformations applied to the plan during the random walks correspond
to the SPARQL axioms of the physical operators implemented by the query and
reasoning engine. The Simulated Annealing-based optimizer scales up to queries of any shape
and number of triple patterns, and is able to produce execution plans of any shape.</p>
        <p>
          In the second stage, the optimizer applies Magic Set optimization techniques [
          <xref ref-type="bibr" rid="ref21">21</xref>
          ]
to the execution plan obtained in the first stage. Magic Sets combines the benefits of
both, top-down and bottom-up evaluation strategies and tries to avoid repeated
computations of the same subgoals, and unnecessary inferences. The deductive database
program DOB is rewritten w.r.t. the optimal execution plan, and then evaluated with
a bottom-up strategy. “Magic predicates” are inserted into the program to represent
bounded arguments in the query, and “Supplementary predicates” are included to
represent sideways information-passing in rules. It should be noted that we implemented
the general Magic Sets technique for Datalog with the two improvements suggested
by [
          <xref ref-type="bibr" rid="ref3">3</xref>
          ] to eliminate the first and last redundant supplementary predicates, and to merge
consecutive sequences of extensional predicates in rule bodies.
4.3
        </p>
      </sec>
      <sec id="sec-4-3">
        <title>The OneQL Query Engine</title>
        <p>The query and reasoning engine implements different strategies (operators) used to
retrieve and combine ontology facts. We have defined different operators that implement
the retrieval and combination of ontology facts, and make use of the direct access
provided by the Bhyper-based structures:
1. Index Nested-Loop Join. For each matching triple in the first pattern, we retrieve
the matching triples in the second pattern, i.e., the join arguments3 are instantiated
in the second pattern through the sideways passing of variable bindings. The Index
Nested-Loop Join was implemented by extending the sideways-passing of
information inherent to Prolog rules, with Bhyper indices that allow a direct access to
3 The join arguments are the common variables in the two predicates that represent the patterns.
the inner pattern triples that match the join variable values of each outer pattern
triple; once a result is produced, the computation of the operator is forced to fail,
and backtracking takes place to produce a new answer.
2. Group Join. The main idea of this operator is to partition the patterns that appear
in the ’WHERE’ clause of a query into groups that are comprised of a relatively
small number of triples. The Group Join was implemented by first evaluating each
group independently, and then asserting in the SWI-Prolog main memory database
the results produced by each group; the main memory predicates used to temporally
store the results of each group, are indexed by using SWI-Prolog indices. Finally,
the main memory stored results are checked to identify matches. Similarly to the
Index Nested-Loop Join, the Group Join control is implemented by forcing the
computation of the operator to fail when a solution is produced, and using backtracking
to generate more solutions.</p>
        <p>voter</p>
        <p>voter
hasBallot
option
winner
title</p>
        <p>option
hasBallot
(a) Left-linear tree
hasBallot</p>
        <p>option
winner</p>
        <p>title
(b) Bushy tree</p>
        <p>option
hasBallot</p>
        <p>To illustrate the behavior of the proposed optimization and evaluation techniques,
consider the dataset that publishes the US Congress bills voting process 4. Suppose that
the following SPARQL query is posed against OneQL: Select all the bills and their title
where “Nay” was the winner, and at least one voter voted for the same option than the
voter L000174.</p>
        <p>PREFIX vote: &lt;tag:govshare.info,2005:rdf/vote/&gt;
PREFIX dc: &lt;http://purl.org/dc/elements/1.1/&gt;
PREFIX people:
&lt;http://www.rdfabout.com/rdf/usgov/congress/people/&gt;
SELECT ?E ?T FROM &lt;http://example.org/votes&gt;
WHERE {?E vote:winner ’Nay’ .</p>
        <p>?E dc:title ?T . ?E vote:hasBallot ?I .
?I vote:option ?X .?J vote:option ?X .
?E vote:hasBallot ?J .</p>
        <p>?J vote:voter ’people:L000174’}
4 http://www.govtrack.us/data/rdf/</p>
        <p>
          Following the optimization techniques reported in [
          <xref ref-type="bibr" rid="ref28">28</xref>
          ], only left linear plans as the
one reported in Figure 2(a) will be produced; for this left linear plan, the evaluation
time is 8,466 secs. On the other hand, our proposed optimization techniques are able to
produce bushy trees as the one reported in Figure 2(b) whose evaluation time is 122
secs, i.e., one order of magnitude cheaper than the left linear plan.
5
        </p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>Bhyper: A Hypergraph-based representation for RDF/RDFS</title>
      <p>
        documents
OneQL stores RDF triples using a directed hypergraph-based representation [
        <xref ref-type="bibr" rid="ref18">18</xref>
        ].
Basically, a directed hypergraph is defined by a set of nodes and a set of hyperarcs, each
one of them connecting a set of source nodes (named tail of the hyperarc) to a set of
target nodes (named head of the hyperarc). Directed hypergraphs have been
successfully used as a modeling tool to represent concepts and structures in many application
areas: formal languages, relational databases, production and manufacturing systems,
public transportation systems, topic maps, among others [
        <xref ref-type="bibr" rid="ref10 ref5 ref9">5, 9, 10</xref>
        ]. An RDF directed
hypergraph is defined as follows:
      </p>
      <p>Let D be an RDF document. We define a Bhyper RDF representation D as a tuple
H (D) = (W, E, ρ) such that:
– W = {w : w ∈ univ(D)} is the set of nodes.
– E = {ei : 1 ≤ i ≤ |D|} is the set of hyperarcs.
– ρ : W × E → {s, p, o} is the role function of nodes w.r.t. hyperarcs. Let t ∈ D be an
RDF triple, e ∈ E an hyperarc, and w ∈ W a node such that w ∈ head(e) ∪ tail(e).
Then the following must hold:
• (ρ(w, e) = s) ⇔ (w ∈ tail(e)) ∧ (w ∈ sub({t}))
• (ρ(w, e) = p) ⇔ (w ∈ tail(e)) ∧ (w ∈ pred({t}))
• (ρ(w, e) = o) ⇔ (w ∈ head(e)) ∧ (w ∈ ob j({t}))</p>
      <p>The Bhyper representation reduces space complexity to store the RDF document
and speeds up the data recovery process. To illustrate the benefits of the Bhyper-based
representation and the main drawbacks of the traditional graph-based representation,
we use some examples extracted from the US Congress bills voting process dataset.</p>
      <p>First, consider the RDF document D1 ={( :id0, type, Term), ( :id0, forOffice, AZ),
(AZ, type, Office), (Office, subClassOf, Organization), (Country, subClassOf,
Organization), (forOffice, range, Organization), (forOffice, domain, Term)}, where the resource
forOffice occurs as a predicate and a subject. This situation can be modeled by allowing
multiple occurrences of the same resource in the resulting labeled directed graph, as
arcs or nodes labels (Figure 3(a)). However, this violates one of the most important
aspects of graph theory: the intersection between the nodes and arcs labels must be
empty.</p>
      <p>
        Second, a predicate may relate other predicates in an RDF document. For example,
in the RDF document D2 = {(Rush, sponsor, HR45), ( :id1, supported, SJ37), (sponsor,
subPropertyOf, supported)} the predicate subPropertyOf relates the predicates sponsor
and supported. This situation can be modeled extending the notion of arc by allowing
the connection between arcs (Figure 3(b)). However, the resulting structure is not a
graph in the mathematical sense, because the set of arcs must be a subset of the
Cartesian product of the set of nodes. Since these two simple situations violate some of the
graph constraints, it is not possible to use concepts and search algorithms of graph
theory to manipulate RDF documents. Thus, while the labeled directed graph model is the
most widely used representation, it cannot be considered a formal model for RDF [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
(a) Multiple occurrences of the same
resource
(b) Extending Notion of Edge
We conducted an experimental study to empirically analyze the effectiveness of the
OneQL optimization and evaluation techniques. We report on the evaluation time
performance of bushy plans comprised of groups and identified by our proposed query
optimizer.
(a) Reducing Multiple occurrences of the
same resource
(b) Respecting Notion of Edge
Dataset and Query Benchmark: We use the real-world dataset on US Congress vote
results of the 2004 bills voting process described in Figure 5(b). The entire dataset
was downloaded and locally stored in flat files; the total size is 3.613 MB and
67,392 triples. We considered two sets of queries. Benchmark one is a set of nine
queries which are described in Figure 5(a) in terms of the number of patterns in
the WHERE clause and the answer size; all the queries have at least one pattern
whose object is instantiated with a constant. Benchmark two is a set of 60 queries
which have between one and seven GJoin(s) among small size groups of patterns
and have more than 12 triple patterns. These two benchmarks are published in
http:www.ldc.usb.ve/˜mvidal/OneQL/datasets.
      </p>
      <p>Evaluation Metrics: We report on runtime performance, which corresponds to the
user time produced by the time command of the Unix operation system. OneQL
was implemented in SWI-Prolog (Multi-threaded, 64 bits, Version 5.6.54). The
randomized optimizer was run for 20 iterations at an initial temperature of 700.
The experiments were evaluated on a Solaris machine with a Sparcv9 1281 MHz
processor and 16GB of RAM.
We studied the predictive capability of the OneQL hybrid cost model. We generated
190 different bushy tree plans for a query with four patterns (Figure 5(a)), and
computed the estimated evaluation time using the OneQL hybrid cost model. Additionally,
we executed the 190 plans in the OneQL query engine and measured the evaluation
time in terms of the total number of inferences. Figure 6 plots the actual versus the
estimated evaluation costs; we can observe a positive trend between the estimated and
actual cost, and a correlation between both costs of 0.76. Both results indicate that there
is a linear relation between the estimated and the actual costs, and they suggest that
the OneQL hybrid cost model is able to predict the runtime performance of the OneQL
query engine.</p>
      <p>Correlation Estimated Cost vs. Actual Cost
16000000</p>
      <p>150 200 250
Estimated Cost (Number of Triples Read)
300
350
400</p>
      <sec id="sec-5-1">
        <title>Effectiveness of the OneQL Optimization Techniques</title>
        <p>We studied the effectiveness of the OneQL optimization techniques by empirically
analyzing the quality of the optimized plans w.r.t. the rest of the plans of the corresponding
query, and the runtime performance of the optimized plans.</p>
        <p>To analyze the quality of the optimized plans, we generated all the plans for queries
in benchmark one with three and four patterns, and computed the percentile in which
the optimal plan falls. The average percentile is 97 and the lowest is 92. These results
indicate that the optimizer is able to identify execution plans that are at least better than
92% of the execution plans of the query.</p>
        <p>We also report on the runtime performance of the optimized queries. Figure 7
compares the number of inferred triples of the non-optimized and optimized versions of
benchmark one in logarithmic scale. In general, we can observe that the optimized
query has a significantly lower cost than the original query, speeding up the evaluation
time in some cases by more than one order of magnitude. Plans with the most
significant performance improvements correspond to bushy trees, and they are comprised of
Group joins with small size groups.</p>
      </sec>
      <sec id="sec-5-2">
        <title>Effectiveness of the OneQL Physical Operators</title>
        <p>We have conducted an empirical analysis on the benefits of the evaluation techniques
implemented on OneQL, and have executed 60 queries of benchmark two. Figure 8
compares the evaluation time (logarithmic scale) of the queries comprised of Group
Joins (GJoin) against queries with Index Nested Loop Joins (Njoin). We can observe
that the plans composed of GJoins overcome the Njoin plans by at least one order of
magnitude when the GJoins are comprised of small size groups and low join selectivity.
3.5
1GJoin
2GJoin</p>
        <p>3GJoin
OneQL Queries
4GJoin
5+Gjoin</p>
      </sec>
      <sec id="sec-5-3">
        <title>Effectiveness of the OneQL Bhyper-based representation</title>
      </sec>
      <sec id="sec-5-4">
        <title>Effectiveness of the OneQL Optimization and Evaluation Techniques</title>
        <p>Finally, we studied the benefits of the optimization and evaluation techniques
implemented by OneQL by empirically analyzing the quality of the OneQL optimized plans
w.r.t. the plans optimized by the RDF-3X query optimizer. Queries of benchmark one
were optimized by OneQL and RDF-3X and the generated plans were run in OneQL
with and without Bhyper indices. Each RDF-3X optimized plan was run using the GJoin
and NJoin operators to evaluate the groups in the bushy plans. Figure 10 reports the
evaluation time (logarithmic scale) of these combinations of queries. We can observe
that Bhyper-based representation is able to speed up the evaluation time of all the
versions of the queries comprised of instantiated triples. Second, the evaluation time of
the OneQL and RDF-3X optimized plans are competitive, except for queries q1 and
q6 where OneQL was able to identify plans where all the triples are instantiated, and
the most selective ones are evaluated first. These results indicate that the OneQL
optimization and evaluation techniques may be used in conjunction with the state-of-the-art</p>
        <p>Bhyper</p>
        <p>Non-Indexed
1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
q q q q q q q q q 1 1 1 1 1 1 1 1 1 1 2</p>
        <p>q q q q q q q q q q q</p>
        <p>OneQL Queries
techniques to provide more efficient query engines; they have encouraged us to develop
our physical operators in existing RDF engines. So far, we have implemented the GJoin
operator in the Jena engine, and we have observed in initial experiments that our GJoin
implementation outperforms the evaluation time by up to three orders of magnitude. In
the future, we also plan to implement these techniques in RDF-3X and conduct a more
exhaustive empirical study to corroborate the effects of the developed techniques.
7</p>
      </sec>
    </sec>
    <sec id="sec-6">
      <title>Conclusions</title>
      <p>We have presented the OneQL system for efficiently evaluating SPARQL queries. We
have addressed the challenges of scaling up to large RDF documents and complex
SPARQL queries. We report on the results of our optimization and evaluation
techniques for SPARQL queries. Then, we describe a Bhyper-based representation for RDF
documents that reduces the space and time complexity of the tasks of storing and
querying RDF documents. In the future, we plan to enhance the hybrid cost model with
Bayesian inference capabilities to consider correlations between the different patterns
that can appear in a SPARQL query; implement our operators in existing SPARQL
query engines; and finally, extend the set of physical operators to better exploit the
properties of the Bhyper-based representation.
8</p>
    </sec>
    <sec id="sec-7">
      <title>Acknowledgments</title>
      <p>This research has been partially supported by the DID-USB and the Proyecto ALMA
Mater-OPSU. The authors are very grateful to Eduardo Ruiz for his programming
support.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>D. J.</given-names>
            <surname>Abadi</surname>
          </string-name>
          ,
          <string-name>
            <surname>A. M.</surname>
          </string-name>
          <year>0002</year>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Madden</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K.</given-names>
            <surname>Hollenbach.</surname>
          </string-name>
          SW-Store:
          <article-title>a vertically partitioned DBMS for Semantic Web data management</article-title>
          .
          <source>VLDB J</source>
          .,
          <volume>18</volume>
          (
          <issue>2</issue>
          ):
          <fpage>385</fpage>
          -
          <lpage>406</lpage>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>D. J.</given-names>
            <surname>Abadi</surname>
          </string-name>
          ,
          <string-name>
            <surname>A. M.</surname>
          </string-name>
          <year>0002</year>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Madden</surname>
          </string-name>
          , and
          <string-name>
            <given-names>K. J.</given-names>
            <surname>Hollenbach</surname>
          </string-name>
          .
          <article-title>Scalable Semantic Web Data Management Using Vertical Partitioning</article-title>
          .
          <source>In VLDB</source>
          , pages
          <fpage>411</fpage>
          -
          <lpage>422</lpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>S.</given-names>
            <surname>Abiteboul</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Hull</surname>
          </string-name>
          , and
          <string-name>
            <given-names>V.</given-names>
            <surname>Vianu</surname>
          </string-name>
          . Foundations of Databases. Addison-Wesley Publishing Company,
          <year>1995</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>4. AllegroGraph. http://www.franz.com/agraph/allegrograph/.</mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>P.</given-names>
            <surname>Auillans</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>O. de Mendez</surname>
          </string-name>
          , P. Rosenstiehl, and
          <string-name>
            <given-names>B.</given-names>
            <surname>Vatant</surname>
          </string-name>
          .
          <article-title>A Formal Model for Topic Maps</article-title>
          .
          <source>In Proceedings of the Third International Semantic Web Conference (ISWC</source>
          <year>2004</year>
          ),
          <year>2002</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>G.</given-names>
            <surname>Benson. Editorial</surname>
          </string-name>
          .
          <source>Nucleic Acids Research</source>
          ,
          <volume>35</volume>
          (
          <string-name>
            <surname>Web-Server-Issue</surname>
          </string-name>
          ):
          <fpage>1</fpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>F.</given-names>
            <surname>Dau</surname>
          </string-name>
          .
          <article-title>RDF as Graph-Based, Diagrammatic Logic</article-title>
          .
          <source>In Proceedings of the 16th International Symposium on Methodologies for Intelligent Systems (ISMIS</source>
          <year>2006</year>
          ),
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>G.</given-names>
            <surname>Fletcher</surname>
          </string-name>
          and
          <string-name>
            <given-names>P.</given-names>
            <surname>Beck</surname>
          </string-name>
          .
          <article-title>Scalable Indexing of RDF Graph for Efficient Join Processing</article-title>
          .
          <source>In CIKM</source>
          ,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <given-names>G.</given-names>
            <surname>Gallo</surname>
          </string-name>
          , G. Longo,
          <string-name>
            <given-names>S.</given-names>
            <surname>Pallottino</surname>
          </string-name>
          , and
          <string-name>
            <given-names>S. V.</given-names>
            <surname>Nguyen</surname>
          </string-name>
          .
          <article-title>Directed Hypergraphs and Applications</article-title>
          .
          <source>In Discrete Applied Mathematics</source>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10. G. Gallo and
          <string-name>
            <given-names>M. G.</given-names>
            <surname>Scutella</surname>
          </string-name>
          .
          <article-title>Directed Hypergraphs as a Modelling Paradigm</article-title>
          .
          <source>In Tech. Rep. TR-99-02</source>
          , Universita di Pisa,
          <year>1999</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          11.
          <string-name>
            <given-names>M. Y.</given-names>
            <surname>Galperin</surname>
          </string-name>
          .
          <source>The Molecular Biology Database Collection: 2007 update. Nucleic Acids Res</source>
          ,
          <volume>35</volume>
          (Database issue),
          <year>January 2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          12.
          <string-name>
            <given-names>M. Y.</given-names>
            <surname>Galperin</surname>
          </string-name>
          .
          <source>The Molecular Biology Database Collection: 2008 update. Nucleic Acids Res</source>
          ,
          <volume>36</volume>
          (Database issue):
          <fpage>D2</fpage>
          -
          <lpage>D4</lpage>
          ,
          <year>Jan 2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          13.
          <string-name>
            <given-names>A.</given-names>
            <surname>Harth</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Umbrich</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Hogan</surname>
          </string-name>
          , and
          <string-name>
            <surname>S. Decker.</surname>
          </string-name>
          <article-title>YARS2: A Federated Repository for Querying Graph Structured Data from the Web</article-title>
          .
          <source>In ISWC/ASWC</source>
          , pages
          <fpage>211</fpage>
          -
          <lpage>224</lpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          14. G. Ianni,
          <string-name>
            <given-names>T.</given-names>
            <surname>Krennwallner</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Martello</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Polleres</surname>
          </string-name>
          .
          <article-title>A Rule System for Querying Persistent RDFS Data</article-title>
          .
          <source>In Proceedings of the 6th European Semantic Web Conference (ESWC2009)</source>
          , Heraklion, Greece, May
          <year>2009</year>
          . Springer. Demo Paper.
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          15.
          <article-title>The JenaOntology Api</article-title>
          . http://jena.sourceforge.net/ontology/index.html.
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          16.
          <string-name>
            <surname>Jena</surname>
            <given-names>TDB</given-names>
          </string-name>
          . http://jena.hpl.hp.com/wiki/TDB.
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          17.
          <string-name>
            <given-names>R.</given-names>
            <surname>Lipton</surname>
          </string-name>
          and
          <string-name>
            <given-names>J.</given-names>
            <surname>Naughton</surname>
          </string-name>
          .
          <article-title>Query Size estimation by adaptive sampling (extended abstract)</article-title>
          .
          <source>In Proceedings of SIGMOD</source>
          ,
          <year>1990</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          18.
          <string-name>
            <given-names>A.</given-names>
            <surname>Martinez</surname>
          </string-name>
          and
          <string-name>
            <given-names>M.</given-names>
            <surname>Vidal</surname>
          </string-name>
          .
          <article-title>A Directed Hypergraph Model for RDF</article-title>
          .
          <string-name>
            <surname>In</surname>
            <given-names>KWEPSY</given-names>
          </string-name>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          19.
          <string-name>
            <surname>J. McGlothlin</surname>
            and
            <given-names>L. Khan.</given-names>
          </string-name>
          <article-title>RDFJoin: A Scalable of Data Model for Persistence and Efficient Querying of RDF Dataasets</article-title>
          . In VLDB,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          20.
          <string-name>
            <given-names>T.</given-names>
            <surname>Neumann</surname>
          </string-name>
          and
          <string-name>
            <given-names>G.</given-names>
            <surname>Weikum. RDF-</surname>
          </string-name>
          <article-title>3X: a RISC-style engine for RDF</article-title>
          .
          <source>PVLDB</source>
          ,
          <volume>1</volume>
          (
          <issue>1</issue>
          ):
          <fpage>647</fpage>
          -
          <lpage>659</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          21.
          <string-name>
            <given-names>R.</given-names>
            <surname>Ramakrishnan</surname>
          </string-name>
          and
          <string-name>
            <given-names>J. D.</given-names>
            <surname>Ullman</surname>
          </string-name>
          .
          <article-title>A survey of research on deductive database systems</article-title>
          .
          <source>Journal of Logic Programming</source>
          ,
          <volume>23</volume>
          (
          <issue>2</issue>
          ):
          <fpage>125</fpage>
          -
          <lpage>149</lpage>
          ,
          <year>1993</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          22. E.
          <string-name>
            <surname>Ruckhaus</surname>
            , E. Ruiz, and
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Vidal</surname>
          </string-name>
          .
          <article-title>Query Evaluation and Optimization in the Semantic Web</article-title>
          .
          <source>In Proceedings ALPSWS2006: 2nd International Workshop on Applications of Logic Programming to the Semantic Web and Semantic Web Services</source>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          23. E.
          <string-name>
            <surname>Ruckhaus</surname>
            , E. Ruiz, and
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Vidal</surname>
          </string-name>
          .
          <article-title>OnEQL: An Ontology Efficient Query Language Engine for the Semantic Web</article-title>
          .
          <source>In Proceedings ALPSWS2007</source>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref24">
        <mixed-citation>
          24. E.
          <string-name>
            <surname>Ruckhaus</surname>
            , E. Ruiz, and
            <given-names>M.</given-names>
          </string-name>
          <string-name>
            <surname>Vidal</surname>
          </string-name>
          .
          <article-title>Query Evaluation and Optimization in the Semantic Web</article-title>
          . TPLP,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref25">
        <mixed-citation>
          25.
          <string-name>
            <given-names>R.</given-names>
            <surname>Sacks-Davis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>T. D. J. A.</given-names>
            <surname>Thom</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.</given-names>
            <surname>Zobel</surname>
          </string-name>
          .
          <article-title>Indexing documents for queries on structure, content, and attributes</article-title>
          .
          <source>In Proceedings of the International Conference on Digital Media Information Bases</source>
          ,
          <year>1997</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref26">
        <mixed-citation>
          26.
          <string-name>
            <given-names>P.</given-names>
            <surname>Selingerl</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Astrahan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Chamberlin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Lorie</surname>
          </string-name>
          , and
          <string-name>
            <given-names>T.</given-names>
            <surname>Price</surname>
          </string-name>
          .
          <article-title>Access Path Selection in a Relational Database Management System</article-title>
          .
          <source>Proceedings of ACM Sigmod</source>
          ,
          <year>1979</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref27">
        <mixed-citation>
          27. L.
          <string-name>
            <surname>Sidirourgos</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <string-name>
            <surname>Goncalves</surname>
            ,
            <given-names>M. L.</given-names>
          </string-name>
          <string-name>
            <surname>Kersten</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          <string-name>
            <surname>Nes</surname>
            , and
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Manegold</surname>
          </string-name>
          .
          <article-title>Column-store support for RDF data management: not all swans are white</article-title>
          .
          <source>PVLDB</source>
          ,
          <volume>1</volume>
          (
          <issue>2</issue>
          ):
          <fpage>1553</fpage>
          -
          <lpage>1563</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref28">
        <mixed-citation>
          28.
          <string-name>
            <surname>M. Stoker</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Seaborne</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          <string-name>
            <surname>Bernstein</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          <string-name>
            <surname>Keifer</surname>
            , and
            <given-names>D.</given-names>
          </string-name>
          <string-name>
            <surname>Reynolds. SPARQL Basic Graph Pattern Optimizatin Using Selectivity Estimation. In</surname>
            <given-names>WWW</given-names>
          </string-name>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref29">
        <mixed-citation>
          29. G. Terracina,
          <string-name>
            <given-names>N.</given-names>
            <surname>Leone</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Lio</surname>
          </string-name>
          , and
          <string-name>
            <given-names>C.</given-names>
            <surname>Panetta</surname>
          </string-name>
          .
          <article-title>Experimenting with recursive queries in database and logic programming systems</article-title>
          .
          <source>Theory Pract. Log. Program.</source>
          ,
          <volume>8</volume>
          (
          <issue>2</issue>
          ):
          <fpage>129</fpage>
          -
          <lpage>165</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref30">
        <mixed-citation>
          30.
          <string-name>
            <surname>C. Weiss</surname>
          </string-name>
          , P. Karras,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Bernstein</surname>
          </string-name>
          .
          <article-title>Hexastore: sextuple indexing for semantic web data management</article-title>
          .
          <source>PVLDB</source>
          ,
          <volume>1</volume>
          (
          <issue>1</issue>
          ):
          <fpage>1008</fpage>
          -
          <lpage>1019</lpage>
          ,
          <year>2008</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref31">
        <mixed-citation>
          31.
          <string-name>
            <given-names>J.</given-names>
            <surname>Wielemaker</surname>
          </string-name>
          .
          <article-title>An Optimised Semantic Web Query Language Implementation in Prolog</article-title>
          .
          <source>In ICLP</source>
          , pages
          <fpage>128</fpage>
          -
          <lpage>142</lpage>
          ,
          <year>2005</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref32">
        <mixed-citation>
          32.
          <string-name>
            <given-names>K.</given-names>
            <surname>Wilkinson</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Sayers</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Kuno</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Reynolds</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J.</given-names>
            <surname>Database</surname>
          </string-name>
          .
          <article-title>Efficient RDF Storage and Retrieval in Jena2</article-title>
          .
          <source>In EXPLOITING HYPERLINKS 349</source>
          , pages
          <fpage>35</fpage>
          -
          <lpage>43</lpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>