The RTM RDF to topic maps mapping

Definition and introduction

Affiliation:Ontopia A/S
Date:$Date: 2003/12/28 12:24:42 $
Version:Version 0.2 ($Revision: 1.2 $)

Abstract

This technical report defines version 0.2 of the RTM RDF to topic maps mapping vocabulary.

Please note that this document is not a formal specification from any recognized standards body, but a Technical Report published by Ontopia, a commercial company, for the convenience of all interested parties. The specification may be taken up by some standards body at some point, but no initiatives in this direction have been taken as yet.

Table of contents

1. Introduction

RTM is a vocabulary that can be used to describe the mapping of an RDF vocabulary to topic maps in such a way that RDF data using that vocabulary can be converted automatically to topic maps. This allows RDF vocabularies to be used both as RDF vocabularies and as topic map vocabularies.

The vocabulary annotates RDF properties to indicate which topic map construct the property is to be mapped to. The type and scope of the resulting construct can be controlled, and for associations the role played by the subject and the object must be indicated. The RTM mapping declarations can be stored as part of the data to be mapped, or it can be stored externally.

2. The vocabulary

Throughout this document the convention rtm:foo should be taken to mean the URI reference http://psi.ontopia.net/rdf2tm/#foo. Each of these URI references are published subject identifiers that together make up the RTM vocabulary.

RTM consists of the following RDF properties, as well as the individual resources defined in section 3. The subjects of statements using these properties are always RDF properties whose mapping to topic maps is to be described.

rtm:maps-to

This property defines which topic map construct an RDF property is converted to during RDF-to-topic map mapping. RDF properties for which no rtm:maps-to statement is found are ignored. The possible values of this predicate are enumerated in section 3.

rtm:type

This property is used to override the default type otherwise assigned to topic map constructs created by the mapping.

rtm:in-scope

This property is used to add a topic to the scope of topic map constructs created by the mapping.

rtm:subject-role

This property is used to indicate the association role type played by the subject of an RDF statement mapped to an association.

rtm:object-role

This property is used to indicate the association role type played by the object of an RDF statement mapped to an association.

3. The mapping algorithm

The input to the mapping consists of:

For precision, the topic map is here described as an instance of the Topic Maps Data Model defined in [TMDM], while the RDF models are described as RDF graphs, as defined by [RDF].

The mapping is done by traversing all the triples in the input model and for each triple:

  1. Let s1 be the subject of that triple, p1 the predicate, and o1 the object.

  2. Look for a triple in the mapping model whose subject is p1 and whose predicate is rtm:maps-to. If no such triple is found, move on to the next triple of the input model. If more than one such triple is found, select one arbitrarily and let o2 be the object of that predicate.

  3. If s1 is a URI reference, get the topic produced by the procedure in section 3.10 for that URI reference and let it be known as t1.

    If s1 is a blank node, and it has not been processed before, create a topic item to represent it and add it to the [topics] property of the topic map item. If it has been processed before, find the topic item created for it. Let this topic item be known as t1.

  4. Now follow the instructions in the section below whose name corresponds to the value of o2. It is an error if there is no such section, or if o2 is a literal.

3.1. rtm:basename

Create a topic name item and add it to the [topic names] property of t1. Set its [value] property to the string value of o1. It is an error if o1 is not a literal.

Finally, let the topic name item be known as c and follow the procedure in section 3.8. Implementations which support typed names must also follow the procedure in section 3.9.

3.2. rtm:occurrence

Create an occurrence item and add it to the [occurrences] property of t1. If o1 is a literal, set its [value] property to the string value of o1, otherwise create a locator item and set its [notation] property to "URI" and its [reference] property to o1, and set the locator as the value of the occurrence item's [locator] property. It is an error if o1 is a blank node.

Finally, let the occurrence item be known as c and follow the procedures in section 3.8 and section 3.9.

3.3. rtm:association

Create an association item and add it to the [associations] property of the topic map item. Let t2 be the topic for o1; it is an error if o1 is a literal.

Look for a triple in the mapping model whose subject is p1 and whose predicate is rtm:subject-role; let rt1 be the object. It is an error if rt1 is a blank node or a literal. Create an association role item and add it to the [roles] property of the association, set its [player] property to t1, and its [type] property to the topic for rt1.

Now look for a triple in the mapping model whose subject is p1 and whose predicate is rtm:object-role; let rt2 be the object. It is an error if rt2 is a blank node or a literal. Create an association role item and add it to the [roles] property of the association, set its [player] property to t2, and its [type] property to the topic for rt2.

Finally, let the association item be known as c and follow the procedures in section 3.8 and section 3.9.

3.4. rtm:instance-of

Create an association item. Get the topic for http://psi.topicmaps.org/sam/1.0/#type-instance and put it in the [type] property of the association item.

Create an association role item. Get the topic for http://psi.topicmaps.org/sam/1.0/#type and put it in its [type] property. Get the topic for o1 and put it in the [player] property. It is an error if o1 is a literal.

Create an association role item. Get the topic for http://psi.topicmaps.org/sam/1.0/#instance and put it in its [type] property, and put t1 in the [player] property.

Finally, let the association item be known as c and follow the procedure in section 3.9.

Note

The URIs used here are the ones given in the current draft of TMDM, but they are unlikely to be the URIs in the final version. It is recommended that implementations represent RDF statements mapped to instance-of using their internal representation for the type-instance relationship. This document will be updated when TMDM is finalized.

3.5. rtm:subject-identifier

Create a locator item and set its [notation] property to "URI" and its [reference] property to o1, then add it to the [subject identifiers] property of t1. It is an error if o1 is a literal or a blank node.

3.6. rtm:subject-locator

Create a locator item and set its [notation] property to "URI" and its [reference] property to o1, then set it as the value of the [subject locator] property of t1. It is an error if o1 is a literal or a blank node, or if t1 already has a different value in its [subject locator] property.

3.7. rtm:source-locator

Create a locator item and set its [notation] property to "URI" and its [reference] property to o1, then add it to the [source locators] property of t1. It is an error if o1 is a literal or a blank node.

3.8. Adding scope

For each triple whose subject is p1 and whose predicate is rtm:in-scope, get the topic for the object of the triple and add it to the [scope] property of c. It is an error if the object is a literal.

3.9. Adding type

Look for a triple whose subject is p1 and whose predicate is rtm:type. If such a triple is found, get the topic for the object of the triple and set it as the value of the [type] property of c. It is an error if the object is a literal.

If not such triple is found, get the topic for p1 and set it as the value of the [type] property of c.

3.10. Getting a topic for a URI reference

Look for a topic item whose [subject identifiers] property contains a locator item whose [notation] property is "URI" and whose [reference] property contains the URI reference. If no such topic item is found, create one.

Appendix: Bibliography

TMDM
ISO/IEC 13250-2: Topic Maps — Data Model, International Organization for Standardization, Geneva , Switzerland, Forthcoming.
RDF
Resource Description Framework (RDF): Concepts and Abstract Syntax, Graham Klyne, Jeremy J. Carroll, World Wide Web Consortium, W3C Working Draft 10 October 2003.

A. The RTM schema

This appendix provides an RDF Schema and OWL schema for the RTM vocabulary.

<rdf:RDF 
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
	xmlns:owl="http://www.w3.org/2002/07/owl#"
	xmlns:rtm="http://psi.ontopia.net/rdf2tm/#">

  <!-- ===== ONTOLOGY ===================================================== -->
  <owl:Ontology rdf:about="http://psi.ontopia.net/rdf2tm/">
    <rdfs:label>RTM: RDF to topic map mapping</rdfs:label>
    <rdfs:comment>A vocabulary for expressing mappings from RDF
    vocabularies to topic map forms of the same vocabularies.</rdfs:comment>
    <rdfs:seeAlso rdf:resource="http://www.ontopia.net/topicmaps/materials/tmrdf.html"/>
    <owl:imports rdf:resource="http://www.w3.org/2000/01/rdf-schema"/>
    <owl:imports rdf:resource="http://www.w3.org/2002/07/owl"/>
  </owl:Ontology>


  <!-- ~~~~~ CONSTRUCT -->
  <owl:Class rdf:about="http://psi.ontopia.net/rdf2tm/#Construct" 
	rdfs:label="Construct"
	rdfs:comment="A topic map construct to which an RDF property may be mapped.">
    <rdfs:isDefinedBy rdf:resource="http://psi.ontopia.net/rdf2tm/"/>
    <owl:oneOf rdf:parseType="Collection">
      <owl:Thing rdf:about="http://psi.ontopia.net/rdf2tm/#basename"/>
      <owl:Thing rdf:about="http://psi.ontopia.net/rdf2tm/#occurrence"/>
      <owl:Thing rdf:about="http://psi.ontopia.net/rdf2tm/#association"/>
      <owl:Thing rdf:about="http://psi.ontopia.net/rdf2tm/#source-locator"/>
      <owl:Thing rdf:about="http://psi.ontopia.net/rdf2tm/#subject-identifier"/>
      <owl:Thing rdf:about="http://psi.ontopia.net/rdf2tm/#subject-locator"/>
      <owl:Thing rdf:about="http://psi.ontopia.net/rdf2tm/#instance-of"/>
    </owl:oneOf>
    <!-- disjoint with pretty much everything else -->
  </owl:Class>


  <!-- ~~~~~ MAPS-TO -->
  <owl:FunctionalProperty rdf:about="http://psi.ontopia.net/rdf2tm/#maps-to" 
	rdfs:label="maps to"
	rdfs:comment="Specifies the topic map construct to which a particular RDF 
        property is to be mapped.">
    <rdfs:domain rdf:resource="http://www.w3.org/2000/01/rdf-schema#Property"/>
    <rdfs:range rdf:resource="http://psi.ontopia.net/rdf2tm/#Construct"/>
    <rdfs:isDefinedBy rdf:resource="http://psi.ontopia.net/rdf2tm/"/>
  </owl:FunctionalProperty>

  <!-- ~~~~~ TYPE -->
  <owl:FunctionalProperty rdf:about="http://psi.ontopia.net/rdf2tm/#type" 
	rdfs:label="of type"
	rdfs:comment="Specifies the type of the topic map construct created from 
        statements using this RDF property.">
    <rdfs:domain rdf:resource="http://www.w3.org/2000/01/rdf-schema#Property"/>
    <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
    <rdfs:isDefinedBy rdf:resource="http://psi.ontopia.net/rdf2tm/"/>
  </owl:FunctionalProperty>

  <!-- ~~~~~ IN-SCOPE -->
  <rdf:Property rdf:about="http://psi.ontopia.net/rdf2tm/#in-scope" 
	rdfs:label="in scope"
	rdfs:comment="Specifies a topic to be added to the scope of topic map 
        constructs created from statements with this property.">
    <rdfs:domain rdf:resource="http://www.w3.org/2000/01/rdf-schema#Property"/>
    <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
    <rdfs:isDefinedBy rdf:resource="http://psi.ontopia.net/rdf2tm/"/>
  </rdf:Property>

  <!-- ~~~~~ SUBJECT-ROLE -->
  <owl:FunctionalProperty rdf:about="http://psi.ontopia.net/rdf2tm/#subject-role" 
	rdfs:label="subject role"
	rdfs:comment="Specifies the role type played by the subject in associations 
        created from statements with this property.">
    <rdfs:domain rdf:resource="http://www.w3.org/2000/01/rdf-schema#Property"/>
    <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
    <rdfs:isDefinedBy rdf:resource="http://psi.ontopia.net/rdf2tm/"/>
  </owl:FunctionalProperty>

  <!-- ~~~~~ OBJECT-ROLE -->
  <owl:FunctionalProperty rdf:about="http://psi.ontopia.net/rdf2tm/#object-role" 
	rdfs:label="object role"
	rdfs:comment="Specifies the role type played by the object in associations 
        created from statements with this property.">
    <rdfs:domain rdf:resource="http://www.w3.org/2000/01/rdf-schema#Property"/>
    <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
    <rdfs:isDefinedBy rdf:resource="http://psi.ontopia.net/rdf2tm/"/>
  </owl:FunctionalProperty>

</rdf:RDF>