<!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>SWEEP: a Streaming Web Service to Deduce Basic Graph Patterns from Triple Pattern Fragments</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Emmanuel Desmontils</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Patricia Serrano-Alvarado</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Pascal Molli</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>LS2N Laboratory - Université de Nantes -</institution>
          <country country="FR">France</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>The Triple Pattern Fragments (TPF) interface demonstrates how it is possible to publish Linked Data at low-cost while preserving data availability. But, data providers hosting TPF servers are not able to analyze the SPARQL queries they execute because they only receive and evaluate subqueries with one triple pattern. Understanding the executed SPARQL queries is important for data providers for prefetching, benchmarking, auditing, etc. We propose SWEEP, a streaming web service that deduces Basic Graph Patterns (BGPs) of SPARQL queries from a TPF server log. We show that SWEEP is capable of extracting BGPs of SPARQL queries evaluated by a DBpedia's TPF server.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        The Triple Pattern Fragments (TPF) interface demonstrates how it is possible to
publish Linked Data at low-cost while preserving data availability [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. However,
data providers hosting TPF servers are not able to analyze the SPARQL queries
executed by their clients because they only receive single triple pattern queries.
      </p>
      <p>
        Understanding the executed SPARQL queries is fundamental for data
providers. Mining logs of SPARQL endpoints allows to detect recurrent patterns in
queries for prefetching [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], benchmarking [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], auditing [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ], etc. It provides the
type of queries issued, the complexity and the used resources [
        <xref ref-type="bibr" rid="ref2 ref6">2,6</xref>
        ]. Such analysis
cannot be done on logs of TPF servers because they only contain information
about single triple patterns. A Basic Graph Pattern (BGP) of a SPARQL query,
that is a set of conjunctive graph patterns, is scattered over the log.
      </p>
      <p>
        [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ] reported statistics from the logs of the DBpedia’s TPF server. However,
statistics only concern single triple pattern queries and not BGPs. In
previous work [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ], we proposed an algorithm to extract BGPs of federated SPARQL
queries from logs of a federation of SPARQL endpoints. Here, we address a
similar scientific problem but in the context of a single TPF server.
      </p>
      <p>In this demonstration, we present SWEEP, a streaming web service that is
able to extract BGPs from logs of TPF servers in real-time. From the stream of
single triple pattern queries of a TPF server, SWEEP is capable of extracting
BGPs. This allows data providers running TPF servers to better know how
their data are used. The demonstration highlights the performances of SWEEP
in terms of precision and recall.</p>
    </sec>
    <sec id="sec-2">
      <title>Motivating example</title>
      <p>In Figure 1, two clients, c1 and c2, execute concurrently queries Q1 and Q2
over the DBpedia’s TPF server. Q1 asks for movies starring Brad Pitt and Q2
for movies starring Natalie Portman.1 Both queries have one BGP composed of
several triple patterns (tpn).</p>
      <p>c1(173.28.19.114) : Query Q1
SELECT ?movie ?title ?name WHERE {
?movie dbpedia-owl:starring ?actor .
?actor rdfs:label "Brad Pitt"@en .
?movie rdfs:label ?title .
?movie dbpedia-owl:director ?director .
?director rdfs:label ?name
FILTER LANGMATCHES(LANG(?title), "EN")
FILTER LANGMATCHES(LANG(?name), "EN") }
?predicate = rdfs : label
&amp; ?object = “Brad P itt”@en . . .</p>
      <p>(tp1)
(tp2)
(tp3)
(tp4)
(tp5)</p>
      <p>c2(173.28.19.114) : Query Q2
SELECT ?titleEng ?title WHERE {
?movie dbpprop : starring ?actor .
?actor rdfs : label ”Natalie P ortman”@en .
?movie rdfs : label ?titleEng .
?movie rdfs : label ?title
FILTER LANGMATCHES(LANG(?titleEng), "EN")
FILTER (!LANGMATCHES(LANG(?title), "EN"))
(tp01)
(tp02)
(tp03)
(tp04)</p>
      <p>}
?predicate = rdfs : label
&amp; ?object = “Natalie P ortman”@en . . .</p>
      <p>DBpedia’s TPF server</p>
      <p>The TPF client decomposes the SPARQL queries into a sequence of triple
pattern queries partially presented in Table 1. The odd-numbered lines represent
received triple pattern queries and the even-numbered ones represent sent triples
after evaluation on the RDF graph. Lines 1 and 3, correspond to triple pattern
queries for tp2 and tp1 of Q1.2 We can observe that the object in Line 3, comes
from a mapping seen in Line 2. This injection of a mapping obtained from a
previous triple pattern query, is clearly a bind join from tp2 towards tp1.</p>
      <p>As the TPF server only sees triple pattern queries, the original queries are
unknown to the data provider. In this work, we address the following research
question: Can we extract BGPs from a TPF server log?</p>
      <p>
        The main challenge is to distinguish similar queries, that is queries whose
triple patterns are the same for the TPF server as tp1 vs tp01. In our example,
we aim to extract two BGPs from the TPF server log, one corresponding to
Q1, BGP[
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]= {tp1.tp2.tp3.tp4.tp5} and another corresponding to Q2, BGP[
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]=
{tp01.tp02.tp03.tp04}.
1 These queries come from http://client.linkeddatafragments.org/.
2 TPF clients always rename variables as "subject" or "object", regardless of how they
are named in the original query.
      </p>
    </sec>
    <sec id="sec-3">
      <title>SWEEP</title>
      <p>SWEEP uses a TPF server log, as the one of Table 1, composed of an unlimited
ordered sequence of execution traces organized by IP-address. It considers a
fixed-size window sliding over the TPF server log. Window size can depend on
the memory available for the streamed log or on the average of known values
used as timeout by TPF clients.</p>
      <p>We consider a set G of deduced BPGs. Each time a triple pattern query (tpqi)
arrives, SWEEP creates a new BP Gj 2 G or updates an existing one.</p>
      <p>Suppose G is empty and SWEEP receives tpq1 ={?s p2 toto} where ?s
produces 2 mappings: {c1, c2}. As G is empty, SWEEP creates BGP1 containing
tpq1 with the current time as timestamp, BGP1.ts = time().</p>
      <p>Then, if tpq2 ={c1 p1 ?o} arrives, as c1 appears in mappings of a BGPj 2
G, SWEEP detects a bind join. This implies updating BGP1 with the join
{?s p2 toto . ?s p1 ?o}. If tpq3 = {c2 p1 ?o} arrives, as it is already
represented in BGP1, nothing is done.</p>
      <p>If BGP1 is out the window, i.e., time() BGP1.ts &gt; window, then it must
no longer be updated; it is delivered and removed from the stream.</p>
      <p>We run SWEEP with queries proposed by the TPF web client (http://
client.linkeddatafragments.org/). From 21 queries executed, we obtained
100% of precision and 87% of recall of deduced BGPs when compared to the
BGPs of corresponding original queries. SWEEP succeeds in this case because
these queries are note very similar. Different precision and recall would be
produced with a more challenging set of queries.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Demo</title>
    </sec>
    <sec id="sec-5">
      <title>Conclusion and perspectives</title>
      <p>SWEEP demonstrates how it is possible to deduce the BGPs executed by a TPF
server. This allows data providers to have a better understanding of the usage
of their data.</p>
      <p>With SWEEP it would be possible to detect whether clients are executing
federated queries over multiple datasets hosted by one TPF server. And if
multiple data providers agree on streaming their logs to a shared SWEEP service, they
would be able to detect federated queries executed over multiple TPF servers.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>J.</given-names>
            <surname>Lorey</surname>
          </string-name>
          and
          <string-name>
            <given-names>F.</given-names>
            <surname>Naumann</surname>
          </string-name>
          .
          <article-title>Detecting SPARQL Query Templates for Data Prefetching</article-title>
          .
          <source>In ESWC Conference</source>
          ,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>K.</given-names>
            <surname>Möller</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Hausenblas</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Cyganiak</surname>
          </string-name>
          , G. Grimnes, and
          <string-name>
            <given-names>S.</given-names>
            <surname>Handschuh</surname>
          </string-name>
          .
          <article-title>Learning from Linked Open Data Usage: Patterns &amp; Metrics</article-title>
          . In
          <source>WebSci10:Extending the Frontiers of Society On-Line</source>
          ,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>M.</given-names>
            <surname>Morsey</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Lehmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Auer</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.-C. N.</given-names>
            <surname>Ngomo. DBpedia SPARQL</surname>
          </string-name>
          <article-title>Benchmark-Performance Assessment with Real Queries on Real Data</article-title>
          .
          <source>In ISWC Conference</source>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>S. U.</given-names>
            <surname>Nabar</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B.</given-names>
            <surname>Marthi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Kenthapadi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Mishra</surname>
          </string-name>
          , and
          <string-name>
            <given-names>R.</given-names>
            <surname>Motwani</surname>
          </string-name>
          .
          <article-title>Towards Robustness in Query Auditing</article-title>
          .
          <source>In VLDB Conference</source>
          ,
          <year>2006</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>G.</given-names>
            <surname>Nassopoulos</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Serrano-Alvarado</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Molli</surname>
          </string-name>
          , and
          <string-name>
            <surname>E. Desmontils. FETA</surname>
          </string-name>
          :
          <article-title>Federated QuEry TrAcking for Linked Data</article-title>
          .
          <source>In DEXA Conference</source>
          ,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>F.</given-names>
            <surname>Picalausa</surname>
          </string-name>
          and
          <string-name>
            <given-names>S.</given-names>
            <surname>Vansummeren</surname>
          </string-name>
          .
          <article-title>What are Real SPARQL Queries Like</article-title>
          ? In SWIM Workshop,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>R.</given-names>
            <surname>Verborgh</surname>
          </string-name>
          , E. Mannens, and R. Van de Walle.
          <article-title>Initial Usage Analysis of DBpedia's Triple Pattern Fragments</article-title>
          .
          <source>In USEWOD Workshop</source>
          ,
          <year>2015</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>R.</given-names>
            <surname>Verborgh</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. Vander</given-names>
            <surname>Sande</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Hartig</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. Van Herwegen</given-names>
            ,
            <surname>L. De Vocht</surname>
          </string-name>
          , B. De Meester, G. Haesendonck, and
          <string-name>
            <given-names>P.</given-names>
            <surname>Colpaert. Triple Pattern</surname>
          </string-name>
          <article-title>Fragments: a Low-cost Knowledge Graph Interface for the Web</article-title>
          .
          <source>Journal of Web Semantics</source>
          ,
          <fpage>37</fpage>
          -
          <lpage>38</lpage>
          , Mar.
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>