ISO/IEC JTC1/SC34N0
Title: | Topic Maps — XML Syntax |
---|---|
Source: | Lars Marius Garshol, Graham Moore, JTC1 / SC34 |
Project: | ISO 13250: Topic Maps |
Project editor: | Lars Marius Garshol, Graham Moore |
Status: | Final committee draft |
Action: | For review |
Date: | 2005-07-20 |
Summary: | |
Distribution: | SC34 and Liaisons |
Refer to: | |
Supercedes: | |
Reply to: | Dr. James David Mason (ISO/IEC JTC1/SC34 Chairman) Y-12 National Security Complex Information Technology Services Bldg. 9113 M.S. 8208 Oak Ridge, TN 37831-8208 U.S.A. Telephone: +1 865 574-6973 Facsimile: +1 865 574-1896 E-mail: mailto:mxm@y12.doe.gov http://www.y12.doe.gov/sgml/sc34/sc34oldhome.htm Mr. G. Ken Holman (ISO/IEC JTC 1/SC 34 Secretariat - Standards Council of Canada) Crane Softwrights Ltd. Box 266, Kars, ON K0A-2E0 CANADA Telephone: +1 613 489-0999 Facsimile: +1 613 489-0995 Network: jtc1sc34@scc.ca |
ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National 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. 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 rules given in the ISO/IEC Directives, Part 2.
ISO/IEC 13250-3 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information Technology, Subcommittee SC 34, Document Description and Processing Languages.
ISO/IEC 13250 consists of the following parts, under the general title Topic Maps:
XTM (XML Topic Maps) 1.1 is a syntax for the interchange of Topic Maps. The syntax is not designed to be extended or modified. Ease of human authoring was not prioritized during the design of XTM, and consequently it is not recommended to edit the syntax directly.
This document should be read in conjunction with [ISO/IEC 13250-2] since the interpretation of the XTM syntax is defined through a mapping from the syntax to the data model there defined. Informative guidance on how to serialize instances of the data model to the XTM syntax is also provided.
XTM 1.1 is a revision of the XTM 1.0 syntax defined in ISO/IEC 13250:2003[1] and [XTM1.0]. A description of the differences between the two versions can be found in Annex E.
This document defines an XML-based interchange syntax for Topic Maps, which can be used to interchange instances of the data model defined in [ISO/IEC 13250-2]. It also defines a mapping from the interchange syntax to the data model. The syntax is defined with a RELAX-NG schema, and more precision is provided through the mapping to the data model, which effectively also defines the interpretation of the syntax.
The following referenced documents are indispensable for the application of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.
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 part of the reference up to the first comma.
ISO/IEC 13250-2, Topic Maps — Data Model, http://www.isotopicmaps.org/sam/
W3C XML, Extensible Markup Language (XML) 1.0 (Third Edition), W3C Recommendation, 4 February 2004, http://www.w3.org/TR/2004/REC-xml-20040204
W3C XML-Names, Namespaces in XML, W3C Recommendation, 14 January 1999, http://www.w3.org/TR/1999/REC-xml-names-19990114/
W3C XLink, XML Linking Language (XLink) Version 1.1, W3C Working Draft, 28 April 2005, http://www.w3.org/TR/2005/WD-xlink11-20050428/
W3C XBase, XML Base (XBase) Version 1.0, W3C Recommendation, 27 June 2001, http://www.w3.org/TR/2001/REC-xmlbase-20010627/
W3C XPointer, XPointer Framework Version 1.0, W3C Recommendation, 25 March 2003, http://www.w3.org/TR/2003/REC-xptr-framework-20030325/
W3C XML-Infoset, XML Information Set (Second Edition), W3C Recommendation, 4 February 2004, http://www.w3.org/TR/2004/REC-xml-infoset-20040204
W3C Canonical XML, Canonical XML Version 1.0, W3C Recommendation, 15 March 2001, http://www.w3.org/TR/2001/REC-xml-c14n-20010315
ISO/IEC 19757-2, Document Schema Definition Languages (DSDL) — Part 2: Grammar-based validation — RELAX NG, http://www.relaxng.org
IETF RFC 3986, Uniform Resource Identifiers (URI): Generic Syntax, Internet Standards Track Specification, January 2005, http://www.ietf.org/rfc/rfc3986.txt
IETF RFC 3987, Internationalized Resource Identifiers (IRIs), Internet Standards Track Specification, January 2005, http://www.ietf.org/rfc/rfc3987.txt
XTM1.0, XML Topic Maps (XTM) 1.0 Specification, Steve Pepper, Graham Moore, TopicMaps.Org, 2001, http://www.topicmaps.org/xtm/1.0/
For the purposes of this document, the following terms and definitions apply.
These definitions are harvested from the source of this document, and for those unfamiliar with the terminology the definitions are best read in context. They are repeated here for reference.
the process of building an instance of an implementation's internal representation of the data model from an instance of a Topic Maps syntax
The process of exporting Topic Maps from an implementation's internal representation of the data model to an instance of a Topic Maps syntax
the syntax defined in this document
XML document that conforms to the XTM syntax
The acronym XTM is often used to refer to the syntax defined in this document. Its full name is XML Topic Maps. An XTM document is an XML document that conforms to the XTM syntax. This clause defines the syntax of XTM documents using prose and a RELAX-NG schema in compact syntax [ISO/IEC 19757-2]. The full schema can be found in Annex A, a DTD in Annex B, and a W3C XML Schema in Annex C.
The XTM syntax represents all references as simple XLinks conformant to the XLink specification [W3C XLink]. However, since the xlink:type attribute is not required XML documents can be valid XTM documents without being valid according to XLink. The inclusion of the xlink:type attribute on all XLink elements is encouraged for compatibility with XLink.
The following declarations are used throughout the schema for brevity.
default namespace = "http://www.topicmaps.org/xtm/1.0/" namespace xlink = "http://www.w3.org/1999/xlink" namespace xtm = "http://www.topicmaps.org/xtm/1.0/" datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes" start = topicMap topic-reference = topicRef | resourceRef | subjectIndicatorRef id = attribute id { xsd:ID } href = attribute xlink:href { xsd:anyURI } type = attribute xlink:type { "simple" } any-markup = (text | element * - xtm:* { attribute * { text }*, any-markup* })* |
All xlink:href attributes shall contain relative or absolute IRIs valid according to [IETF RFC 3986] and [IETF RFC 3987].
The topicMap element type is the document element of all XTM documents. It acts as a container for the topic map, and can be used to reify it, but has no further significance.
The topicMap element type is declared as follows:
topicMap = element topicMap { id?, xmlbase?, version, (topic | association | mergeMap)* } xmlbase = attribute xml:base { xsd:anyURI } version = attribute version { "1.1" } |
The attributes have the following meanings:
A unique identifier for the topic map within the document. Used to refer to the topic map.
The version number of the XTM syntax to which the document conforms. For XTM 1.1 documents this shall be "1.1".
An attribute used to override the base IRI of the document inside the topicMap element, as specified in [W3C XBase].
Implementations of XTM 1.1 are required to also support XTM 1.0 documents. It is assumed that any XTM document that does not have a version attribute on the topicMap element is an XTM 1.0 document. XTM 1.0 documents are mapped to the data model in the same way as XTM 1.1 documents, but follow the XTM 1.0 DTD rather than the RELAX-NG schema of XTM 1.1.
An XTM 1.0 document is considered valid provided:
It conforms to [W3C XML] and [W3C XML-Names].
It conforms to [XTM1.0].
It can be deserialized according to the procedure defined in Clause 5 without causing any errors or violating any data model constraints.
The topic element type is used to represent topics, and acts as a container and point of reference for topic information. The child elements of the topic element provide some topic characteristic assignments, as well as other properties, while association roles played by the topic are specified outside the topic element.
The topic element type is declared as follows:
topic = topic-with-id | topic-without-id topic-with-id = element topic { id, instanceOf*, subjectIdentity?, (baseName | occurrence)* } topic-without-id = element topic { instanceOf*, subjectIdentity2, (baseName | occurrence)* } |
The declarations for this element are quite complex in order to enforce that a topic element must have either an id attribute or a non-empty subjectIdentity child element. This ensures that all topics will have a declared identity.
The id attribute provides a unique identifier for the topic, which is used to refer to it.
The subjectIdentity element type may in its child elements contain formal declarations of the subject of the topic defined by the parent element.
The subjectIdentity element type is declared as follows:
subjectIdentity = element subjectIdentity { id?, topic-reference* } subjectIdentity2 = element subjectIdentity { id?, topic-reference+ } |
The subjectIdentity2
declaration is used only inside
topic elements with no id attribute.
The id attribute is ignored during deserialization.
The baseName element type is used to add topic names to the topic represented by the parent topic element. The child elements of the baseName element provide the property values of the topic name item.
The baseName element type is declared as follows:
baseName = element baseName { id?, instanceOf?, scope?, baseNameString, variant* } |
The id attribute provides a unique identifier for the topic name, which can be used to refer to it.
The baseNameString element type is used to provide the value of the base name.
The baseNameString element type is declared as follows:
baseNameString = element baseNameString { id?, text } |
The id attribute is ignored during deserialization.
The variant element type is used to add a variant name to a topic name. Further variant elements may appear as child elements of the parent variant element; these elements represent variant names which will be added to the same topic name, with scope inherited from the containing variant element.
The variant element type is declared as follows:
variant = element variant { id?, parameters, variantName?, variant* } |
The id attribute provides a unique identifier for the variant name, which is used to refer to it.
The variantName element type is used to contain the element that specifies the information resource that is the actual variant name.
The variantName element type is declared as follows:
variantName = element variantName { id?, (resourceRef | resourceData) } |
The id attribute is ignored during deserialization.
The parameters element type is used to specify the scope of a variant name, in addition to the scope it inherits from its parent topic name or variant name.
The parameters element type is declared as follows:
parameters = element parameters { id?, topic-reference+ } |
The id attribute is ignored during deserialization.
The scope element type is used to assign scope to the topic map construct represented by the parent element.
The scope element type is declared as follows:
scope = element scope { id?, topic-reference+ } |
The id attribute is ignored during deserialization.
The instanceOf element type is used to assign a type to the topic map construct represented by its parent element. The type is always a topic, indicated by the instanceOf element's child element.
The instanceOf element type is declared as follows:
instanceOf = element instanceOf { id?, topic-reference } |
The id attribute is ignored during deserialization.
The occurrence element type is used to assign an occurrence to the topic defined by the parent element.
The occurrence element type is declared as follows:
occurrence = element occurrence { id?, instanceOf?, scope?, ( resourceRef | resourceData ) } |
The id attribute is used to refer to the occurrence.
The resourceData element type represents an information resource in the form of content contained within the XTM document. This information resource may be either a variant name or an occurrence, and it can have a datatype.
The resourceData element type is declared as follows:
datatype = attribute datatype { xsd:anyURI } resourceData = element resourceData { id?, datatype?, any-markup } |
The attributes have the following meanings:
This attribute is ignored during deserialization.
Contains an IRI identifying the datatype of the resource that is represented by the resourceData element.
The association element type represents associations. The member child elements provide the association roles of the association.
The association element type is declared as follows:
association = element association { id?, instanceOf?, scope?, member+ } |
The id attribute is used to refer to the association.
The member element type is used to assign one or more association roles of the same type to the association created by the association parent element.
The member element type is declared as follows:
member = element member { id?, roleSpec?, topic-reference* } |
The id attribute is ignored when there is more than one
topic-reference
child, but used to refer to the
member element when there is one or zero such children.
The roleSpec element type is used to assign the association role type to the association roles defined by the member parent element.
The roleSpec element type is declared as follows:
roleSpec = element roleSpec { id?, topic-reference } |
The id attribute is ignored during deserialization.
The topicRef element type refers to a topic, either within the same XML document or externally. The signficance of the reference depends on the context; for detailed descriptions of the different cases, see Clause 5.
The topicRef element type is declared as follows:
topicRef = element topicRef { id?, href, type? } |
The attributes have the following meanings:
This attribute is ignored during deserialization.
Contains the IRI reference that is the topic reference. This IRI reference shall conform to the requirements of XLink and have a fragment identifier which shall be what [W3C XPointer] calls a shorthand pointer (formerly barename).
This attribute, if included, declares the topicRef element to be a simple XLink link.
The subjectIndicatorRef element type refers to a subject indicator. The signficance of the reference depends on the context; for detailed descriptions of the different cases, see Clause 5.
The subjectIndicatorRef element type is declared as follows:
subjectIndicatorRef = element subjectIndicatorRef { id?, href, type? } |
The attributes have the following meanings:
This attribute is ignored during deserialization.
Contains the IRI reference of the subject indicator being referred to. The IRI reference shall conform to the requirements of XLink. If this IRI reference contains a fragment identifier the fragment identifier shall be what [W3C XPointer] calls a shorthand pointer (formerly barename).
This attribute, if included, declares the subjectIndicatorRef element to be a simple XLink link.
The resourceRef element type refers to an information resource. The signficance of the reference depends on the context; for detailed descriptions of the different cases, see Clause 5.
The resourceRef element type is declared as follows:
resourceRef = element resourceRef { id?, href, type? } |
The attributes have the following meanings:
This attribute is ignored during deserialization.
Contains the IRI reference of the information resource being referred to. The IRI reference shall conform to the requirements of XLink. If this IRI reference contains a fragment identifier the fragment identifier shall be what [W3C XPointer] calls a shorthand pointer (formerly barename).
This attribute, if included, declares the resourceRef element to be a simple XLink link.
The mergeMap element type refers to an external XTM document that is to be merged into the topic map that contains the mergeMap element. The child elements of the mergeMap element specify topics to be added to the scopes of all topic characteristic assignments in the topic map to be merged in.
The mergeMap element type is declared as follows:
mergeMap = element mergeMap { id?, href, type?, topic-reference* } |
The attributes have the following meanings:
This attribute is ignored during deserialization.
This attribute contains the IRI that refers to the XTM document to be merged into the current topic map. The IRI reference shall conform to the requirements of XLink. If it has a fragment identifier that identifier shall be what [W3C XPointer] calls a shorthand pointer (formerly barename).
This attribute, if included, declares the mergeMap element to be a simple XLink link.
The process of exporting Topic Maps from an implementation's internal representation of the data model to an instance of a Topic Maps syntax is known as serialization. The opposite process, deserialization is the process of building an instance of an implementation's internal representation of the data model from an instance of a Topic Maps syntax.
This clause defines how instances of the XTM syntax are deserialized into instances of the data model defined in [ISO/IEC 13250-2]. Serialization is only implicitly defined, although some guidance can be found in Annex D.
The input to the deserialization process is:
A document item as defined by [W3C XML-Infoset], representing an XTM document. (Information item properties from [W3C XML-Infoset] are referred to using [[property name]], in order to distinguish them from properties from [ISO/IEC 13250-2].)
An absolute IRI. This is the IRI from which the XTM document was retrieved, known as the document IRI. This IRI shall always be provided, as it is necessary in order to assign the item identifiers of the information items created during deserialization. If the XML document was not read from any particular IRI the application is responsible for providing an IRI considered suitable.
Deserialization is done by processing each element item in the
document item in document order. For each element item encountered the
operations specified in the clause about that element type are
performed. An input element item matches a clause in this document
when the [[namespace name]] property is set to
"http://www.topicmaps.org/xtm/1.0/"
, and the [[local name]]
matches the element type name given in that section's title.
This document requires an instance of the XML Information Set as input to the deserialization process, but in most cases the actual input will be an XML document. This document does not constrain how XML Information Set instances are built from XML documents, but assumes that in most cases this will be done by simply using an XML processor.
XML processors conformant to the XML Recommendation may produce different results given the same XML document, depending on whether they are validating or non-validating, and depending on which optional features they support. Reliance on any particular behaviour in the XML processors used by recipients is strongly discouraged.
This clause defines common processing rules used throughout this document. The rules are referenced from the sections they apply to.
The IRI of an element is computed by concatenating the document IRI, a
"#"
character, and the value of the [[normalized value]]
property of the attribute item in the [[attributes]] property of that
element item whose [[local name]] property is "id"
.
Creation of a IRI from an element information item in the XML Infoset
representing a reference is done by locating the attribute information
item in the element's [[attributes]] property whose [[namespace name]]
property is "http://www.w3.org/1999/xlink"
and whose
[[local name]] property is "href"
. The value of that
attribute information item's [[normalized value]] property is known as
v.
If v begins with a "#"
character, the
procedure below is followed.
Unescape v by replacing %HH
escape
sequences with the characters they represent, and the resulting
character sequence is decoded from UTF-8 to a sequence of abstract
Unicode characters.
Create an absolute IRI by concatenating the document URI with the string resulting from the previous step.
If v does not begin with a "#"
character, the
procedure below is followed.
Unescape v by replacing %HH
escape
sequences with the characters they represent, and the resulting
character sequence is decoded from UTF-8 to a sequence of abstract
Unicode characters.
The resulting string is turned into an absolute IRI by resolving it against the IRI in the [[base URI]] property of the element information item.
Whenever a new information item is created, those of its properties which have set values are initialized to the empty set; all other properties are initialized to null.
The IRI to the external information resource is resolved and the resource is parsed with an XML processor according to [W3C XML] to produce an XML Information Set according to [W3C XML-Infoset]. It is an error if the resource is not a well-formed XML document.
The XML Information Set is then deserialized into a data model instance using the procedure in Clause 5 with the document item and the IRI of the information resource as input. The data model instance is then returned as the result of processing.
A topic map item B loaded from an external reference is merged into another topic map item A currently being deserialized by:
Adding all topic items in B's [topics] property to A's [topics] property.
Adding all association items in B's [associations] property to A's [associations] property.
Adding topics and associations to A is may trigger further merges, as described in [ISO/IEC 13250-2].
XTM documents may contain arbitrary markup inside resourceData elements, and this markup is represented in the data model as a string. This section describes the string representation of embedded markup.
A string representation is produced from the embedded markup by applying the canonicalization process described in [W3C Canonical XML]. The input to the canonicalization process is an XPath node set (as [W3C Canonical XML] requires this). The node set is produced as described below:
Add XPath nodes for all element, attribute, and character information items that are descendants of the resourceData element.
Remove all namespace nodes attached to these element nodes where there is not at least one element or attribute node in the set with this namespace IRI and namespace prefix.
The second parameter to the canonicalization process is false (that is, comments are not included).
The output of the [W3C Canonical XML] is defined as a UTF-8-encoded octet sequence, but the output of the process defined above should be the equivalent string.
The topicMap element causes a topic map item to be created.
If the topicMap element has an id attribute an IRI is created, as defined in 5.2.2, and added to the [item identifiers] property of the topic map item.
If the topicMap element has an xml:base attribute this does not affect the data model instance being built, except insofar as it modifies the input XML Information Set.
If the topicMap element has a version attribute
its value shall be 1.1
, indicating an XTM 1.1 document. It
is an error for the value to be anything else. If the attribute is not
present the document is assumed to be an XTM 1.0 document, and
processed accordingly.
Once the entire topicMap element has been read, all topic
items in the resulting data model instance which were created from
member elements with no specified player are processed in
document order. For each topic item, add to its [item identifiers]
property the locator obtained by concatenating the document URI of the
member element the topic item was created from,
"#_"
, and n, where n is the lowest
positive integer that gives a locator not already assigned to the
[item identifiers] or [subject identifiers] property of some topic
item.
Finally, traverse the resulting data model instance to find all topic items (t) whose [subject identifiers] property contain a string (l) equal to that in the [item identifier] property of another information item (i). In each case, set t as the value of i's [reifier] property, and remove l from the [item identifiers] property of i and the [subject identifiers] property of t. It is an error if i's [reifier] property already contains a non-null value.
The topic element causes a topic item to be created and inserted into the [topics] property of the topic map item.
The id attribute causes a string to be created, as defined in 5.2.2, and added to the [item identifiers] property of the topic item.
The subjectIdentity element has no direct effect on the information set, but changes the interpretation of its child elements. The child elements are processed as follows:
For every resourceRef child, a string is produced according to the procedure described in 5.2.3. That string is then added to the [subject locators] property of the topic item created by the parent topic element.
For every subjectIndicatorRef child, a string is produced according to the procedure described in 5.2.3. That string is then added to the [subject identifiers] property of the topic item created by the parent topic element.
For every topicRef child a topic item is produced according to the rules of 5.16. That topic item is then merged with the topic item created from the parent topic element according to the rules of [ISO/IEC 13250-2], 6.2.
If the subjectIdentity element has an id attribute that attribute is ignored.
The baseName element causes a topic name item to be created, and added to the [topic names] property of the topic item created by the parent topic element.
If the baseName element has an id attribute a string is created, as defined in 5.2.2, and added to the [item identifiers] property of the topic name item.
If the baseName element has an instanceOf child element it is processed according to the procedure in 5.12. Otherwise the [type] property of the topic name item is set to the topic item whose [subject identifiers] property contains "http://psi.topicmaps.com/iso13250/topic-name"; if no such topic item exists, one is created.
The information items in the [[children]] property of the baseNameString element are traversed, and for each character information item the Unicode character specified by the [[character code]] property is appended to the [value] property of the topic name item created by the parent baseName element.
If the baseNameString element has an id attribute that attribute is ignored.
The variant element causes a variant item to be created provided the element has a variantName child element. If a variant item is created it is added to the [variants] property of the topic name item created by its baseName ancestor.
If the variant element has an id attribute and a variantName child element a string is created, as defined in 5.2.2, and added to the [item identifiers] property of the variant item.
The [scope] property is initialized to the value of the [scope] property of the variant or topic name item created by the parent element (which will be either a baseName element or a variant element).
It is here assumed that the scope of the parent element has already been processed, which it will have been if the document is valid.
The variantName element has no direct effect on the information set being produced, but changes the interpretation of its child elements.
If the child element is a resourceRef element a string is
produced from it, following the procedure in 5.2.3, and set as the value of the [value]
property of the new variant item. The string
"http://www.w3.org/2001/XMLSchema#anyURI"
is set as the
value of the [datatype] property.
If the child element is a resourceData element the
[datatype] property is set to
"http://www.w3.org/2001/XMLSchema#string"
if the
datatype attribute is not present. If the
datatype attribute is present the [datatype] property
is set to the value of the attribute.
If the [datatype] property is set to
"http://www.w3.org/2001/XMLSchema#any"
the procedure in
5.2.7 is followed.
If the [datatype] property is set to
"http://www.w3.org/2001/XMLSchema#anyURI"
the procedure in
5.2.3 is followed to produce the
value of the [value] property.
Otherwise the information items in the [[children]] property of the element item are traversed, and for each character information item the Unicode character specified by the [[character code]] property is added to the [value] property of the variant item created by the parent variant element. In this case it is an error for the resourceData element to have child elements.
If the variantName element has an id attribute that attribute is ignored.
The parameters element has no direct effect on the information set being produced, but changes the interpretation of its child elements. Each topicRef, resourceRef, and subjectIndicatorRef child element is processed according to the rules for that element type to produce a topic item. These topic items are gathered into a set that is assigned as the value of the [scope] property of the variant item produced by the parent element.
If the parameters element has an id attribute that attribute is ignored.
The scope element has no direct effect on the information set being produced, but changes the interpretation of its child elements. Each topicRef, resourceRef, and subjectIndicatorRef child element is processed according to the rules for that element type to produce a topic item. These topic items are gathered into a set that is assigned as the value of the [scope] property of the information item produced by the parent element.
If the scope element has an id attribute that attribute is ignored.
The instanceOf element has no direct effect on the information set being produced, but changes the interpretation of its child elements. The exact interpretation depends on the parent element of the instanceOf element, however.
Regardless of what parent element the instanceOf element is found in, the child element produces a topic item. For topicRef elements the procedure in 5.16 is followed; for resourceRef elements the procedure in 5.18; and for subjectIndicatorRef elements the procedure in 5.17.
If the parent element is a baseName, occurrence, or association element, the produced topic item is set as the value of the [type] property of the information item produced by the parent element.
If the parent element is a topic element a new association item is created, with two association role items in its [roles] property, and a topic item representing the type-instance association type (described in [ISO/IEC 13250-2], 7.2) in its [type] property. If no such topic item exists already, one is created, and the subject identifier added to its [subject identifiers] property.
The first association role item has its [type] property set to the
topic item representing the type
role in the same
association (see the section referenced above), while the [player]
property is set to the topic produced by the child element.
The second association role item has its [type] property set to the
topic item representing the instance
role in the same
association (see the section referenced above), while the [player]
property is set to the topic produced by the parent element (that is,
the current topic).
If the instanceOf element has an id attribute that attribute is ignored.
The occurrence element causes an occurrence item to be created and added to the [occurrences] property of the topic item created by the parent topic element.
If the occurrence element has an id attribute a string is created, as defined in 5.2.2, and added to the [item identifiers] property of the occurrence item.
If the occurrence element has a resourceRef child
element a string is produced from it, following the procedure in 5.2.3, and set as the value of the [value]
property of the new occurrence item. The string
"http://www.w3.org/2001/XMLSchema#anyURI"
is set as the
value of the [datatype] property.
If the occurrence has a resourceData child
element the [datatype] property is set to
"http://www.w3.org/2001/XMLSchema#string"
if the
datatype attribute is not present. If the
datatype attribute is present the [datatype] property is
set to the value of the attribute.
If the [datatype] property is set to
"http://www.w3.org/2001/XMLSchema#any"
the procedure in
5.2.7 is followed to produce the
value of the [value] property.
If the [datatype] property is set to
"http://www.w3.org/2001/XMLSchema#anyURI"
the procedure in
5.2.3 is followed to produce the
value of the [value] property.
Otherwise the information items in the [[children]] property of the element item are traversed, and for each character information item the Unicode character specified by the [[character code]] property is added to the [value] property of the variant item created by the parent variant element. In this case it is an error for the resourceData element to have child elements.
If the occurrence element has an instanceOf child element it is processed according to the procedure in 5.12. Otherwise the [type] property of the occurrence item is set to the topic item whose [subject identifiers] property contains "http://psi.topicmaps.com/iso13250/occurrence"; if no such topic item exists, one is created.
The association element causes an association item to be created, and added to the [association] property of the topic map item.
If the association element has an id attribute a string is created, as defined in 5.2.2, and added to the [item identifiers] property of the association item.
If the association element has an instanceOf child element it is processed according to the procedure in 5.12. Otherwise the [type] property of the association item is set to the topic item whose [subject identifiers] property contains "http://psi.topicmaps.com/iso13250/association"; if no such topic item exists, one is created.
If the member element has a roleSpec child element, which again has a topicRef, resourceRef, or subjectIndicatorRef child element, a topic item art is produced according to the rules for its element type. If there is no roleSpec child element the topic item whose [subject identifiers] property contains "http://psi.topicmaps.com/iso13250/association-role" is produced, and if no such topic item exists, one is created; in both cases the topic item is known as art.
For each topicRef, resourceRef, and subjectIndicatorRef child of the member element a topic item is produced according to the rules for its element type. An association role item is created, and this topic item is then set as the value of its [player] property while art (from the previous paragraph) is set as the value of the [type] property. The association role item is then added to the [roles] property of the association item.
If the member element has no topicRef, subjectIndicatorRef, or resourceRef children a new association role item is created anyway. A new topic item is created and set as the value of its [player] property (an identity will be assigned to this topic item in 5.3), art is set as the value of the [type] property, and the association role item is added to the [roles] property of the association item.
If the member element has an id and no more than one topicRef, subjectIndicatorRef, resourceRef child, a string is created, as defined in 5.2.2, and added to the [item identifiers] property of the association role item.
The topicRef element always produces a topic item, as described below. How the topic item is used depends on the context in which the topicRef element appears, and is described in the part of this document describing the processing of the topicRef element's parent element.
From the topicRef element a string l is produced according to the rules in 5.2.3. If l refers to an external resource l (minus its fragment identifier) is processed according to the rules in 5.19 as though it were a mergeMap element with an empty added scope.
If the data model has a topic item whose [subject identifiers] or [item identifiers] properties contain a string equal to l that topic item is the one produced by this topicRef element.
If no such topic item exists, a topic item is created, and l added to its [item identifiers] property. That topic item is then the one produced by this topicRef element.
If the topicRef element has an id attribute that attribute is ignored.
The subjectIndicatorRef element produces a topic item, as described below. How the topic item is used depends on the context in which the subjectIndicatorRef element appears, and is described in the part of this document describing the processing of the subjectIndicatorRef element's parent element.
From the subjectIndicatorRef element a string l is produced according to the rules in 5.2.3. If the information set has a topic item whose [subject identifiers] or [item identifiers] properties contain a string equal to l that topic item is the one produced by this subjectIndicatorRef element.
If no such topic item exists, a topic item is created, and l added to its [subject identifiers] property. That topic item is then the one produced by this subjectIndicatorRef element.
If the subjectIndicatorRef element has an id attribute that attribute is ignored.
The resourceRef element produces a topic item, as described below. How the topic item is used depends on the context in which the resourceRef element appears, and is described in the part of this document describing the processing of the resourceRef element's parent element.
From the resourceRef element a string l is produced according to the rules in 5.2.3. If the information set has a topic item whose [subject locators] property contains a string equal to l that topic item is the one produced by this resourceRef element.
If no such topic item exists, a topic item is created, and l added to its [subject locators] property. That topic item is then the one produced by this resourceRef element.
If the resourceRef element has an id attribute that attribute is ignored.
For each topicRef, resourceRef, and subjectIndicatorRef child element of the mergeMap element a topic item produced is produced as described in the section for that element type. The set of topic items thus produced is known as the added scope of the reference.
An absolute IRI is produced from the mergeMap element's xlink:href attribute, following the procedure in 5.2.3. It is an error if this IRI contains a fragment identifier. If the information resource referred to by the given IRI has not already been processed with an equal added scope a data model instance is produced as described in 5.2.5. Each topic item in the added scope is then added to the [scope] property of every information item in the data model instance produced above. Finally, the data model instance is merged into the current data model instance, following the procedure described in 5.2.6.
If the mergeMap element has an id attribute that attribute is ignored, as is the value of its xlink:type attribute.
An XTM document conforms to this document provided it:
Is a well-formed XML document [W3C XML].
Conforms to [W3C XML-Names].
Conforms to the schema in Annex A.
Is deserializable according to the procedure defined in Clause 5 without causing any errors or violating any data model constraints.
An XTM processor conforms to this document provided that it meets all the requirements given below.
The XTM processor shall reject any input which is not a conforming XTM document.
The XTM processor shall produce a representation that is isomorphic to the data model instance created by the procedure given in Clause 5 for all XTM documents.
# =========================================================================== # # XML Topic Maps 1.1 # # This is the normative RELAX-NG schema for the XTM 1.1 syntax, as # defined in ISO 13250-3. # # =========================================================================== # --- Common declarations default namespace = "http://www.topicmaps.org/xtm/1.0/" namespace xlink = "http://www.w3.org/1999/xlink" namespace xtm = "http://www.topicmaps.org/xtm/1.0/" datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes" start = topicMap topic-reference = topicRef | resourceRef | subjectIndicatorRef id = attribute id { xsd:ID } href = attribute xlink:href { xsd:anyURI } type = attribute xlink:type { "simple" } any-markup = (text | element * - xtm:* { attribute * { text }*, any-markup* })* # --- The schema topicMap = element topicMap { id?, xmlbase?, version, (topic | association | mergeMap)* } xmlbase = attribute xml:base { xsd:anyURI } version = attribute version { "1.1" } topic = topic-with-id | topic-without-id topic-with-id = element topic { id, instanceOf*, subjectIdentity?, (baseName | occurrence)* } topic-without-id = element topic { instanceOf*, subjectIdentity2, (baseName | occurrence)* } subjectIdentity = element subjectIdentity { id?, topic-reference* } subjectIdentity2 = element subjectIdentity { id?, topic-reference+ } baseName = element baseName { id?, instanceOf?, scope?, baseNameString, variant* } baseNameString = element baseNameString { id?, text } variant = element variant { id?, parameters, variantName?, variant* } variantName = element variantName { id?, (resourceRef | resourceData) } parameters = element parameters { id?, topic-reference+ } scope = element scope { id?, topic-reference+ } instanceOf = element instanceOf { id?, topic-reference } occurrence = element occurrence { id?, instanceOf?, scope?, ( resourceRef | resourceData ) } datatype = attribute datatype { xsd:anyURI } resourceData = element resourceData { id?, datatype?, any-markup } association = element association { id?, instanceOf?, scope?, member+ } member = element member { id?, roleSpec?, topic-reference* } roleSpec = element roleSpec { id?, topic-reference } topicRef = element topicRef { id?, href, type? } subjectIndicatorRef = element subjectIndicatorRef { id?, href, type? } resourceRef = element resourceRef { id?, href, type? } mergeMap = element mergeMap { id?, href, type?, topic-reference* } # --- End of schema |
<!-- ....................................................................... --> <!-- XML Topic Map DTD .................................................... --> <!-- XML Topic Map (XTM) DTD, Version 1.1 This is XTM 1.1, an XML interchange syntax for ISO 13250 Topic Maps, defined by ISO 13250-3. Use this URI to identify the default XTM namespace: "http://www.topicmaps.org/xtm/1.0/" Used to identify the XLink namespace: "http://www.w3.org/1999/xlink" The formal public identifier for this DTD is: "ISO/IEC 13250-3:2005//DTD XML Topic Maps (XTM) 1.1//EN" --> <!-- topicMap .................................................... --> <!ELEMENT topicMap ( topic | association | mergeMap )* > <!ATTLIST topicMap id ID #IMPLIED xml:base CDATA #IMPLIED version CDATA #FIXED '1.1' xmlns CDATA #FIXED 'http://www.topicmaps.org/xtm/1.0/' xmlns:xlink CDATA #FIXED 'http://www.w3.org/1999/xlink' > <!-- topic ...................................................... --> <!ELEMENT topic ( instanceOf*, subjectIdentity?, ( baseName | occurrence )* ) > <!ATTLIST topic id ID #IMPLIED > <!-- subjectIdentity ............................................. --> <!ELEMENT subjectIdentity ( resourceRef | topicRef | subjectIndicatorRef )* > <!ATTLIST subjectIdentity id ID #IMPLIED > <!-- baseName .................................................... --> <!ELEMENT baseName ( instanceOf?, scope?, baseNameString, variant* ) > <!ATTLIST baseName id ID #IMPLIED > <!-- baseNameString .............................................. --> <!ELEMENT baseNameString ( #PCDATA ) > <!ATTLIST baseNameString id ID #IMPLIED > <!-- variant ..................................................... --> <!ELEMENT variant ( parameters, variantName?, variant* ) > <!ATTLIST variant id ID #IMPLIED > <!-- variantName ................................................. --> <!ELEMENT variantName ( resourceRef | resourceData ) > <!ATTLIST variantName id ID #IMPLIED > <!-- parameters .................................................. --> <!ELEMENT parameters ( topicRef | resourceRef | subjectIndicatorRef )+ > <!ATTLIST parameters id ID #IMPLIED > <!-- scope ....................................................... --> <!ELEMENT scope ( topicRef | resourceRef | subjectIndicatorRef )+ > <!ATTLIST scope id ID #IMPLIED > <!-- instanceOf .................................................. --> <!ELEMENT instanceOf ( topicRef | resourceRef | subjectIndicatorRef ) > <!ATTLIST instanceOf id ID #IMPLIED > <!-- occurrence .................................................. --> <!ELEMENT occurrence ( instanceOf?, scope?, ( resourceRef | resourceData ) ) > <!ATTLIST occurrence id ID #IMPLIED > <!-- resourceData ................................................ --> <!ELEMENT resourceData ANY > <!ATTLIST resourceData id ID #IMPLIED datatype CDATA #IMPLIED > <!-- association ................................................. --> <!ELEMENT association ( instanceOf?, scope?, member+ ) > <!ATTLIST association id ID #IMPLIED > <!-- member ...................................................... --> <!ELEMENT member ( roleSpec?, ( topicRef | resourceRef | subjectIndicatorRef )* ) > <!ATTLIST member id ID #IMPLIED > <!-- roleSpec .................................................... --> <!ELEMENT roleSpec ( topicRef | resourceRef | subjectIndicatorRef ) > <!ATTLIST roleSpec id ID #IMPLIED > <!-- topicRef .................................................... --> <!ELEMENT topicRef EMPTY > <!ATTLIST topicRef id ID #IMPLIED xlink:type NMTOKEN #FIXED 'simple' xlink:href CDATA #REQUIRED > <!-- subjectIndicatorRef ......................................... --> <!ELEMENT subjectIndicatorRef EMPTY > <!ATTLIST subjectIndicatorRef id ID #IMPLIED xlink:type NMTOKEN #FIXED 'simple' xlink:href CDATA #REQUIRED > <!-- resourceRef ................................................. --> <!ELEMENT resourceRef EMPTY > <!ATTLIST resourceRef id ID #IMPLIED xlink:type NMTOKEN #FIXED 'simple' xlink:href CDATA #REQUIRED > <!-- mergeMap .................................................... --> <!ELEMENT mergeMap ( topicRef | resourceRef | subjectIndicatorRef )* > <!ATTLIST mergeMap id ID #IMPLIED xlink:type NMTOKEN #FIXED 'simple' xlink:href CDATA #REQUIRED > <!-- end of XML Topic Map (XTM) 1.1 DTD --> |
The XML Schema consists of three parts: one for the XTM namespace, one for the XLink namespace, and one for the XML Base attribute. Below is the schema for the XTM namespace.
<xs:schema targetNamespace="http://www.topicmaps.org/xtm/1.0/" elementFormDefault="qualified" xmlns="http://www.topicmaps.org/xtm/1.0/" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/"> <xs:annotation> <xs:appinfo> <dc:title>W3C XML Schema for XTM 1.1</dc:title> <dc:owner>ISO/IEC JTC1 SC34</dc:owner> <dc:contributor>Max Voskob</dc:contributor> <dc:contributor>Lars Marius Garshol</dc:contributor> <dc:contributor>Ann Wrightson</dc:contributor> </xs:appinfo> </xs:annotation> <xs:annotation> <xs:documentation> Minimal XLink and XBase support provided in small local files for compactness. </xs:documentation> </xs:annotation> <xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="xtm-xlink.xsd"/> <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xtm-xbase.xsd"/> <!-- any-markup ....................................................--> <xs:complexType name="any-markup" mixed="true"> <xs:complexContent mixed="true"> <xs:restriction base="xs:anyType"> <xs:sequence> <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:ID"/> <xs:attribute name="datatype" type="xs:anyURI"/> </xs:restriction> </xs:complexContent> </xs:complexType> <!-- topicMap ........................................................... --> <xs:element name="topicMap"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="topic"/> <xs:element ref="association"/> <xs:element ref="mergeMap"/> </xs:choice> <xs:attribute name="id" type="xs:ID"/> <xs:attribute name="xml:base" type="xs:anyURI"/> <xs:attribute name="version" fixed="1.1"/> </xs:complexType> </xs:element> <!-- topic .............................................................. --> <xs:element name="topic"> <xs:complexType> <xs:sequence> <xs:element ref="instanceOf" minOccurs="0" maxOccurs="unbounded"/> <xs:element ref="subjectIdentity" minOccurs="0"/> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="baseName"/> <xs:element ref="occurrence"/> </xs:choice> </xs:sequence> <xs:attribute name="id" type="xs:ID" use="optional"/> </xs:complexType> </xs:element> <!-- subjectIdentity .................................................... --> <xs:element name="subjectIdentity"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="resourceRef"/> <xs:element ref="topicRef"/> <xs:element ref="subjectIndicatorRef"/> </xs:choice> </xs:complexType> </xs:element> <!-- baseName ........................................................... --> <xs:element name="baseName"> <xs:complexType> <xs:sequence> <xs:element ref="instanceOf" minOccurs="0"/> <xs:element ref="scope" minOccurs="0"/> <xs:element ref="baseNameString"/> <xs:element ref="variant" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:ID"/> </xs:complexType> </xs:element> <!-- baseNameString ..................................................... --> <xs:element name="baseNameString"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="id" type="xs:ID"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <!-- variant ............................................................ --> <xs:element name="variant"> <xs:complexType> <xs:sequence> <xs:element ref="parameters"/> <xs:element ref="variantName" minOccurs="0"/> <xs:element ref="variant" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:ID"/> </xs:complexType> </xs:element> <!-- variantName ........................................................ --> <xs:element name="variantName"> <xs:complexType> <xs:choice> <xs:element ref="resourceRef"/> <xs:element ref="resourceData"/> </xs:choice> <xs:attribute name="id" type="xs:ID"/> </xs:complexType> </xs:element> <!-- parameters ......................................................... --> <xs:element name="parameters"> <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element ref="topicRef"/> <xs:element ref="resourceRef"/> <xs:element ref="subjectIndicatorRef"/> </xs:choice> <xs:attribute name="id" type="xs:ID"/> </xs:complexType> </xs:element> <!-- scope .............................................................. --> <xs:element name="scope"> <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element ref="topicRef"/> <xs:element ref="resourceRef"/> <xs:element ref="subjectIndicatorRef"/> </xs:choice> <xs:attribute name="id" type="xs:ID"/> </xs:complexType> </xs:element> <!-- instanceOf ......................................................... --> <xs:element name="instanceOf"> <xs:complexType> <xs:choice> <xs:element ref="topicRef"/> <xs:element ref="resourceRef"/> <xs:element ref="subjectIndicatorRef"/> </xs:choice> <xs:attribute name="id" type="xs:ID"/> </xs:complexType> </xs:element> <!-- occurrence ......................................................... --> <xs:element name="occurrence"> <xs:complexType> <xs:sequence> <xs:element ref="instanceOf" minOccurs="0"/> <xs:element ref="scope" minOccurs="0"/> <xs:choice> <xs:element ref="resourceRef"/> <xs:element ref="resourceData"/> </xs:choice> </xs:sequence> <xs:attribute name="id" type="xs:ID"/> </xs:complexType> </xs:element> <!-- resourceData ....................................................... --> <xs:element name="resourceData" type="any-markup"/> <!-- association ........................................................ --> <xs:element name="association"> <xs:complexType> <xs:sequence> <xs:element ref="instanceOf" minOccurs="0"/> <xs:element ref="scope" minOccurs="0"/> <xs:element ref="member" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:ID"/> </xs:complexType> </xs:element> <!-- member ............................................................. --> <xs:element name="member"> <xs:complexType> <xs:sequence> <xs:element ref="roleSpec" minOccurs="0"/> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="topicRef"/> <xs:element ref="resourceRef"/> <xs:element ref="subjectIndicatorRef"/> </xs:choice> </xs:sequence> <xs:attribute name="id" type="xs:ID"/> </xs:complexType> </xs:element> <!-- roleSpec ........................................................... --> <xs:element name="roleSpec"> <xs:complexType> <xs:choice> <xs:element ref="topicRef"/> <xs:element ref="resourceRef"/> <xs:element ref="subjectIndicatorRef"/> </xs:choice> <xs:attribute name="id" type="xs:ID"/> </xs:complexType> </xs:element> <!-- topicRef ........................................................... --> <xs:element name="topicRef"> <xs:complexType> <xs:attribute name="id" type="xs:ID"/> <xs:attribute ref="xlink:type"/> <xs:attribute ref="xlink:href" use="required"/> </xs:complexType> </xs:element> <!-- subjectIndicatorRef ................................................ --> <xs:element name="subjectIndicatorRef"> <xs:complexType> <xs:attribute name="id" type="xs:ID"/> <xs:attribute ref="xlink:type"/> <xs:attribute ref="xlink:href" use="required"/> </xs:complexType> </xs:element> <!-- resourceRef ........................................................ --> <xs:element name="resourceRef"> <xs:complexType> <xs:attribute name="id" type="xs:ID"/> <xs:attribute ref="xlink:type"/> <xs:attribute ref="xlink:href" use="required"/> </xs:complexType> </xs:element> <!-- mergeMap ........................................................... --> <xs:element name="mergeMap"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element ref="topicRef"/> <xs:element ref="resourceRef"/> <xs:element ref="subjectIndicatorRef"/> </xs:choice> <xs:attribute name="id" type="xs:ID"/> <xs:attribute ref="xlink:type"/> <xs:attribute ref="xlink:href" use="required"/> </xs:complexType> </xs:element> </xs:schema> |
Below is the schema for the XLink namespace.
<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xlink" targetNamespace="http://www.w3.org/1999/xlink"> <xs:annotation> <xs:documentation>Minimal XLink support as required by XTM 1.1</xs:documentation> </xs:annotation> <xs:attribute name="href" type="xs:anyURI" /> <xs:attribute name="type" type="xs:NMTOKEN" /> </xs:schema> |
Below is the schema for the XML Base attribute.
<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="http://www.w3.org/XML/1998/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:documentation>XBase support as required by XTM 1.1</xs:documentation> </xs:annotation> <xs:attribute name="xml:base" type="xs:anyURI" /> </xs:schema> |
This section provides information on how to serialize data model instances using the XTM syntax. The main text of this document already provides the constraints necessary to ensure interoperability, but as serialization is not entirely straightforward, this section provides additional guidance for implementors.
Generally, a serialization implementation should guarantee that for any data model instance the XTM serialization produced by the implementation should when deserialized to a new data model instance produce one that has the same canonicalization as the original data model instance, according to ISO 13250-4[2].
Serialization is for the most part straightforward, though care should be taken to preserve any reification relationships in the original data model instance. Implementations should also be careful not to make any assumptions about the XML implementation used to read the produced XTM document or what information resources (like DTDs) are available to the recipient of the XTM document.
This annex describes the differences between the syntax defined in this edition of ISO 13250 and that given in ISO/IEC 13250:2003[1].
The differences are:
The instanceOf element is now allowed inside the baseName element.
The resourceRef element is now allowed inside the parameters, instanceOf, and roleSpec elements.
The topicMap element now has a new version attribute.
Multiple resourceRef elements are now allowed within the subjectIdentity element.
The id attribute is no longer required on topic elements, but when omitted the topic shall have a non-empty subjectIdentity element.
The datatype attribute has been added to the resourceData element type.
The resourceData element type now allows embedded markup when the datatype is XML.
Every valid XTM 1.0 document becomes a valid XTM 1.1 document if a
version attribute with the value "1.1"
is
added to the topicMap element.
ISO/IEC 13250:2003, Topic Maps, 2003, http://www.y12.doe.gov/sgml/sc34/document/0322_files/iso13250-2nd-ed-v2.pdf
ISO 13250-4, Topic Maps — Canonicalization, http://www.isotopicmaps.org/sam/cxtm/