<!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>SQID: Towards Ontological Reasoning for Wikidata</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Maximilian Marx</string-name>
          <email>maximilian.marx@tu-dresden.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Markus Krötzsch</string-name>
          <email>markus.kroetzsch@tu-dresden.de</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Center for Advancing Electronics Dresden (cfaed), TU Dresden</institution>
          ,
          <addr-line>Dresden</addr-line>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>
        Modern data management has re-discovered the power and flexibility of graph-based
representation formats, and so-called knowledge graphs are now used in many practical
applications. The term originates from the Google Knowledge Graph [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], which uses a
graph-structured knowledge base to deliver answers in Web search, but it has since been
generalised to a wide range of applications not only at Google, Microsoft, and Facebook,
but also in many other companies that employ graph databases. Large, freely avialable
knowledge graphs include Bio2RDF [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], Freebase [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], Wikidata [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], and YAGO2 [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>Knowledge graphs appear as an ideal application for semantic web technologies,
which support declarative data management and knowledge modelling. Indeed, we find
some use of RDF (e.g., in Bio2RDF) and SPARQL (e.g., in Wikidata’s popular query
service), but a significant part of applications relies on ad hoc data models and tool
chains. At best, some projects rely on shared libraries such as Apache Tinkerpop to
establish some compatibility. Ontological modelling is hardly used at all.</p>
      <p>
        It has been argued that this is in part due to a mismatch between the capabilities of
RDF (and, based on it, OWL) and the demands of knowledge graphs [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. In particular,
most applications require some form of enriched graph model, where edges are extended
with annotations, used to capture many forms of auxiliary information that don’t quite fit
into the highly normalised graph model. Even RDF-based projects such as Bio2RDF use
reification to express more complex, n-ary relationships, and it has been observed that
this makes it impossible to use common ontology languages on such datasets [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ].
      </p>
      <p>
        In several recent works, we have therefore proposed more flexible ontology languages
for knowledge graphs, based on the concept of attributed logics [
        <xref ref-type="bibr" rid="ref6 ref8">8,6</xref>
        ]. In this demonstration,
we present a prototype for applying ontological reasoning with attributed logics to the
Wikidata knowledge graph. We are facing the familiar “chicken or egg” problem: while
attributed logics are a promising new ontology language, there is currently neither tool
support (ontology reasoners, editors, file formats, parsers, . . . ) nor any data (actual
ontologies) to motivate the development of such tools. To break this deadlock, we propose
a lightweight approach that incentivises users to create ontological rules by providing
useful examples and some (incomplete) reasoning support. These features are integrated
into our Wikidata ontology and data browser and editor SQID, which has many useful
features that are unrelated to its inferencing capabilities.
      </p>
      <p>We envision that ontological reasoning will be of great utility for quality control on
Wikidata, e.g., by ensuring that property constraints such as symmetry are maintained,
and look forward to see interesting ontological axioms being created by users of Wikidata.</p>
    </sec>
    <sec id="sec-2">
      <title>SQID: A Browser and Editor for Wikidata</title>
      <p>
        Wikidata is a sister project of Wikipedia that manages factual data used in Wikipedia or
any other Wikimedia project [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]. As of July 2017, Wikidata stores information about
almost 29 million entities,1 and has received contributions from over 175,000 registered
contributors. Content from Wikidata is widely used in other applications and on the
Web, ranging from interactive query views on specific subjects (e.g., the Academy
Awards portal of the major German newspaper FAZ online2) to general purpose question
answering tools (e.g., Apple’s Siri search engine in iOS 11 beta returns data from
Wikidata3).
      </p>
      <p>Direct read/write access to raw Wikidata content is provided through Wikidata’s web
interface, using a very simple, general-purpose layout. For a more visually attractive
view, we have created the SQID data browser,4 a screenshot of which is shown in Fig. 1.
This example also illustrates the enriched graph structure of Wikidata. We find, e.g., the
statement that Obama’s spouse is Michelle Obama (easily expressed in RDF), enriched
with annotations for start time and place of marriage (not so easily expressed in RDF).
In general, Wikidata allows arbitrary finite sets of attribute-value pairs to be used for
annotating statements.</p>
      <p>SQID is implemented as a browser application that integrates data obtained from
Wikidata’s live SPARQL query service (https://query.wikidata.org), full data dumps
analysed offline, Wikidata’s Web API, and other Wikimedia sources (e.g., for images).
The basic data view already displays incoming relations (under “From related entities” in
the figure) to improve browsing. In addition, SQID features class and property browsers,
and query views that show larger lists of SPARQL results. Logged-in users moreover are
offered some basic editing capabilities, e.g., for labels. We have extended this with the
1 This should be compared to the 5.5 million articles found in English Wikipedia.
2
http://www.faz.net/aktuell/feuilleton/kino/academy-awards-die-oscar-gewinner-aufeinen-blick-12820119.html
3 https://lists.wikimedia.org/pipermail/wikidata/2017-July/010919.html
4 https://tools.wmflabs.org/sqid/
ability to suggest new statements (via inferencing) that a logged-in user may approve to
store them permanently in Wikidata.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Ontological Reasoning for Wikidata</title>
      <p>
        We encode ontological knowledge using a notational variant of the recently-proposed
rule language MARPL [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. MARPL rules correspond to logical implications, where rule
bodies are conjunctions of atomic conditions that refer to statements in a knowledge
graph, including their annotation sets (such as start and place for Obama’s marriage).
MARPL therefore includes object variables that may stand for entities and values (as
usual) but also set variables that may stand for such annotation sets. For example, we can
express that the spouse relationship is symmetric, where all annotations are preserved
(i.e., Michelle is married to Barack with the same start time and place):
(1)
Here, the variables x, y and S are implicitly univerally quantified. Rather than simply
copying all annotations, it is also often necessary to create new annotation sets for the
conclusion. MARPL has a powerful mechanism for supporting this, but here we only
show a simplified case using notation as for attributed description logics [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. Using
modelling similar to the statements in Fig. 1, we can, e.g., express that a person is related
to a male parent of one of their parents, where the type of kinship is grandfather:
(2)
      </p>
      <p>
        Wikidata does not distinguish items and properties on the schema level – both can be
subject and object in statements and annotations [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. To capture this, we model Wikidata
properties as individuals (not as predicates) and treat Wikidata statements as annotated
ternary relations statement¹s; p; oº@Q relating subject s, predicate p, and object o with
annotation set Q (note that Wikidata refers to annotations as statement qualifiers [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]).
      </p>
      <p>To make this special form of MARPL rules usable in software, we further introduce
a customised syntax that allows rules to be expressed using only the restricted ASCII
character set. For example, in our implementation, the rule (2) is written as follows (we
use readable labels instead of the numeric ids Wikidata acutally uses for properties):</p>
      <p>For each item page in SQID, we are only interested in inferences that have the
currently displayed item as a subject. Since any variable in the head predicate must
also appear in the rule body, we may eliminate rules from consideration if the body
requires an outgoing statement that is not present on the current item (in some cases,
we can do this for incoming statements as well). For any rule not eliminated in such a
fashion, we construct a SPARQL query that matches if the rule is applicable (but may
match if the rule is not applicable), i.e., we query for an underapproximation of the rule
body. For each query result, we then check if it gives rise to a match of the rule body,
by verifying additional conditions on annotation sets that are not easily expressed in
SPARQL. This yields a non-recursive and therefore incomplete, but nonetheless sound
reasoner implementation that can work on the current version of the hundreds of millions
of assertions in Wikidata.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Demonstration</title>
      <p>In our demonstration, we will show the workings of our inference mechanism and the
related user interface, but we will also give some general insights into the content,
technical infrastructure and modelling approach of Wikidata as a whole. We will then
demonstrate reasoning using a variety of inference rules. The SQID data browser is
available at https://tools.wmflabs.org/sqid/. Reasoning support in SQID is still under active
development and all source code is freely available at https://github.com/Wikidata/SQID/.
Acknowledgements. This work is partly supported by the German Research Foundation
(DFG) in CRC 912 (HAEC), CoE cfaed, and in Emmy Noether grant KR 4381/1-1.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Belleau</surname>
            ,
            <given-names>F.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Nolin</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Tourigny</surname>
            ,
            <given-names>N.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Rigault</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Morissette</surname>
            ,
            <given-names>J.:</given-names>
          </string-name>
          <article-title>Bio2RDF: Towards a mashup to build bioinformatics knowledge systems</article-title>
          .
          <source>J. of Biomedical Informatics</source>
          <volume>41</volume>
          (
          <issue>5</issue>
          ),
          <fpage>706</fpage>
          -
          <lpage>716</lpage>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Bollacker</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Evans</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Paritosh</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sturge</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Taylor</surname>
          </string-name>
          , J.:
          <article-title>Freebase: A collaboratively created graph database for structuring human knowledge</article-title>
          .
          <source>In: Proc. 2008 ACM SIGMOD Int. Conf. on Management of Data</source>
          . pp.
          <fpage>1247</fpage>
          -
          <lpage>1250</lpage>
          . ACM (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>Google</given-names>
            <surname>Inc</surname>
          </string-name>
          .
          <article-title>: Knowledge - Inside Search</article-title>
          . https://www.google.com/intl/es419/insidesearch/ features/search/knowledge.html,
          <source>retrieved July</source>
          <year>2017</year>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Hoffart</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Suchanek</surname>
            ,
            <given-names>F.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Berberich</surname>
            ,
            <given-names>K.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Weikum</surname>
          </string-name>
          , G.:
          <article-title>YAGO2: A spatially and temporally enhanced knowledge base from Wikipedia</article-title>
          .
          <source>J. of Artif. Intell</source>
          .
          <volume>194</volume>
          ,
          <fpage>28</fpage>
          -
          <lpage>61</lpage>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Krötzsch</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Ontologies for knowledge graphs?</article-title>
          <source>In: Proc. 30th Int. Workshop on Description Logics (DL'17)</source>
          .
          <source>CEUR Workshop Proceedings</source>
          , vol.
          <year>1879</year>
          .
          <article-title>CEUR-WS.org (</article-title>
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Krötzsch</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Marx</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ozaki</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Thost</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          :
          <article-title>Attributed description logics: Ontologies for knowledge graphs</article-title>
          .
          <source>In: Proc. 16th Int. Semantic Web Conf. (ISWC'17)</source>
          . Springer (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Krötzsch</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Thost</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          :
          <article-title>Ontologies for knowledge graphs: Breaking the rules</article-title>
          . In: Groth,
          <string-name>
            <given-names>P.T.</given-names>
            ,
            <surname>Simperl</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            ,
            <surname>Gray</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.J.G.</given-names>
            ,
            <surname>Sabou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Krötzsch</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            ,
            <surname>Lécué</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Flöck</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            ,
            <surname>Gil</surname>
          </string-name>
          ,
          <string-name>
            <surname>Y</surname>
          </string-name>
          . (eds.)
          <source>Proc. 15th Int. Semantic Web Conf. (ISWC'16)</source>
          . LNCS, vol.
          <volume>9981</volume>
          , pp.
          <fpage>376</fpage>
          -
          <lpage>392</lpage>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Marx</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Krötzsch</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Thost</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          :
          <article-title>Logic on MARS: Ontologies for generalised property graphs</article-title>
          . In: Sierra,
          <string-name>
            <surname>C</surname>
          </string-name>
          . (ed.)
          <source>Proc. 26th Int. Joint Conf. on Artificial Intelligence (IJCAI'17)</source>
          . pp.
          <fpage>1188</fpage>
          -
          <lpage>1194</lpage>
          .
          <source>International Joint Conferences on Artificial Intelligence</source>
          (
          <year>2017</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Vrandečić</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Krötzsch</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          :
          <article-title>Wikidata: A free collaborative knowledgebase</article-title>
          .
          <source>Commun. ACM</source>
          <volume>57</volume>
          (
          <issue>10</issue>
          ) (
          <year>2014</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>