<!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>
      <issn pub-type="ppub">1613-0073</issn>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Queries over Knowledge Graphs</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Sergejs Rikačovs</string-name>
          <email>sergejs.rikacovs@lumii.lv</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Kārlis Čerāns</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Workshop</string-name>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Institute of Mathematics and Computer Science, University or Latvia</institution>
          ,
          <addr-line>Raiņa bulvāris 29, Rīga, LV-1459</addr-line>
          ,
          <country country="LV">Latvia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2024</year>
      </pub-date>
      <fpage>26</fpage>
      <lpage>28</lpage>
      <abstract>
        <p>We demonstrate the concept of presenting a data schema of a knowledge graph, used to support visual schema presentation and visual queries over the data, as a knowledge graph itself. We demonstrate, how the visual schema analysis methods (visual schema presentation and visual query creation) can be applied to the meta-level schema, as well, including creation of queries involving both the data and its schema levels. Visual methods of data analysis, including visual data schema presentation and visual queries over the data hold a promise of enabling direct work with the data for a wider group of custom domain experts, as well as they can ease the work of data professionals by allowing to exploit their visual perception capabilities in their work.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        visualization tools, as VOWL [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ], OntoDia [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and OWLGrEd [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], as well as RDFShape [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] for RDF data
shape presentation. The visual data structure presentation methods exist in commercial knowledge
graph management environments, such as Metaphactory and TopBraid Composer, as well. There are
also early tools for on-the-fly extracting and visualizing the actual data schema, such as LD-VOWL [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]
and LODSight [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ].
      </p>
      <p>
        The tools for visual data exploration and queries involve OptiqueVQs [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], RDF Explorer [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ],
QueryVOWL [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], LinDA [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] and ViziQuer [
        <xref ref-type="bibr" rid="ref11">11</xref>
        ].
      </p>
      <p>
        Out of these tools, ViziQuer provides an option to combine the data schema presentation and visual
query facilities into a single visual environment [
        <xref ref-type="bibr" rid="ref12">12</xref>
        ]. Its existing technological pipeline for visual schema
presentation and schema-backed query creation is based on a dedicated structure of a data schema
that involves the description of the schema entities (classes and properties) and their connections (e.g.,
what properties can apply to instances of what classes, or what class-to-class and property-to-property
relations are possible). The frequencies of entity and their connection appearance and other factors,
like property domain/range information and property cardinalities can be relevant elements in the data
schema structure, as well.
      </p>
      <p>The current solution enabling the shared visual data schema and visual query experience in the
ViziQuer tool context foresees storing the data schema in a relational database (RDB). This solves the
performance issues, even when the schemas of large data sets, such as DBpedia and Wikidata are stored.
However, RDB storage is little helpful when it comes to explaining what data actually are stored in the
database. The RDB format also makes it dificult to share the data schemas among the diferent users
and to integrate their data into larger data ecosystems, typically ofered by the knowledge graphs.</p>
      <p>In this work we outline the concept of creating a knowledge graph out of the visual data schemas
themselves to enable them to be acted upon by various KG and semantic technology tools, including
but not limited to the visual schema presentation and visual queries in the ViziQuer tool itself. We</p>
      <p>CEUR</p>
      <p>ceur-ws.org
demonstrate the possibility of creating distributed visual queries in ViziQuer simultaneously over the
original data and the data schema, as well.</p>
      <p>In what follows, Section 2 reviews the visual schemas and queries in the ViziQuer environment
context. Section 3 presents the data schemas as Knowledge graphs and Section 4 concludes the paper.</p>
      <p>The material supporting the demonstration is available at https://github.com/LUMII-Syslab/
viziquer-tools-kg .</p>
    </sec>
    <sec id="sec-2">
      <title>2. Visual Schemas and Queries</title>
      <p>Figure 1 provides an example data set schema for a snapshot of the Nobel Prizes data set1. The schema
lists the data classes as nodes and the properties available at each of them as attributes, or as links
connecting the property source and target classes. There is frequency information for classes, attributes
(in the context of their ascription class) and links (in the context of link source and target classes), as
well as attribute and link cardinalities in their respective contexts. Note that the properties :hasPart
and :isPartOf connect just the nobel:nobelPrize and nobel:LaureateAward classes, their applicability to
the instances of the dbo:Award classes is covered by their ascription its subclasses (the schema provides
the information about the “essential” ascription points of the properties). The D and R markers at
the attributes and links depicting a property inform that the particular property visualization context
corresponds to its domain (D) or range (R).</p>
      <p>The data schema, as stored in the visual tool, allows creating visual queries for inspecting the data set
contents, for instance, by asking for statistics of Nobel Prizes received by organizations across diferent
prize categories, as shown in Figure 2.</p>
      <p>
        A visual query is a rooted directed graph with data nodes corresponding to query variables (with an
option to assign class information, as well), the data links establishing their connections and attributes
building up the selection list. There are means for further query structuring as control nodes (unit or
union) and non-data edges (non-link edges and same-data edges). The reader may consult [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ] for a
more detailed visual query notation explanation.
1Originally at http://data.nobelprize.org; a snapshot has been created created and stored locally (see the supporting resources
page for details).
      </p>
    </sec>
    <sec id="sec-3">
      <title>3. Data Schemas as Knowledge Graphs</title>
      <p>The data schemas (used for visual schema presentation and visual query support) in the ViziQuer
environment2 are handled by a dedicated open-source Data Shape Server3 that can be adapted also
to serve the data schema information to other clients (e.g., if the context-sensitive auto-completion of
class and property names were to be implemented in a textual SPARQL editor). The Data shape server
stores the data schemas in a relational PostgreSQL database, ensuring their technical availability, paying
less attention to the ease of explainability of the schema structure.</p>
      <p>For the data schema explanation and their integration into the knowledge graph landscape, the data
schemas can be mapped into the Knowledge graph (KG) format. We propose an initial data schema
conceptualization structure and manually create custom mappings for generating KG resources (together
with their class assignment) from database records of diferent tables, as well as creating of the data
triples in KG from the contents of these records. The mappings are then interpreted by a custom code
that creates the actual data triples4.</p>
      <p>Figure 3 contains the visualization of the meta-schema obtained from the analysis of the KG containing
the Nobel Prizes data endpoint (the classes in the data schema would be shared for schemas of diferent
endpoints; the entity frequency statistics would be diferent, though).</p>
      <p>
        The central concepts of the data schema are :Classifier for presenting the data classes (and values in
2https://github.com/LUMII-Syslab/viziquer, see also https://viziquer.app
3https://github.com/LUMII-Syslab/data-shape-server
4Should a more standardized approach be required, a R2RML [
        <xref ref-type="bibr" rid="ref14">14</xref>
        ] mapping for the data schema KG generation can be created.
The ad hoc mapping creation approach has been, however, the easiest approach to solve the practical data mapping task.
other classifiers, if used) and :Property for describing the properties. The :ClassPropertyPair describes
the connections of classes and properties, including what classes can be sources and what classes can
be targets for a property. Further on, the class :CPC_Rel describes the target classes for a property
in a source class context and source classes for a property in a target class context (including the
respective frequency/triple counts). The :ClassClassRel accounts for subclass relation encoding (other
class-to-class relations, as equivalent classes or overlapping classes can be encoded here, as well). The
:PropertyPropertyRel class describes the patterns of diferent properties appearing together, either as
one property following the other, or two properties having a common subject or common object;
these patterns are essential for query auto-completion in a situation when the class information is not
available within the query fragment built so far.
      </p>
      <p>We note also the :importanceIndex attribute in the :ClassPropertyPair and :ClassProperty_Class_Rel
classes. It informs (if the value is above 0) about when the class is important in the context of a property
(or in the context of the property in the context of the “other end” class), so that the attribute or link
holding the property name is to be ascribed in the schema diagram at the respective class.</p>
      <p>
        Although the queries involving the meta-data level are available also on the data-level schemas and
the ViziQuer visual notation has means to support these (using, e.g., the explicit variables in the class
and property name positions in a schema diagram, cf. [
        <xref ref-type="bibr" rid="ref13">13</xref>
        ], the availability of explicit metadata makes
the meta-level queries more convenient. Figure 4 presents an involved multi-graph query asking for
the statistics of the instances in the class dbo:Award in the nobel_prizes data schema, according to their
“most specific” classes.
      </p>
      <p>The ”most specific” class for an instance ?A is looked up in the named graph nobel_prizes_schema
holding the schema information as an instance ?C of the class np:Classifier . The negation condition
states that there is no other type ?T1 of the instance ?A such that it would be a subclass of the classifier
instance ?C in the nobel_prizes_schema named graph5.</p>
      <p>The availability of the data schema as a knowledge graph allows creating a wide range of
metaanalysis queries over the data. The queries working over meta-schemas of diferent data sets are possible,
as well.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusions and Future Work</title>
      <p>This work has demonstrated the natural concept of presenting a knowledge graph data schema, as
stored in a visual schema and query tool, itself as a data schema. Such a presentation has provided basis
of the explanation of the data schema concepts, making it easier re-usable, as well as it allows using the
knowledge graph analysis tools over the data schema representation.</p>
      <p>The visual query environment allows building queries consuming data from diferent named graphs,
corresponding to diferent schemas; we have shown an example of creating a query looking
simultaneously both into the level of the data themselves, and the data schema.
5The global subquery construct is used in the visual notation to enforce the usage of the SPARQL MINUS construct.</p>
      <p>A further work would be to expand the visual data schema visualization and visual query software
to allow it to work directly with the schema stored as a knowledge graph, as well (without the need
to store the schema in a relational database). Such an extension would ease re-using and sharing of
schemas of data sets among diferent users (as the schema would be just a knowledge graph itself).
This work has been partially supported by a Latvian Science Council Grant lzp-2021/1-0389 “Visual
Queries in Distributed Knowledge Graphs”.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>S.</given-names>
            <surname>Lohmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Negru</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Haag</surname>
          </string-name>
          , T. Ertl,
          <article-title>Visualizing ontologies with vowl</article-title>
          ,
          <source>Semantic Web</source>
          <volume>7</volume>
          (
          <year>2016</year>
          )
          <fpage>399</fpage>
          -
          <lpage>419</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>D.</given-names>
            <surname>Mouromtsev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Pavlov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Emelyanov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Morozov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Razdyakonov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Galkin</surname>
          </string-name>
          ,
          <article-title>The simple, web-based tool for visualization and sharing of semantic data and ontologies</article-title>
          , in: ISWC P&amp;
          <article-title>D 2015, CEUR</article-title>
          , volume
          <volume>1486</volume>
          ,
          <year>2015</year>
          . URL: http://ceur-ws.
          <source>org/</source>
          Vol-
          <volume>1486</volume>
          /paper_77.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>J.</given-names>
            <surname>Bārzdiņš</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Čerāns</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Liepiņš</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Sproģis</surname>
          </string-name>
          ,
          <article-title>Uml style graphical notation and editor for owl 2</article-title>
          ,
          <source>in: Proc. of BIR'</source>
          <year>2010</year>
          , LNBIP, volume
          <volume>64</volume>
          , Springer,
          <year>2010</year>
          , pp.
          <fpage>102</fpage>
          -
          <lpage>113</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>J. E. L.</given-names>
            <surname>Gayo</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Fernández-Álvarez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Garcıa-González</surname>
          </string-name>
          ,
          <article-title>Rdfshape: An rdf playground based on shapes</article-title>
          ,
          <source>in: CEUR Workshop Proceedings</source>
          , volume
          <volume>2180</volume>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>M.</given-names>
            <surname>Weise</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Lohmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Haag</surname>
          </string-name>
          ,
          <article-title>Ld-vowl: Extracting and visualizing schema information for linked data</article-title>
          , in: Voila!
          <year>2016</year>
          ,
          <year>2016</year>
          , pp.
          <fpage>120</fpage>
          -
          <lpage>127</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M.</given-names>
            <surname>Dudáš</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Svátek</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Mynarz</surname>
          </string-name>
          ,
          <article-title>Dataset summary visualization with lodsight</article-title>
          ,
          <source>in: The 12th Extended Semantic Web Conference (ESWC2015)</source>
          ,
          <year>2015</year>
          . URL: http://lod2-dev.vse.cz/lodsight/ lodsight-eswc2015-demopaper.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>A.</given-names>
            <surname>Soylu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Kharlamov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Zheleznyakov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E. J.</given-names>
            <surname>Ruiz</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Giese</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Skjaeveland</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Hovland</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Schlatte</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Brandt</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Lie</surname>
          </string-name>
          ,
          <string-name>
            <surname>I. Horrocks</surname>
          </string-name>
          ,
          <article-title>Optiquevqs: a visual query system over ontologies for industry</article-title>
          ,
          <source>Semantic Web</source>
          <volume>9</volume>
          (
          <year>2018</year>
          )
          <fpage>627</fpage>
          -
          <lpage>660</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>H.</given-names>
            <surname>Vargas</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Buil-Aranda</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Hogan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>López</surname>
          </string-name>
          ,
          <article-title>Rdf explorer: A visual sparql query builder</article-title>
          ,
          <source>in: The Semantic Web - ISWC 2019. Lecture Notes in Computer Science</source>
          , volume
          <volume>11778</volume>
          , Springer, Cham,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>F.</given-names>
            <surname>Haag</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Lohmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Siek</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Ertl</surname>
          </string-name>
          , Queryvowl:
          <article-title>Visual composition of sparql queries, in: The Semantic Web: ESWC 2015 Satellite Events</article-title>
          , LNCS, volume
          <volume>9341</volume>
          , Springer,
          <year>2015</year>
          , pp.
          <fpage>62</fpage>
          -
          <lpage>66</lpage>
          . URL: http://vowl.visualdataweb.org/queryvowl/.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>K.</given-names>
            <surname>Thellmann</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Orlandi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Auer</surname>
          </string-name>
          ,
          <article-title>Linda - visualising and exploring linked data</article-title>
          ,
          <source>in: SEMANTiCS 2014 (Posters &amp; Demos)</source>
          ,
          <year>2014</year>
          , pp.
          <fpage>39</fpage>
          -
          <lpage>42</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>K.</given-names>
            <surname>Čerāns</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Šostaks</surname>
          </string-name>
          ,
          <string-name>
            <given-names>U.</given-names>
            <surname>Bojārs</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Ovčiņņikova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Lāce</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Grasmanis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Romāne</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Sproģis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Bārzdiņš</surname>
          </string-name>
          ,
          <article-title>Viziquer: A web-based tool for visual diagrammatic queries over rdf data, in: ESWC 2018 Satellite Events</article-title>
          , LNCS, volume
          <volume>11155</volume>
          , Springer,
          <year>2018</year>
          , pp.
          <fpage>158</fpage>
          -
          <lpage>163</lpage>
          . doi:
          <volume>10</volume>
          .1007/ 978- 3-
          <fpage>319</fpage>
          - 98192- 5_
          <fpage>30</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <given-names>K.</given-names>
            <surname>Čerāns</surname>
          </string-name>
          ,
          <string-name>
            <given-names>U.</given-names>
            <surname>Bojārs</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Ovčiņņikova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Lāce</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Grasmanis</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Sprogis</surname>
          </string-name>
          ,
          <article-title>Towards visual federated sparql queries</article-title>
          ,
          <source>in: SEMANTiCS-PDWT</source>
          <year>2024</year>
          , CEUR Workshop Proceedings, volume
          <volume>3759</volume>
          ,
          <year>2024</year>
          . URL: https://ceur-ws.
          <source>org/</source>
          Vol-
          <volume>3759</volume>
          /paper24.pdf.
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>J.</given-names>
            <surname>Ovčiņņikova</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Šostaks</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Čerāns</surname>
          </string-name>
          ,
          <article-title>Visual diagrammatic queries in viziquer: Overview and implementation</article-title>
          ,
          <source>Baltic Journal of Modern Computing</source>
          <volume>11</volume>
          (
          <year>2023</year>
          )
          <fpage>317</fpage>
          -
          <lpage>350</lpage>
          . doi:
          <volume>10</volume>
          .22364/bjmc.
          <year>2023</year>
          .
          <volume>11</volume>
          .2.07.
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <article-title>R2rml: Rdb to rdf mapping language</article-title>
          , https://www.w3.org/TR/r2rml/,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>