ISO/IEC JTC 1/SC34 N0408

ISO/IEC logo

ISO/IEC JTC 1/SC34

Information Technology --

Document Description and Processing Languages

Title: Topic Map Constraint Language
Source: Graham Moore, Mary Nishikawa, JTC1/SC34
Project: 19756 Topic Map Constraint Language
Project editor: Graham Moore, H. Holger Rath
Status: Draft
Action: For Review and Comment
Date: 2003-Oct-20
Summary:
Distribution: National Bodies and Liaisons of SC34
Refer to: N0405rev Topic Map Constraint Language (TMCL) Requirements and Use Cases
Version: $Id: tmcl.html,v 1.6 2003/10/26 14:56:45 mariyo Exp $

Topic Map Constraint Language

NOTE : This document is a straw man proposal that will evolve into TMCL. No part of this document is fixed including the general approach presented. It is intended as an initial effort that attempts to address the requirements that have been captured and provoke discussion and development of ideas. The editors felt that it was useful to have an initial proposal from which to begin the development process.

1. Introduction

1.1 Overview

Topic Map Constraint Language [TMCL] provides a means to express constraints on topic maps conforming to ISO/IEC 13250:2000 [13250]; these will be over and above the constraints currently defined in the Topic Map Data Model [DM].

1.2 Definitions

Constraint

A constraint is a single TMCL expression.

Schema

A schema is a collection of constraints.

Constraint Validation

Constraint validation is the act of testing a given topic map constraint against a given topic map. If the map satisfies the constraint, then it can be said that this map has been successfully validated.

Schema Validation

If all constraints contained within a schema can be successfully validated against a topic map then the topic map can be said to be valid with respect to the schema.

Selector

A selector is a TMQL (Topic Map Query Language) [TMQLreq] expression that identifies one or more topic map data model information items that will be constrained.

Constrainer

A constrainer is a TMQL expression that identifies one or more topic map data model information items that MUST or MAY exist (depending on validation type) given a selector.

2. TMCL

2.1 Introduction

TMCL is designed to allow users to constrain any aspect of the topic map data model [DM]. TMCL adopts TMQL [TMQLreq] as a means to express both the topic map constructs to be constrained and topic map structures that must exist in order for the constraint to be met. TMCL uses TMQL statements in order to construct constraints. This expressive model is called TMCL. TMCL also defines TMCL-Lite. TMCL-Lite defines a core set of constraint types that represent the most common type of constraints. TMCL-Lite allows different levels of conforming schema validators to exist. TMCL-Lite constructs can be mapped to equivalent TMQL expressions.

As well as defining TMCL and TMCL-Lite, this standard also defines how a TMCL schema can be represented as a Topic Map , in its XML representation, and how Topic Map instances reference a TMCL schema.

2.2 Model

TMCL has a data model that represents a schema consisting of a set of constraints. >From this data model, validation semantics (operational behavior), serialization, a topic map representation and schema merging are all to be defined. TMCL allows for the definition of Topic Map schemas. A schema consists of a set of constraints. Each constraint is either a generic constraint or a TMCL-Lite constraint. TMCL-Lite constraints can be mapped to generic constraints but make high level semantics more accessible to users. TMCL-Lite also has the property of detailed introspection that is essential for the construction of schema driven applications.

The TMCL data model is formally defined using the following infoset notation, based on the XML Information Set [XMLinfoset].

Schema Information Item

The schema information item collects together a set of constraints that can be used to validate a topic map. There is exactly one schema information item in each information set.

Schema information items have the following properties:

  1. [Constraints]: A set of constraint items. This is the set of all constraints belong to this schema.

Constraint Information Item

The constraint information item consists of two TMQL expressions that are used to validate a topic map data model instance. A constraint is not dependent on any other constraints.

Constraint information items have the following properties:

  1. [SelectorExpression]: A string that contains a valid TMQL expression. This TMQL expression is used to locate topic map data model information items to be constrained.
  2. [ConstrainerExpression]: A string that contains a valid TMQL expression. This expression is an assertion about topic map information items located by the selector. If these assertions are false then the constraint has been violated.

[ED note 1: Does ConstrainerExpression need to be a collection?]

2.3 Validation Semantics

The data model described in 2.2 provides the basis for the operational aspects of TMCL. TMCL is used to constrain topic map data model instances. If the topic map is valid in respect to the constraints then validation is said to have succeeded. More formally it can be said that :


Given:

  TopicMap: tm1

  Schema  : sc1

Then:

  Validate(tm1, sc1) => true | (false, constraintsViolated)

Note: we might want to return a topic map here rather than true or false.

The Validate function is defined as follows:

  1. Evaluates the 'selector' TMQL expression. This results in one or more bindings of topic map information items to variables.
  2. For each value of each bound variable in the selector that also occurs in the constrainer expression, the constrainer expression is evaluated.
  3. If the constrainer expression returns an empty result set, i.e., no matches were found, then the topic map data model instance does not meet the constraint.
  4. The process is repeated for each constraint in the schema. The topic map is valid with respect to the schema if all constraints are valid.

2.4 TMCL Lite

[ED Note 2: In progress.]

2.5 XML Serialization

To allow interchange of TMCL the following XML DTD is defined.


<!-- DTD for TMCL -->

<!ELEMENT schema (constraint*) >

<!ELEMENT constraint (selectorExpression , constrainerExpression) >

<!ELEMENT selectorExpression #PCDATA>

<!ELEMENT constrainerExpression #PCDATA>

Mapping to the Info Set Model

The schema element corresponds to the Schema information item. When a schema element is processed, a schema information item is created. All subsequent constraint information items that are created are added to the set of constraints.

The constraint element corresponds to the constraint information item. Each constraint element processed results in the creation of a constraint information item that is added to the set of constraints that belongs to the current schema information item.

The selectorExpression element corresponds to the selectorExpression property of the constraint information item. The data contained within this element becomes the value of the selectorExpression property. The current constraint is the last constraint information item to be created as a result of processing a constraint element.

The constrainerExpression element corresponds to the constrainerExpression property of the constraint information item. The data contained within this element becomes the value of the constrainerExpression property. The current constraint is the last constraint information item to be created as a result of processing a constraint element.

2.6 Topic Map Representation

As well as having a standalone XML representation, TMCL can also be expressed as an instance of the topic map data model. It then follows that TMCL can be serialized to XTM.

The topic map representation of TMCL is defined using a number of Published Subject Indicators, as specified by the OASIS Topic Maps Published Subjects Technical Committee of OASIS [PSI], to construct well known topic and association types for the purpose of this representation.

PSIs for TMCL

http://www.isotopicmaps.org/tmcl/tmcl.html#schema

A TMCL schema consists of a set of TCML constraints that can be used for the validation of topic map data model instances. It is used to identify topics that are of type TMCL schema.

http://www..isotopicmaps.org/tmcl/tmcl.html#constraint

A TMCL constraint that can be used for the validation of topic map data model instances. It is used in the topic map representation to identify topics that are a single topic map constraint.

http://www.isotopicmaps.org/tmcl/tmcl.html#schemaHasConstraint

Each schema is related to a set of constraints. This PSI identifies an association type that connects schema topic instances with topic instances of type Constraint.

http://www.isotopicmaps.org/tmcl/tmcl.html#selectorExpression

Each constraint has exactly one selectorExpression. This PSI is used to type an occurrence of a topic of type constraint in order to capture this property. The value of the occurrence must be an internal data occurrence value.

http://www.isotopicmaps.org/tmcl/tmcl.html#constrainerExpression

Each constraint has exactly one constrainerExpression. This PSI is used to type an occurrence of a topic of type constraint in order to capture this property. The value of the occurrence must be an internal data occurrence value.

The above PSIs are used within a topic map data model instance to represent the information items for TMCL. Each schema information item is represented by a topic of type schema. Each constraint information item is represented by topics of type constraint. The set of constraints is modeled by connecting schema instances of constraint instances using the associations of type schemaHasConstraint.

The TMQL for selectors and constrainers is modeled as occurrence data on constraint topics. The occurrences are typed using the selectorExpression and constrainerExpression, respectively.

The following Linear Topic Map [LTM] fragment demonstrates this.


[schema     = "TMCL Schema"     @ "http://www.isotopicmaps.org/tmcl/tmcl.html#schema" ]

[constraint = "TMCL Constraint" @ "http://www.isotopicmaps.org/tmcl/tmcl.html#constraint" ]

[schemaHasConstraint = "TMCL Schema has constraint" @ "http://www.isotopicmaps.org/tmcl/tmcl.html#schemaHasConstraint" ]

[selectorExpression = "TMCL Selector Expression" @ "http://www.isotopicmaps.org/tmcl/tmcl.html#selectorExpression" ]

[constrainerExpression = "TMCL Constrainer Expression" @ "http://www.isotopicmaps.org/tmcl/tmcl.html#constrainerExpression" ]

[myschema     : schema = "schema to constrain my map"]

[myconstraint : constraint = "my constraint "]

schemaHasConstraint(myschema : schema, myconstraint : constraint)

{myconstraint, selectorExpression,    [[TMQL Expression]]}

{myconstraint, constrainerExpression, [[TMQL Expression]]}

2.7 Topic Map Schema References

TMCL enables topic map authors to specify a schema to which the topic map is conformant. This is achieved by reifying the topic map with a topic and assigning an occurrence to that topic of type TMCLSchemaReference.

The following PSI is used to denote the occurrence type for schema references.

http://www.isotopicmaps.org/tmcl/tmcl.html#TMCLSchemaReference

This is used to type a occurrence on a topic that reifies the topic map in order to reference the schema for this topic map instance. The value of the occurrence must reference a valid TMCL XML representation or a topic of type Schema.

2.8 Schema Composition

Schema composition is the ability to take two or more schemas and compose them into a single schema. Given that a schema consists of a set of constraints, schema composition merely takes all the constraints from all schemas being composed and returns a single schema that consists of all constraints. Applications are free to identify and remove redundant constraints and through exceptions should any constraints be contradictory.

More formally:


Given

  Schema : s1, s2

  Constraint : c1, c2, c3, c4, c5

  s1 := {c1, c2, c3}

  s2 := {c4, c4}

That

  Compose(s1, s2) => s3

  s3 := {c1, c2, c3, c4, c5}

3 Summary

TMCL uses TMQL to allow topic map authors to constrain topic map data model instances. TMCL-Lite provides an additional mechanism to specify common-type based constraints. TMCL-Lite also facilitates schema introspection. In both cases a simple and expressive validation model clearly defined the semantics that a compliant TMCL processor must support.

4 References

  1. [13250] ISO/IEC 13250:2002 Topic Maps. ISO, Geneva, 2002.
  2. [TMCL] Summary of Voting on SC 34 N 226 - CD Ballot for Topic Map Constraint Language (New JTC 1 NP Number - ISO/IEC 19756). ISO/IEC JTC1 SC34 N0259. 4 October 2002.
  3. [TMQLreq] TMQL requirements (1.0.0). ISO/IEC JTC1 SC34 N0249. Hans Holger Rath, Lars Marius Garshol, 29 August 2001.
  4. [DM] The Standard Application Model for Topic Maps. ISO/IEC JTC1 SC34 N0396. Lars Marius Garshol, Graham Moore, 3 April 2003.
  5. [OWL] Web Ontology Language (OWL) Guide Version 1.0, W3C Candidate Recommendation. Michael K. Smith, Chris Welty, Deborah McGuinness, World Wide Web Consortium. 18 August 2003.
  6. [W3C Schema] XML Schema Part 2: Datatypes W3C Recommendation, Paul V. Biron, Ashok Malhotra, World Wide Web Consortium. 10 May 2001.
  7. [LTM] Linear Topic Map Notation: Definition and introduction version 1.2, Lars Marius Garshol. Ontopia AS. 15 May 2002.
  8. [PSI] Published Subjects: Introduction and Basic Requirements, OASIS Published Subjects Committee Recommendation, Steve Pepper, Editor. OASIS. 24 June 2003.
  9. [XMLinfoset] XML Information Set, W3C Recommendation. J. Cowan and R. Tobin, Editors. World Wide Web Consortium. 24 October 2001.