<!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>D3SPARQL: JavaScript library for visualization of SPARQL results</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Database Center for Life Science, Research Organization of Information and Systems</institution>
          ,
          <addr-line>178-4-4 Wakashiba, Kashiwa-shi, Chiba 277-0871</addr-line>
          ,
          <country country="JP">Japan</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Semantic Web technologies are being widely applied in life sciences. Major bioinformatics data centers started to provide heterogeneous biomedical datasets in RDF and expose them at SPARQL endpoints. SPARQL query is used to search those endpoints and the results are obtained as a SPARQL Query Results XML Format or a SPARQL Query Results JSON Format, both are essentially tabular structured data. To effectively represent the SPARQL results, appropriate visualization methods are highly demanded. To create and control dynamic graphical representation of data on the Web, the D3.js JavaScript library is getting popularity as a generic framework based on the widely accepted Web standards such as SVG, JavaScript, HTML5 and CSS. A variety of visualization examples implemented with the D3.js library is already available, however, each of them depends on assumed JSON data structure that differs from the JSON structure returned from SPARQL endpoints. Therefore, it is expected to largely reduce development costs of Semantic Web visualization if a JavaScript library is available which transforms SPARQL Query Results JSON Format into JSON data structures consumed by the D3.js. D3SPARQL is developed as a generic JavaScript library to fill this gap. D3SPARQL can be used to query SPARQL endpoints as an AJAX call and provides various callback functions to visualize the obtained results. Biological applications will be shown in this software demo along with our integrated semantic genome database, the TogoGenome application. The D3SPARQL library is freely available at https://github.com/ktym/d3sparql.</p>
      </abstract>
      <kwd-group>
        <kwd>Toshiaki Katayama1</kwd>
        <kwd>Semantic Web</kwd>
        <kwd>SPARQL</kwd>
        <kwd>JavaScript</kwd>
        <kwd>visualization</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        RDF data in life sciences including UniProt [1], Bio2RDF [2], wwPDB [
        <xref ref-type="bibr" rid="ref6">3</xref>
        ], EBI
RDF (BioModels, BioSamples, ChEMBL, Expression Atlas, Reactome) [4], NCBI
(PubChem) [5], GlycoRDF [6] and INSDC/DDBJ [7] have been published since
2008. Therefore, it is demanded to develop applications to effectively utilize those
semantic datasets so that end-users can benefit from integration of heterogeneous
biomedical data. RDF data is queried by the SPARQL query language and the results
will be returned as a SPARQL Query Results XML Format [8] or a SPARQL Query
Results JSON Format [9]. Both of those result formats contain a set of key-value pairs
and essentially are tabular structured data. Usually, the results are simply rendered as
a HTML table, however, it is more suitable to be visualized as a graph, tree, chart,
geographic map or other graphical representation depending on the nature of obtained
data in many cases.
      </p>
      <p>Because SPARQL uses HTTP as its application protocol and the result can be
obtained as a JSON object, the JavaScript language naturally fits for handling the data
on the Web. There are many JavaScript libraries have been developed to visualize
JSON data, among them, D3.js [10] is one of the most powerful library to manipulate,
visualize and control data and provides dynamic and interactive graphics on a Web
page based on the standard technologies including SVG, JavaScript, HTML5 and
CSS.</p>
      <p>However, the data structure of the SPARQL Query Results JSON Format is
different from the JSON format which existing D3.js implementations expect. The
D3.js library comes with several built-in algorithms (d3.layout) to calculate graphical
properties for typical visualizations. Thus, the purpose of this work, D3SPARQL, is
to transform a JSON data obtained from SPARQL endpoint into a data structure
accepted by those layout algorithms implemented in the D3.js.</p>
    </sec>
    <sec id="sec-2">
      <title>Results</title>
      <p>D3SPARQL is an open source library which can be embedded in any Web page,
performs a SPARQL query via AJAX call, transforms the result and visualizes data
with the help of D3.js library. For example, the following SPARQL query retrieves all
taxonomic subtrees of a given organism “Hypsibiidae” from the UniProt database.</p>
      <p>PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX up: &lt;http://purl.uniprot.org/core/&gt;
SELECT ?root_name ?parent_name ?child_name
WHERE
{
}</p>
      <p>VALUES ?root_name {"Hypsibiidae"}
?root up:scientificName ?root_name .
?child rdfs:subClassOf+ ?root .
?child rdfs:subClassOf ?parent .
?child up:scientificName ?child_name .</p>
      <p>?parent up:scientificName ?parent_name .</p>
      <p>The D3SPARQL makes an AJAX call against a given SPARQL endpoint via a
d3sparql.query function to retrieve the result in a SPARQL Query Results JSON
Format. Then, user can choose a visualization pattern such as a d3sparql.sunburst as a
callback function which internally calls a d3sparql.tree function to transform the
resulted JSON data into a tree structured JSON format (Fig. 1). Finally, an interactive
SVG image is generated and shown on a Web page (Fig. 2) in which any part of the
subtree is clickable to zoom in.</p>
      <p>D3SPARQL: JavaScript library for visualization of SPARQL results
Visualization patterns currently implemented in the D3SPARQL library are given
in Table 1. Our integrated semantic genome database, TogoGenome [10], partly uses
the library as a biological application which will also be shown in the software demo
session.</p>
      <p>Fig. 2. Example of a d3sparql.sunburst visualization of the SPARQL result showing a
species tree under the selected organism “Hypsibiidae” from the UniProt database</p>
    </sec>
    <sec id="sec-3">
      <title>Discussions References</title>
      <p>Type
Bar chart, Pie chart, Scatter plot
Force graph, Sankey graph
Round tree, Dendrogram, Treemap, Sunburst, Circlepack
Geographic map</p>
      <p>HTML table</p>
      <p>Even though the D3SPARQL itself is a generic JavaScript library for any SPARQL
endpoints, there are many cases where the library can accelerate development of life
science applications. It is planned to implement more biological visualizations to
utilize biomedical semantic Web resources in the future.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <source>Nucleic Acids Res</source>
          .
          <volume>42</volume>
          ,
          <issue>D191</issue>
          -
          <fpage>8</fpage>
          (
          <year>2014</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <surname>Callahan</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cruz-Toledo</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ansell</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Dumontier</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <source>The Semantic Web: Semantics and Big Data</source>
          . Springer Berlin Heidelberg, Berlin, Heidelberg (
          <year>2013</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <string-name>
            <surname>Kinjo</surname>
            ,
            <given-names>A.R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Suzuki</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Yamashita</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ikegawa</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kudou</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Igarashi</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kengaku</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Cho</surname>
            ,
            <given-names>H.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Standley</surname>
            ,
            <given-names>D.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nakagawa</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nakamura</surname>
          </string-name>
          , H.:
          <article-title>Protein Data Bank Japan (PDBj): maintaining a structural data archive and resource description framework format</article-title>
          .
          <source>Nucleic Acids Res</source>
          .
          <volume>40</volume>
          ,
          <fpage>D453</fpage>
          -
          <lpage>60</lpage>
          (
          <year>2012</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <surname>SPARQL Query Results XML Format</surname>
          </string-name>
          , http://www.w3.org/TR/rdf-sparqlXMLres/.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <surname>SPARQL Query Results JSON Format</surname>
          </string-name>
          , http://www.w3.org/TR/sparql11- results-json/.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>D3.js, http://d3js.org/.</mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>