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 [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].
A constraint is a single TMCL expression.
A schema is a collection of constraints.
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.
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.
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.
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.
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.
The TMCL data model is formally defined using the following infoset notation, based on the XML Information Set [XMLinfoset].
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:
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:
[ED note 1: Does ConstrainerExpression need to be a collection?]
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:
[ED Note 2: In progress.]
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>
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.
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.
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]]}
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.
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}
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.