<!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>Expressive Languages for Querying the Semantic Web</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Marcelo Arenas</string-name>
          <email>marenas@ing.puc.cl</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Georg Gottlob</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andreas Pieris</string-name>
          <email>andreas.pierisg@cs.ox.ac.uk</email>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Department of Computer Science</institution>
          ,
          <addr-line>PUC Chile</addr-line>
          ,
          <country country="CL">Chile</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Department of Computer Science, University of Oxford</institution>
          ,
          <country country="UK">UK</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The Resource Description Framework (RDF) is the W3C recommendation data model to represent information about World Wide Web resources. An atomic piece of data in RDF is a Uniform Resource Identifier (URI). In the RDF data model, URIs are organized as RDF graphs, that is, labeled directed graphs where node labels and edge labels are URIs. The problem of querying RDF data is a central issue for the development of the Semantic Web. The query language SPARQL has become the standard language for querying RDF, since its standardization in 2008 [8]. However, the 2008 version of this language missed some important functionalities, and in particular, reasoning capabilities to deal with RDF Schema (RDFS) [2] and Ontology Web Language (OWL) [6] vocabularies, that is, vocabularies with predefined semantics which can be used to derive logical conclusions from RDF graphs. To overcome these limitations, a new version of SPARQL, called SPARQL 1.1 [5], was recently released, which includes entailment regimes for RDFS and OWL vocabularies. Unfortunately, even if we focus on a lightweight profile of OWL 2 such as OWL 2 QL, the queries may become extremely complicated. This is mainly due to the fact that we are forced to encode the semantics of the RDFS and OWL vocabularies in the query. The aim of this work is to propose a language which separates the reasoning part from the actual query, and thus overcoming the above negative aspect of the existing query languages. Our language, called TriQ, is based on Datalog and some of its extensions; in particular, the members of the recently introduced Datalog family of knowledge representation and query languages [3]. In the rest of this short paper, we illustrate, via a simple example, some of the difficulties encountered when querying RDF data with SPARQL, which motivated us to design TriQ.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>We use here the algebraic syntax for SPARQL introduced in [7]. Notice that variables
start with the symbol ?. As mentioned above, one of the distinctive features of Semantic
Web data is the use of the RDFS and OWL vocabularies. As an example of this, assume
that G2 is an RDF graph consisting of the following triples:
In G2, the URIs with prefix rdfs: are part of the RDFS vocabulary, while the URIs
with prefix owl: are part of the OWL vocabulary. More precisely, the third triple above
indicates that the object with URI dbAho is a coauthor of the object with URI dbUllman.
The fifth, sixth and seventh triples of G2 define r1 as the class of URIs a for which there
exists a URI b such that (a; is coauthor of; b) holds, while the following three triples
of this graph define r2 as the class of URIs a for which there exists a URI b such that
the triple (a; is author of; b) holds. Finally, the last triple of G2 indicates that r1 is a
subclass of r2.</p>
      <p>
        The last seven triples of G2 indicate that for every pair a, b of elements such that
(a; is coauthor of; b) holds, it must be the case that a is an author of some publication.
Thus, if we want to retrieve the list of authors mentioned in G2, then we expect to find
dbAho in this list. However, the answer to the SPARQL query (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) over G2 does not
include this URI, and we are forced to encode the semantics of the RDFS and OWL
vocabularies in the query. In fact, even if we try to obtain the right answer by using
SPARQL 1.1 under the entailment regimes for these vocabularies, we are forced by the
restrictions of the language [4] to replace the triple (?Y; is author of; ?Z) in (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) by:
(?Y; rdf:type; ?Z) AND
(?Z; rdf:type; owl:Restriction) AND
(?Z; owl:onProperty; is author of) AND
(?Z; owl:someValuesFrom; owl:Thing);
which indicates that we are looking for the objects that are authors of some publication
(that is, the objects of type r2).
      </p>
      <p>
        As the reader may have noticed, the resulting query is very complicated. In the query
language proposed in this paper, the user can use separate modules to encode reasoning
capabilities and actual queries. In particular, the user first needs to utilise a module for
the RDFS and OWL vocabularies (or for some fragment of them), that could consist of
Datalog9;:;? rules such as the following:
triple(?X; rdf:type; ?Y );
triple(?Y; rdf:type; owl:Restriction);
triple(?Y; owl:onProperty; ?Z);
triple(?Y; owl:someValuesFrom; ?U ) ! 9?W triple(?X; ?Z; ?W ):
In this module, the predicate triple is used to store the triples of the RDF graphs. Notice
that the rules of the module are used to encode the semantics of the respective
vocabulary. Besides, these rules are fixed, they do not depend on the query that the user is
trying to answer. Thus, to pose the desired query, the user just need to write on top of
this module a simple query similar to (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ):
triple(?Y; is author of; ?Z); triple(?Y; name; ?X) ! query(?X):
(
        <xref ref-type="bibr" rid="ref3">3</xref>
        )
In particular, (s)he does not need any prior knowledge about the semantics and inference
rules for the respective vocabulary. In fact, the module for encoding this vocabulary can
be publicly available, thus greatly simplifying the process of writing queries.
      </p>
      <p>The modular structure of TriQ queries is very convenient to deal with SPARQL
queries over the OWL vocabulary. In fact, if we focus on the OWL 2 QL profile of
OWL 2, that is designed to be used in applications where query answering is the most
important reasoning task, then it can be shown that every SPARQL query under the
entailment regime for OWL 2 QL can be naturally translated into a TriQ query. Moreover,
we can show that the use of TriQ allows us to formulate SPARQL queries in a simpler
way, as a more natural entailment regime can be easily defined by using this query
language. For more details about the TriQ language, we refer the interested reader to [1].</p>
      <p>Acknowledgements. M. Arenas was supported by the Millennium Nucleus Center
for Semantic Web Research under Grant NC120004 and Fondecyt grant 1131049, G.
Gottlob was supported by ERC grant 246858 (DIADEM), and A. Pieris was supported
by EPSRC grant EP/J008346/1 (PrOQAW).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>M.</given-names>
            <surname>Arenas</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Gottlob, and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Pieris</surname>
          </string-name>
          .
          <article-title>Expressive languages for querying the semantic web</article-title>
          .
          <source>In Proc. of PODS</source>
          ,
          <year>2014</year>
          . To appear.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>D.</given-names>
            <surname>Brickley</surname>
          </string-name>
          and
          <string-name>
            <given-names>R.</given-names>
            <surname>Guha</surname>
          </string-name>
          .
          <article-title>RDF vocabulary description language 1.0: RDF schema</article-title>
          .
          <source>W3C Recommendation 10 February</source>
          <year>2004</year>
          , http://www.w3.org/TR/rdf-schema.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3. A. Cal`ı, G. Gottlob,
          <string-name>
            <given-names>T.</given-names>
            <surname>Lukasiewicz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Marnette</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Pieris</surname>
          </string-name>
          . Datalog+/
          <article-title>-: A family of logical knowledge representation and query languages for new applications</article-title>
          .
          <source>In Proc. of LICS</source>
          , pages
          <fpage>228</fpage>
          -
          <lpage>242</lpage>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>B.</given-names>
            <surname>Glimm</surname>
          </string-name>
          and
          <string-name>
            <given-names>C.</given-names>
            <surname>Ogbuji</surname>
          </string-name>
          .
          <source>SPARQL 1</source>
          .
          <article-title>1 entailment regimes</article-title>
          .
          <source>W3C Recommendation 21 March</source>
          <year>2013</year>
          , http://www.w3.org/TR/sparql11-entailment/.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>S.</given-names>
            <surname>Harris</surname>
          </string-name>
          and
          <string-name>
            <given-names>A.</given-names>
            <surname>Seaborne</surname>
          </string-name>
          .
          <source>SPARQL 1</source>
          .
          <article-title>1 query language</article-title>
          .
          <source>W3C Recommendation 21 March</source>
          <year>2013</year>
          , http://www.w3.org/TR/sparql11-query/.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>D. L.</given-names>
            <surname>McGuinness</surname>
          </string-name>
          and
          <string-name>
            <surname>F. van Harmelen. OWL</surname>
          </string-name>
          <article-title>web ontology language overview</article-title>
          .
          <source>W3C Recommendation 10 February</source>
          <year>2004</year>
          , http://www.w3.org/TR/owl-features/.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7. J. Pe´rez, M. Arenas, and
          <string-name>
            <given-names>C.</given-names>
            <surname>Gutierrez</surname>
          </string-name>
          .
          <article-title>Semantics and complexity of sparql</article-title>
          .
          <source>ACM Trans. Database Syst</source>
          .,
          <volume>34</volume>
          (
          <issue>3</issue>
          ),
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>E.</given-names>
            <surname>Prud</surname>
          </string-name>
          <article-title>'hommeaux and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Seaborne</surname>
          </string-name>
          .
          <article-title>SPARQL query language for RDF</article-title>
          .
          <source>W3C Recommendation 15 January</source>
          <year>2008</year>
          , http://www.w3.org/TR/rdf-sparql-query.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>