<!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>Property-based typing with LITEQ</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Stefan Scheglmann</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Martin Leinberger</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Ralf La¨mmel</string-name>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Steffen Staab</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Matthias Thimm</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Evelyne Viegas</string-name>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Institute for Web Science and Technologies, University of Koblenz-Landau</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Microsoft Research Redmond</institution>
          ,
          <country country="US">US</country>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>The Software Languages Team, University of Koblenz-Landau</institution>
          ,
          <country country="DE">Germany</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>Coding against the semantic web can be quite difficult as the basic concepts of RDF data and programming languages differ greatly. Existing mappings from RDF to programming languages are mostly schema-centric. However, this can be problematic as many data sources lack schematic information. To alleviate this problem, we present a data centric approach that focuses on the properties of the instance data found in RDF and that lets a developer create types in his programming language by specifying properties that need to be present. This resembles a type definition rooted in description logics. We show how such a type definition can look like and demonstrate how a program using such type definitions can can be written.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1 Introduction</title>
      <p>Access to RDF data from within programs is difficult to realize since, (i) RDF follows
a flexible and extensible data model, (ii) schema is often missing or incomplete, and
(iii) data RDF type information is missing. In order to establish a robust access from
a program to RDF data, a developer faces several challenges. Most of the data sources
are defined externally and the developer has only a brief idea of what to find in this data
source, therefore he has to explore the data first. Once explored, he has to deal with the
impedance mismatch between how RDF types are structuring RDF data, compared to
how code types are used in programming languages, [4, 2, 6, 1]. In response to these
challenges, we have proposed LITEQ [5], a system that allows for the mapping of RDF
schema information into programming language types.</p>
      <p>However, using LITEQ in practice has shown that purely relying on RDF schema
information for the mapping raises new issues. To alleviate these problems, we have
implemented an property-based approach and include it into LITEQ as an alternative
way of usage. Using this, a developer is able to create code types by listing properties
that should be present in instances of this code type.</p>
      <p>In this demo, we present an implementation of this approach1 in F#. It supports
developers in defining new code types by specifying their properties. This is aided by
auto-completion mechanism, which computes its suggestions directly on the instance
data without any need of a schema. The approach is intended as an extension to the
LITEQ library also presented at the InUse-Track of ISWC 2014.
1 http://west.uni-koblenz.de/Research/systems/liteq</p>
    </sec>
    <sec id="sec-2">
      <title>The LITEQ approach</title>
      <p>
        Typically, the integration of RDF data in a programming environment is a multi-step
process. (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) The structure and content of the data source has to be explored, (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) the
code types and their hierarchy has to be designed and implemented, then (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) the queries
for the concrete data have to be defined, and finally (
        <xref ref-type="bibr" rid="ref4">4</xref>
        ) the data can be retrieved and
mapped to the predefined code types.
      </p>
      <p>The NPQL Approach: LITEQ provides an IDE integrated workflow to cope with all
of these tasks. It implements NPQL, a novel path query language, to explore the data
source, to define types based on schematic information and to query the data. Returned
results of these queries are automatically typed in the programming language. All of
this is aided by the autocompletion of the IDE. Figure 1 shows a typical LITEQ
expression using an NPQL query in order to retrieve all mo:MusicArtist entities which
actually have the foaf:made and mo:biography property defined. The result is
returned as a set of objects of the created code type for mo:MusicArtist.
Property-based Type access with LITEQ: The example shown above has several
problems. Additionally, schema-centric technique only provides code types for which
a RDF type is defined in the schema. It is not possible to introduce more specific code
types, e.g. if it is known that all entities of interest will have at least one foaf:made
and mo:biography relation, one may like to reflect that by the returned code type.
Lastly and most importantly, for all schema-centric access methods, like LITEQ, a more
or less complete schema must be present, which is not always the case, especially in
Linked Data. To cope with these problems of schema-centric approaches, we introduce
the idea of a different data access/typing approach, property-based RDF access in a
program [7].</p>
      <p>
        Property-based Type declaration: The basic idea is very simple: (
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) A code type
is defined by a set of properties. (
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) Extensionally, a code type represents a
anonymous RDF type (or view on the data) which refers to the set of all entities which
actually have all the properties defined in the code type. (
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) Intensionally, the code
type signature is given by the set of properties (for these it provides direct access).
All other properties of an instance of this type can only be accessed indirectly in a
program using the predicate name. Specifically, this means that a developer might
define a type by just declaring a set of properties as the types signature (Sig), e.g.
Sig = ffoaf:made; mo:biographyg. Our approach allows for two different ways
to map such a property-based type to a corresponding code type. A flat-mapping which
just maps to a rdf:Resource representation and only makes the properties
explicitly accessible which are defined in the code type signature. Such an unnamed code type
refers to the set of all entities sharing the properties in the code types signature (Sig),
cf. 1.
      </p>
      <p>unnamedTypeSig
9foaf:made u 9mo:biography
The second option is named-mapping. Which allows to map the previously unnamed
type to a given RDF type. This ensures separation if entities of distinguished types
share properties, e.g. music artists and producers given the properties foaf:made
and mo:biography. And to search for other properties stating that their domain is
the specified type in order to provide a richer API. The named type is defined as the
intersection of the unnamed type for the provided signature (Sig) and all entities of the
given RDF type (mo:MusicArtist), cf. 2.</p>
      <p>
        namedType(Sig;mo:MusicArtist)
unnamedTypeSig u mo:MusicArtist
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        )
Type-declaration in Practice In the following, we will give a brief overview of the
new method of access RDF data in a programming environment:
(
        <xref ref-type="bibr" rid="ref1">1</xref>
        ) To use the library, the DLL must be referenced from the project. This allows opening
the library namespace and creating a store object by passing a URL to a SPARQL
endpoint, cf. Figure 2.
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        ) All properties contained in the SPARQL endpoint can be accessed from the store
object (cf. Fig. 3).
(
        <xref ref-type="bibr" rid="ref3">3</xref>
        ) Once a property has been chosen, the set of properties presented in the next step is
restricted to those properties which have been observed in combination of the previously
chosen properties, cf. Figure 4. Here foaf:made has already been chosen and the only
co-occurring property mo:biography is presented for the next selection.
(
        <xref ref-type="bibr" rid="ref4">4</xref>
        ) Finally, the developer has to decide on how he likes the new type to be mapped. As
mentioned in the previous section, he can choose for an unnamed representation or a
named one, cf. Figure 5.
(
        <xref ref-type="bibr" rid="ref5">5</xref>
        ) If the developer decides for the named representation, he has to choose the RDF
type, cf. Figure 6. In this case, only mo:MusicArtist instances contain the specified
properties and therefore he can only chose this one RDF type.
      </p>
      <p>The presented method of relying on instance information instead of the schema has
a severe drawback when it comes to specifying return code types of properties in the
programming language. As one cannot use schematic information, the only chance is
to probe the instance set. However, for big instance sets, this process takes to long to be
useful. The current prototype avoids this problem by only probing whether a property
returns another RDF resource or a literal and types returned values accordingly.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Conclusion and Further Work</title>
      <p>In this extended abstract, we presented a new way to work with RDF in a programming
language - by defining types based on their properties. As an extension of LITEQ, this
demo will focus on the new feature of property based type definition, as described in
[8, 7] and discussed in [3].</p>
      <p>Acknowledgements This work has been supported by Microsoft.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <given-names>V.</given-names>
            <surname>Eisenberg</surname>
          </string-name>
          and
          <string-name>
            <surname>Y. Kanza.</surname>
          </string-name>
          <article-title>Ruby on semantic web</article-title>
          . In Serge Abiteboul, Klemens Bo¨hm, Christoph Koch, and
          <string-name>
            <surname>Kian-Lee</surname>
            <given-names>Tan</given-names>
          </string-name>
          , editors,
          <source>ICDE2011</source>
          , pages
          <fpage>1324</fpage>
          -
          <lpage>1327</lpage>
          . IEEE Computer Society,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <given-names>L.</given-names>
            <surname>Hart</surname>
          </string-name>
          and
          <string-name>
            <given-names>P.</given-names>
            <surname>Emery</surname>
          </string-name>
          .
          <source>OWL Full and UML 2</source>
          .0 Compared. http://uk.builder.com/whitepapers/0and39026692and60093347p-
          <fpage>39001028qand00</fpage>
          .htm,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <given-names>S.</given-names>
            <surname>Homoceanu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>P.</given-names>
            <surname>Wille</surname>
          </string-name>
          , and
          <string-name>
            <given-names>W. T.</given-names>
            <surname>Balke</surname>
          </string-name>
          . Proswip:
          <article-title>Property-based data access for semantic web interactive programming</article-title>
          .
          <source>In 12th International Semantic Web Conference, ISWC</source>
          <year>2013</year>
          , Sydney, Australia,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>A.</given-names>
            <surname>Kalyanpur</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. J.</given-names>
            <surname>Pastor</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Battle</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J. A.</given-names>
            <surname>Padget</surname>
          </string-name>
          .
          <article-title>Automatic Mapping of OWL Ontologies into Java</article-title>
          .
          <source>In SEKE2004</source>
          ,
          <year>2004</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>M.</given-names>
            <surname>Leinberger</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Scheglmann</surname>
          </string-name>
          , R. La¨mmel, S. Staab,
          <string-name>
            <given-names>M.</given-names>
            <surname>Thimm</surname>
          </string-name>
          , and
          <string-name>
            <given-names>E.</given-names>
            <surname>Viegas</surname>
          </string-name>
          .
          <article-title>Semantic web application development with LITEQ</article-title>
          .
          <source>In International Semantic Web Conference</source>
          ,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <given-names>T.</given-names>
            <surname>Rahmani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Oberle</surname>
          </string-name>
          , and
          <string-name>
            <given-names>M.</given-names>
            <surname>Dahms</surname>
          </string-name>
          .
          <article-title>An adjustable transformation from owl to ecore</article-title>
          .
          <source>In MoDELS2010</source>
          , volume
          <volume>6395</volume>
          <source>of LNCS</source>
          , pages
          <fpage>243</fpage>
          -
          <lpage>257</lpage>
          . Springer,
          <year>2010</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <given-names>S.</given-names>
            <surname>Scheglmann</surname>
          </string-name>
          and
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Gro¨ner. Property-based Typing for RDF Data</article-title>
          .
          <source>In PSW 2012, First Workshop on Programming the Semantic Web</source>
          , Boston, Massachusetts, November 11th,
          <year>2012</year>
          ,
          <year>2012</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <given-names>S.</given-names>
            <surname>Scheglmann</surname>
          </string-name>
          ,
          <string-name>
            <surname>G.</surname>
          </string-name>
          <article-title>Gro¨ner, S. Staab, and</article-title>
          <string-name>
            <given-names>R.</given-names>
            <surname>La</surname>
          </string-name>
          <article-title>¨mmel. Incompleteness-aware programming with rdf data</article-title>
          .
          <source>In Evelyne Viegas</source>
          , Karin Breitman, and Judith Bishop, editors,
          <source>DDFP</source>
          , pages
          <fpage>11</fpage>
          -
          <lpage>14</lpage>
          . ACM,
          <year>2013</year>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>