1、raising standards worldwide NO COPYING WITHOUT BSI PERMISSION EXCEPT AS PERMITTED BY COPYRIGHT LAW BSI Standards Publication BS ISO/IEC 19756:2011 Information technology Topic Maps Constraint Language (TMCL)BS ISO/IEC 19756:2011 BRITISH STANDARD National foreword This British Standard is the UK impl
2、ementation of ISO/IEC 19756:2011. The UK participation in its preparation was entrusted to Technical Committee IST/41, Document description and processing language. A list of organizations represented on this committee can be obtained on request to its secretary. This publication does not purport to
3、 include all the necessary provisions of a contract. Users are responsible for its correct application. BSI 2011 ISBN 978 0 580 65960 7 ICS 35.060 Compliance with a British Standard cannot confer immunity from legal obligations. This British Standard was published under the authority of the Standard
4、s Policy and Strategy Committee on 31 August 2011. Amendments issued since publication Date T e x t a f f e c t e dBS ISO/IEC 19756:2011Reference number ISO/IEC 19756:2011(E) ISO/IEC 2011INTERNATIONAL STANDARD ISO/IEC 19756 First edition 2011-06-15 Information technology Topic Maps Constraint Langua
5、ge (TMCL) Technologies de linformation Plans relatifs des sujets Contraintes de langage (TMCL) BS ISO/IEC 19756:2011 ISO/IEC 19756:2011(E) COPYRIGHT PROTECTED DOCUMENT ISO/IEC 2011 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form
6、or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from either ISO at the address below or ISOs member body in the country of the requester. ISO copyright office Case postale 56 CH-1211 Geneva 20 Tel. + 41 22 749 01 11 Fax + 41 22 749 09 47
7、 E-mail copyrightiso.org Web www.iso.org Published in Switzerland ii ISO/IEC 2011 All rights reservedBS ISO/IEC 19756:2011 ISO/IEC 2011 All rights reserved iiiContents Page Foreword . v Introduction vi 1 Scope 1 2 Normative references 1 3 Notation and Conventions. 1 3.1 General. 1 3.2 tmdm:subject.
8、2 3.3 Following an Association. 2 3.4 Following an Association to Roles of Given Type 2 3.5 Playing a Role. 2 3.6 Being a Subtype 2 3.7 Being an Instance. 2 3.8 Matching a Regular Expression 2 3.9 The Value of an Occurrence 2 3.10 Comparison of iso:ctm-integer values. 3 4 Validation Semantics 3 5 TM
9、CL Syntax. 3 6 TMCL Declarations 4 6.1 General. 4 6.2 Topic Type. 4 6.3 Name Type. 4 6.4 Occurrence Type. 4 6.5 Association Type. 4 6.6 Role Type. 4 6.7 Overlap Declaration 5 7 TMCL Constraint Types 5 7.1 General. 5 7.2 Abstract Topic Type Constraint 5 7.3 Subject Identifier Constraint 5 7.4 Subject
10、 Locator Constraint 6 7.5 Item Identifier Constraint. 7 7.6 Topic Name Constraint. 7 7.7 Variant Name Constraint 8 7.8 Topic Occurrence Constraint. 9 7.9 Topic Role Constraint. 9 7.10 Scope Constraint. 10 7.11 Scope Required Constraint 11 7.12 Reifier Constraint 12 7.13 Topic Reifies Constraint. 12
11、7.14 Association Role Constraint 13 7.15 Role Combination Constraint 14 7.16 Occurrence Data Type Constraint. 15 7.17 Unique Value Constraint 15 7.18 Regular Expression Constraint. 16 8 Additional TMCL Templates. 16 9 User-defined Constraints. 16 9.1 General. 16 9.2 Denial Constraint. 17 9.3 Require
12、ment Constraint. 17 10 Schema Documentation. 17 10.1 General. 17 10.2 The Schema Topic 17ISO/IEC 19756:2011(E) BS ISO/IEC 19756:2011 ISO/IEC 19756:2011(E) iv ISO/IEC 2011 All rights reserved10.3 Documentation Occurrences. 18 10.4 The Topic Map Topic Type 19 11 Conformance. 19 Annex A (normative) TMC
13、L Templates CTM 20 Annex B (normative) TMCL meta-schema 25BS ISO/IEC 19756:2011 ISO/IEC 2011 All rights reserved vForeword ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. Natio
14、nal bodies that are members of ISO or IEC participate in the development of International Standards through technical committees established by the respective organization to deal with particular fields of technical activity. ISO and IEC technical committees collaborate in fields of mutual interest.
15、 Other international organizations, governmental and non-governmental, in liaison with ISO and IEC, also take part in the work. In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1. International Standards are drafted in accordance with the
16、rules given in the ISO/IEC Directives, Part 2. The main task of the joint technical committee is to prepare International Standards. Draft International Standards adopted by the joint technical committee are circulated to national bodies for voting. Publication as an International Standard requires
17、approval by at least 75 % of the national bodies casting a vote. Attention is drawn to the possibility that some of the elements of this document may be the subject of patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights. ISO/IEC 19756 was prepared b
18、y Joint Technical Committee ISO/IEC JTC 1, Information technology, Subcommittee SC 34, Document description and processing languages. ISO/IEC 19756:2011(E) BS ISO/IEC 19756:2011 ISO/IEC 19756:2011(E) vi ISO/IEC 2011 All rights reservedIntroduction TMCL is a constraint language for Topic Maps, allowi
19、ng definitions of Topic Maps schemas to be written in a precise and machine-readable form. This makes it possible to validate a topic map against a TMCL schema to see if it conforms to the constraints in the schema, and also enables other uses, such as schema-driven editors, object mappings, and so
20、on. TMCL is defined as a Topic Maps vocabulary consisting of a number of topic, association, occurrence, and role types, identified by Published Subject Identifiers (PSIs), and defined using English prose. TMCL defines the concept of validation, by which a given topic map is valid according to a sch
21、ema if it conforms to all the constraints in that schema and a number of global validation rules which apply to all topic maps independent of schema. TMCL does not have any syntax of its own, since it is defined simply as a Topic Maps vocabulary. However, a number of CTM templates are defined in thi
22、s International Standard in order to facilitate authoring of TMCL schemas using CTM.BS ISO/IEC 19756:2011 INTERNATIONAL STANDARD ISO/IEC 2011 All rights reserved 1Information technology Topic Maps Constraint Language (TMCL) 1 Scope This International Standard defines a Topic Maps vocabulary for repr
23、esenting constraints on Topic Maps instance data and CTM templates for authoring TMCL schemas. It does not define a syntax for representing constraints on Topic Maps instance dat 2 Normative references The following referenced documents are indispensable for the application of this document. For dat
24、ed references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies. NOTE Each of the following documents has a unique identifier that is used to cite the document in the text. The unique identifier consists of the p
25、art of the reference up to the first comma. XML Schema-2, XML Schema Part 2: Datatypes Second Edition, W3C Recommendation, 28 October 2004, available at 3 Notation and Conventions 3.1 General The TMCL validation rules are defined in English prose using constructs from ISO/IEC 13250-2:2006 (the TMDM)
26、, and written according to certain conventions, whereby some of the phrases in the text have particular interpretations. These phrases and their interpretations are given in the following clauses. Throughout this clause the defined phrases contain placeholders given as variables (written thus: v) in
27、 the definitions. When the phrases are used, these placeholders are defined either by reference to topics already defined in the context where the phrase is used, or using a qname (an identifying token of the form foo:bar). Qnames are expanded into full IRIs using the prefix declarations in Clause 5
28、, and refer to the topic item which has that IRI in its subject identifiers property. The following namespace prefixes are used throughout this International Standard: %prefix tmcl http:/psi.topicmaps.org/tmcl/ %prefix tmdm http:/psi.topicmaps.org/iso13250/model/ %prefix xsd http:/www.w3.org/2001/XM
29、LSchema# Thus, tmdm:bar is a shorthand for the IRI http:/psi.topicmaps.org/iso13250/model/bar. Throughout this International Standard the syntax foo, that is, a name in square brackets, not italicized, is used to refer to property names from ISO/IEC 13250-2:2006 (the TMDM). 1) To be published a. ISO
30、/IEC 13250-2:2006, Information technology Topic Maps Part 2: Data model ISO/IEC 18048, Information technology SGML applications Topic Map Query Language (TMQL) 1) ISO/IEC 13250-6, Information technology Topic Maps Part 6: Compact syntaxISO/IEC 19756:2011(E)BS ISO/IEC 19756:2011 2 ISO/IEC 2011 All ri
31、ghts reserved 3.2 tmdm:subject The topic tmdm:subject (http:/psi.topicmaps.org/iso13250/model/subject) represents the concept of a subject as defined in ISO/IEC 13250-2:2006. It is the type of which all topics, statements, and association roles are instances, and the common supertype of all types. I
32、n TMCL it is used in constraints to make it clear that any topic whatsoever may appear in a particular position in an ontology. 3.3 Following an Association To follow an association of type at from a topic t means traversing all associations of type at. A is the set of all the association items a in
33、 the parent properties of all the role items in the roles played property of t where as type property contains at or some subtype of at. The end result of the traversal is the set of topic items in the player property of each role item r in as roles property, except where r is contained in ts roles
34、played property. 3.4 Following an Association to Roles of Given Type To follow an association of type at to roles of type rt from a topic t means traversing all associations of type at. A is the set of all the association items a in the parent properties of all the role items in the roles played pro
35、perty of t where as type property contains at or a subtype of at. The end result of the traversal is the set of topic items in the player property of each role item r in as roles property, except where r is contained in ts roles played property, or where rs type property does not contain rt or some
36、subtype of rt. 3.5 Playing a Role A topic t is said to play a role of type rt in an association of type at when ts roles played property contains at least one role item r whose type property contains rt (or some subtype of rt) and rs parent property contains an association item whose type property c
37、ontains at or some subtype of at. 3.6 Being a Subtype A topic type t1 is said to be an subtype of the topic type t2 if following the association type tmdm:supertype-subtype from t1 to roles of type tmdm:supertype produces either t2 or a subtype of t2. If t2 is tmdm:subject then t1 is a subtype of it
38、 even if the necessary tmdm:supertype-subtype associations are not present. 3.7 Being an Instance A topic t is said to be an instance of the topic type tt if following the association type tmdm:type-instance from t produces either tt, a subtype of tt, or if tt is tmdm:subject. A statement s (as defi
39、ned in ISO/IEC 13250-2:2006) is said to be an instance of the statement type st if the ss type property contains either st, a subtype of st, or if st is tmdm:subject. 3.8 Matching a Regular Expression A string s matches a regular expression r if the string is a member of the set of strings L(r) deno
40、ted by r as defined in appendix F of XML Schema-2. 3.9 The Value of an Occurrence The value of a topic ts occurrence of type ot is referred to as v, and produced by finding the occurrence item o in ts occurrences property whose type property contains ot or some subtype of ot. If no such occurrence e
41、xists there is no given value. It is an error if there is more than one such occurrence. ISO/IEC 19756:2011(E) BS ISO/IEC 19756:2011 3 ISO/IEC 2011 All rights reserved 3.10 Comparison of iso:ctm-integer values When comparing tmcl:card-min and tmcl:card-max values, in addition to the ordinary integer
42、s, one may encounter the special value * of datatype iso:ctm-integer. This special value is used to indicate unlimited cardinality, and compares as larger than any specific integer. 4 Validation Semantics This International Standard defines two kinds of rules: Constraint validation rules, which spec
43、ify how to validate the constraint represented by an individual topic that is an instance of some subclass of tmcl:constraint. Global validation rules, which are not tied to any specific constraint topic, and which apply to the entire topic map. A schema is a set of constraint topics, declaration to
44、pics, topic types, association types, role types, name types, and occurrence types contained in a topic map. A topic map is valid according to a schema if the topic map is valid according to each individual constraint in the schema, and if the topic map is valid according to all the global validatio
45、n rules specified in this International Standard. NOTE 1 This is a very strict form of validation, which may not be suitable for all situations. Implementations may allow users to turn off any set of constraints they choose in order to allow more flexible forms of validation. A topic map is valid ac
46、cording to a constraint if the topic map satisifies the constraint validation rule defined for the constraint type of which the constraint topic is an instance. NOTE 2 TMCL does not dictate when constraints should be applied, nor does it state what it means to a controlling application when it is fo
47、und that a given constraint is violated. The validation rules defined in this International Standard assume that the schema and the instance data are located in the same topic map. If this is not the case, implementations shall behave as though the schema and instance topic maps were merged. This in
48、cludes any schemas included by using tmcl:includes-schema, even though these schemas may physically reside in other topic maps. Implementations shall also behave as though the topic map in Annex B were merged into the topic map being validated. 5 TMCL Syntax TMCL has no syntax of its own, but since
49、TMCL schemas are represented as topic maps, any Topic Maps representation can be used to create a TMCL schema. The schema shall, however, be valid according to the TMCL meta-schema in Annex B. The values of all occurrences of type tmcl:regexp shall be valid regular expressions as defined in XML Schema-2. Throughout this International Standard all examples are given using the CTM syntax (defined in ISO/IEC 13250-6), and to facilitate the authoring of TM