Copyright © 2009-2059 NASA ARC®, All Rights Reserved.
This document presents a specification of XML SchemaPlus (XSP) for describing the layout of an XML document in such a way that RDF/OWL semantics can be retained. The approach provides a way for expressing the semantics of relationships on Nested Elements, Reference Elements and Collections. Enumerations as controlled vocabularies are also an important aspect of the approach. XSP is demonstrated using examples for every construct of the XSP schema.
The motivation for XSP originated in work on the NASA Constellation Program
Ontologies and NExIOM (NASA Exploration Initiatives
Ontology Models). We needed a way of generating XML Schemas such that XML
documents could be converted to triples and still be understood by the
ontologies. A second need was to have a way to enforce best practices for XML
Naming and Design Rules by having control over how an XSP Schema is converted to
a W3C XML Schema. Compared to GRDDL (Gleaning Resource Descriptions from Dialects of
Languages), the approach here is to have a model-based schema for creating new XML
document structures, as opposed to having a way to convert existing XML
documents. We allow the use of GRDDL for converting XSP-compliant XML documents
back to RDF triples. This step is possible through the generation of a GRDDL
XSLT file from the XSP Schema.
This section describes the status of this document at the time of its publication. Other documents may supersede this document.
This document was prepared by the NASA NExIOM Project, as part of the NASA Constellation Program Information Architecture Initiative.
This document is a Public Working Draft published to solicit comments from interested parties. Comments may be sent to Ralph Hodgson and/or Paul Keller; please include the text "comment" in the subject line. All messages received will be viewable in a [TBD] public archive.
Publication as a Working Draft does not imply endorsement by any standards bodies. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.
An XML SchemaPlus (XSP) file is a specification for how an XML Document should look. XSP improves on W3C XML Schema (XSD) by supporting semantic annotations that allow an XML document to be related to an OWL Model. By retaining some semantics of OWL models, XSP facilitates data interoperability. XSP ensures that an XML Schema generated from XSP complies with XML Naming and Design Rules (NDR).
A W3C XML Schema does not constrain how the design of an XML Schema should look. As a result, within and across organizations, inconsistency in XSDs and XML controlled vocabularies often occurs. These inconsistencies frustrate efforts to achieve data interoperability, and necessitate programming efforts for interpretation and transformation.
XML Naming and Design Rules (NDR) standards may not help because they are not machine processable. Compliance with XML NDR depends on how they are adopted by developers. By requiring all schemas to be specified in XSP, XML NDR standards can be enforced.
The relationships between an XML SchemaPlus, W3C XML Schema, and XML Standard Vocabularies and XML Documents are shown in the figure below:

The transformation to an XML Schema (XSD) file can be done using a stylesheet transformation (XSLT). A stylesheet, 'XSP2XSD-(v2.0).xslt', developed by NASA ARC, is available at this link for this purpose. This xslt stylesheet enforces NASA XML NDR rules. In the sections that follow, where appropriate, XSD examples that illustrate some of these rules are provided.
A full example of an XSP Schema is given after the specifications.
xs:ComplexType
An XSP file is an XML file. Recognizing that XML documents are hierarchical, XSP constructs support the notion of containers, nested elements, reference elements and attributes. The basic structure of an XSP file is shown below.
A document starts with an XML version line. This is followed by a block of comments using the XML comment syntax. Following this is aXSP
element declaration. Inside this element, a list of namespaces must be
specified. These are the namespaces that are referenced in the XML Document. The
last specification should be the xml:base for the document.
<?xml version="1.0" encoding="UTF-8"?>
<XSP xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="NExIOM_XFRMR-XSPtoXSD-(v1.3-d20081016).xslt">
...
<xsp:Doc>
<xsp:DocText>
...
...
</xsp:DocText>
</xsp:Doc>
<!-- ====== Default Namespace ======= -->
<xsp:DefaultNamespace
uri="http://www.xspl.us/xsp/example/xspts.xsd" prefix="xspts"/>
<!-- ====== Namespaces ======= -->
<xsp:Namespace prefix="security"
uri="http://nst.nasa.gov/esmd/cx/security.owl" />
<xsp:Namespace prefix="xspts"
uri="http://www.xspl.us/xsp/example/xspts.xsd" />
<xsp:Namespace prefix="clm54217"
uri="urn:un:unece:uncefact:codelist:specification:54217:2001"/>
<!-- ====== Imports ======= -->
<xsp:Import
namespace="http://www.xspl.us/xsp/example/test-import.xsd"
schemaLocation="../XSD/xsp-test-import.xsd"/>
<!-- ====== Root Element ======= -->
<xsp:RootElement name="XSL-TestSuite"/>
<!-- ====== Attributes ======= -->
<xsp:Attribute name="chapterNumber" namespace="xspts" type="xs:integer"/>
<xsp:Attribute name="pageNumber" type="xs:integer"/>
...
...
<!-- ====== Attribute Groups ======= -->
<xsp:AttributeGroup name="BookAttributeGroup" namespace="xspts">
<xsp:Attribute ref="xspts:title" use="required"/>
<xsp:Attribute ref="xspts:publisher" use="required"/>
<xsp:Attribute ref="xspts:year" use="required"/>
<xsp:Attribute ref="xspts:isbn" use="required"/>
</xsp:AttributeGroup>
<!-- ====== Global Elements ======= -->
<xsp:GlobalElement name="Book" namespace="xspts" type="xspts:BookType"
minOccurs="0" maxOccurs="unbounded"/>
<xsp:GlobalElement name="Library" namespace="xspts" type="xspts:LibraryType"
minOccurs="0" maxOccurs="1"/>
<!-- ====== Element Groups ======= -->
<xsp:ElementGroup name="LibraryElementsGroup">
<xsp:ScalarElement name="buildingName" baseType="xs:string"/>
<xsp:NestedElement name="libraryPublication" type="xspts:PublicationType"
relation="xspts:hasLibraryPublication"/>
</xsp:ElementGroup>
<!-- ====== Object Types ======= -->
<xsp:ObjectType name="BookType" namespace="xspts" baseType="xspts:PublicationType">
<xsp:SuperClass ref="xspts:Publication"/>
<xsp:SuperClass ref="xspts:LibraryAsset"/>
<xsp:AttributeGroupRef ref="xspts:BookAttributeGroup"/>
<xsp:NestedElement name="toc"
relation="xspts:toc"
type="xspts:TocType"/>
<xsp:NestedElement name="chapter"
relation="xspts:chapter"
type="xspts:ChapterType"/>
</xsp:ObjectType>
...
...
<!-- ====== Enumerations ======= -->
<xsp:Enumeration name="CurrencyCodeEnumeration" namespace="qdt"
type="qdt:CurrencyCodeType"
default="clm54217:Euro"
representation="codelist">
<xsp:EnumerationElementRef ref="clm54217:ArgentinePeso" />
<xsp:EnumerationElementRef ref="clm54217:AzerbaijanianManat" />
<xsp:EnumerationElementRef ref="clm54217:EthopianBirr" />
<xsp:EnumerationElementRef ref="clm54217:Euro" />
<xsp:EnumerationElementRef ref="clm54217:TurkishLira"/>
<xsp:EnumerationElementRef ref="clm54217:US-Dollar"/>
<xsp:EnumerationElementRef ref="clm54217:YemeniRial"/>
<xsp:EnumerationElementRef ref="clm54217:ZimbabweDollar"/>
</xsp:Enumeration>
<xsp:Enumeration name="HazardSeverityTypeEnumeration" namespace="risk"
type="risk:RiskEnumeration"
default="marginal" representation="xsd-strings" base="xs:string">
<xsp:EnumerationElement name="risk:Negligible"
type="risk:HazardSeverityType"
code="1" order="1" literal="negligible"/>
<xsp:EnumerationElement name="risk:Marginal"
type="risk:HazardSeverityType"
code="4" order="3" literal="marginal"/>
<xsp:EnumerationElement name="risk:Critical"
type="risk:HazardSeverityType"
code="7" order="4" literal="critical"/>
</xsp:Enumeration>
...
...
<!-- ====== Enumeration Elements ======= -->
<xsp:EnumerationElement name="security:Restricted"
type="security:SecurityLevelType"
code="1" literal="restricted" order="2">
<dc:description>
...
...
</dc:description>
</xsp:EnumerationElement>
<xsp:EnumerationElement name="security:SensitiveButUnclassified"
type="security:SecurityLevelType"
code="3" literal="sbu" order="4">
<dc:description>
...
...
</dc:description>
</xsp:EnumerationElement>
...
...
<!-- ====== Scalar Types ======= -->
<xsp:ScalarType name="ChapterNameType" baseType="xs:string" namespace="xspts"/>
</xsp:XSP>
An XSP file can be validated against the XSP XML Schema, 'xsp-(v1.0).xsd. This XSD schema, developed by NASA ARC, is available at this link.
The following data types are defined in the XSP XML Schema for use in XSP Specifications
The EnumerationRepresentationType is used to specify how an
enumeration will be represented in either an XML Schema and/or in XML.
<xs:simpleType name="EnumerationRepresentationType">
<xs:restriction base="xs:string">
<xs:enumeration value="xsd-strings"/>
<xs:enumeration value="xsd-qnames"/>
<xs:enumeration value="codelist"/>
</xs:restriction>
</xs:simpleType>
The OccursType is used to express the cardinality of an
element or attribute.
<xs:simpleType name="OccursType">
<xs:union memberTypes="xs:nonNegativeInteger">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="unbounded"/>
</xs:restriction>
</xs:simpleType>
</xs:union>
</xs:simpleType>
The UseType is used to express whether an element or attribute
is mandatory or optional.
<xs:simpleType name="UseType">
<xs:restriction base="xs:string">
<xs:enumeration value="optional"/>
<xs:enumeration value="required"/>
</xs:restriction>
</xs:simpleType>
An XSP Schema can contain the constructs shown alphabetically in the table below.
| Element Name | Description | Allowed Within | Cardinality |
|---|---|---|---|
| Attribute | An OWL Datatype property and an XSD Attribute | Main Body, Attribute Group | 0..n |
| AttributeGroup | A Group of Attributes | Main Body, AttributeGroup | 0..n |
| AttributeGroupRef | A QName reference to a Group of Attributes |
Main Body, Attribute Group | 0..n |
| CollectionElement | A container that holds multiple child-elements of a specific type. | Main Body, ElementGroup, ObjectType | 0..n |
| ContainerElement | A container that holds multiple child-elements of a specific type corresponding to a designated attribute. | ElementGroup, ObjectType | 0..n |
| DefaultNamespace | Defines the default namespace for the schema. Corresponds to XSD Default Namespace | Main Body | 1..1 |
| ElementGroup | A group of element definitions. Corresponds to XSD Group construct | Main Body, ElementGroup | 0..n |
| ElementGroupRef | A QName reference to an element group |
ElementGroup, ObjectType | 0..n |
| Enumeration | Specifies a special kind of container of enumeration values for a code list. The elements of the enumeration can either be contained within the enumeration construct, or be references to a vocabulary of global enumeration elements. | Main Body | 0..n |
| EnumerationElement | Specifies a member of an enumeration. When specified within an Enumeration, the Enumeration Element is defined in-line. | Main Body, Enumeration | 0..n |
| EnumerationElementRef | A QName reference to a member of an enumeration |
Enumeration | 0..n |
| GlobalElement | Specifies a reusable non-Scalar element outside of any complex types. See also ScalarElement | Main Body | 0..n |
| GlobalElementRef | Specifies a reference to a globally defined element type. See also GlobalElement | ElementGroup, ObjectType | 0..n |
| Import | Specifies a schema that should be imported | Main Body | 0..n |
| ListElement | Specifies a transformation to a seperator-based list for an element within an ElementGroup or ObjectType that can have multiple values. |
ElementGroup, ObjectType | 0..n |
| Namespace | Corresponds to XSD Namespace | Main Body | 0..n |
| NestedElement | Specifies Elements whose structures are contained in-line within an Object Type | ObjectType | 0..n |
| ObjectType | An OWL Class that can be mapped to an XSD Complex Type | Main Body | 0..n |
| ReferenceElement | Specifies a "ref" attribute to hold a QName referencing a desired value |
ObjectType | 0..n |
| RootElement | Corresponds to the XSD concept of Root Element. 'RootElement' is optional. | Main Body | 0..1 |
| ScalarElement | Specifies an element that contains an anonymous complex type that extends a SimpleType expressed with SimpleContent.
This allows an element to carry a value of type xs:anySimpleType or its sub-types.
See also GlobalElement |
Main Body, ElementGroup, ObjectType | 0..n |
| ScalarType | Specifies a global named complex type that extends a SimpleType expressed with SimpleContent.
This allows an element to carry a value of type xs:anySimpleType or its sub-types. |
Main Body | 0..n |
| StripingElement | Inserts a 'relation' element between a parent and a child element. | ObjectType | 0..n |
The constructs DefaultNamespace,
Namespace, Import, and RootElement, must occur in the strict order:
An example using these four elements is as follows:
<xsp:DefaultNamespace uri="http://www.xspl.us/xsp/example/xspts.xsd" prefix="xspts"/> <xsp:Namespace prefix="security" uri="http://nst.nasa.gov/esmd/cx/security.owl" /> <xsp:Namespace prefix="xspts" uri="http://www.xspl.us/xsp/example/xspts.xsd" /> <xsp:Namespace prefix="clm54217" uri="urn:un:unece:uncefact:codelist:specification:54217:2001"/> <xsp:Import namespace="http://www.xspl.us/xsp/example/risk.owl" schemaLocation="../../XSD/risk.xsd"/> <RootElement name="sim"/>
The order for the other elements is not constrained and they can be interspersed with each other.
If the references types defined in another XML Schema file, it must contain an
Import element
identifying the namespace and location of the imported file.
The imported file can itself be generated from a XSP Schema, but the Import element must refer
to the imported XSD file itself. If you want to use a QName, i.e., namespace prefixes rather than
URIs, to refer to these types, you must also include Namespace elements that associate a URI with
a prefix.
On the other hand, if the generated XML Schema file is to be imported by another XML Schema file
(which might also be generated from a XSP Schema), the XSP Schema from which the imported file is
generated must contain a DefaultNamespace element.
In the generated XML Schema file, the
DefaultNamespace element is used to define the default
xmlns:namespace as well as the targetNamespace attribute.
The following sections define each of the possible constructs of an XSP Schema. Definitions are given alphabetically.
Conventions that are used in the specification are as follows: These are:
NestedElement called 'xspts:ChapterWithStripingElementType' used in the 'BookType' example.
An Attribute is a simple scalar type that can be defined globally in the XSP Schema.
XSP Attribute definitions are the same as XSD Attributes. The following
attributes of 'Attribute' are defined:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the attribute | xs:string | 1..1 |
| namespace | The namespace of the attribute | xs:string | 1..1 |
| ref | a pointer, expressed as a QName, to the definition of the attribute |
xs:string | 0..1 |
| type | The type of the attribute | xs:string | 1..1 |
| use | specifies whether the attribute is optional or required | UseType | 1..1 |
Some examples of xsp:Attribute specifications are:
<xsp:Attribute name="chapterNumber" namespace="xspts" type="xs:integer"/> <xsp:Attribute name="pageNumber" type="xs:integer"/> <xsp:Attribute name="maxValue" type="xc:numericType"/> <xsp:Attribute name="minValue" type="xc:numericType"/> <xsp:Attribute name="targetValue" type="xc:numericType"/> <xsp:Attribute name="title" type="xs:string"/> <xsp:Attribute name="publisher" type="xs:string"/> <xsp:Attribute name="year" type="xs:gYear"/> <xsp:Attribute name="isbn" type="xs:string"/>
When processed using the XSLT transformation tool, the generated XML Schema is as follows:
<!--=== Global Attributes ===--> <xs:attribute xmlns="xspts" name="chapterNumber" type="xs:integer"/> <xs:attribute name="pageNumber" type="xs:integer"/> <xs:attribute name="maxValue" type="xc:numericType"/> <xs:attribute name="minValue" type="xc:numericType"/> <xs:attribute name="targetValue" type="xc:numericType"/> <xs:attribute name="title" type="xs:string"/> <xs:attribute name="publisher" type="xs:string"/> <xs:attribute name="year" type="xs:gYear"/> <xs:attribute name="isbn" type="xs:string"/>
An AttributeGroup corresponds to the XML Schema construct for defining a reusable set of
attributes that can be referenced from multiple elements.
XSP Attribute Group definitions are the same as XSD Attribute Groups.
Specification attributes for xsp:AttributeGroup are as follows:
| Specification | Construct | Description | Type | Cardinality |
|---|---|---|---|---|
| name | attribute | The name of the attribute group | xs:string | 1..1 |
| namespace | attribute | The namespace of the attribute group | xs:string | 1..1 |
| Doc | element | Documentation | xs:string | 0..n |
| Attribute | element | Reference to an attribute that is a member of the group | AttributeType | 0..n |
| AttributeGroupRef | element | Reference to an Attribute Group that is a member of the group | AttributeGroupRefType | 0..n |
An example of xsp:AttributeGroup is as follows:
<xsp:AttributeGroup name="BookAttributeGroup" namespace="xspts"> <xsp:Attribute ref="xspts:title" use="required"/> <xsp:Attribute ref="xspts:publisher" use="required"/> <xsp:Attribute ref="xspts:year" use="required"/> <xsp:Attribute ref="xspts:isbn" use="required"/> </xsp:AttributeGroup>
When processed using the XSLT transformation tool, the generated XML Schema is as follows:
<!-- == BookAttributeGroup == --> <xs:attributeGroup xmlns="xspts" name="BookAttributeGroup"> <!-- [T504] An Attribute Group--> <xs:attribute ref="xspts:title" use="required"/> <xs:attribute ref="xspts:publisher" use="required"/> <xs:attribute ref="xspts:year" use="required"/> <xs:attribute ref="xspts:isbn" use="required"/> </xs:attributeGroup>
An AttributeGroupRef is a reference to an AttributeGroup.
Specification attributes for xsp:AttributeGroupRef are as follows:
| Specification | Construct | Description | Type | Cardinality |
|---|---|---|---|---|
| ref | attribute | A QName reference to the attribute group |
|
1..1 |
The use of Containers, that is a nesting of elements, is common practice in XML. Containers, which are referred to in this specification as ‘Collections’, are XML elements that contain potentially more than one instance of another XML element or of several other XML elements. The structure of a container is dictated by the XML Schema to which the XML document conforms.
The XML Schema element generated from a
XSP Schema CollectionElement is a container capable of
holding multiple sub-elements of the designated type.
The specification format is identical to that of a NestedElement.
The specification attributes for xsp:CollectionElement are
as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the Collection | xs:string | 1..1 |
| namespace | The namespace of the Collection | xs:string | 1..1 |
| type | The type of the collection element | xs:string | 1..1 |
| minOccurs | Minimum Cardinality | OccursType | 0..1 |
| maxOccurs | Maximum Cardinality | OccursType | 0..1 |
| relation | Semantic association between the owner of the collection and the members of the collection | QName |
0..1 |
Using a Book example, for the Table of Contents, we define the following:
<xsp:CollectionElement
name="TocEntry"
type="xspts:TocEntryType"
relation="xspts:tocEntry"/>
This specification results in the following XML Schema content being generated:
<xs:element name="TocEntryCollection" type="xspts:TocEntryCollectionType">
<!-- [T806] Collection Element - relation is xspts:tocEntry-->
<xs:annotation>
<xs:documentation>
<xc:relation>xspts:tocEntry</xc:relation>
</xs:documentation>
</xs:annotation>
</xs:element>
...
...
<xs:complexType name="TocEntryCollectionType">
<!-- [T807] Collection Element Type-->
<xs:sequence maxOccurs="unbounded">
<xs:element name="TocEntry" type="xspts:TocEntryType"/>
</xs:sequence>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
Note the following:
xspts:TocEntryCollectionType is a generated global type definition.xspts:tocEntry.xc:W3C-AttributeGroup, generated by the XSLT script, provides optional Dublin Core and RDF metadataxc:XC-AttributeGroup, generated by the XSLT script, provides optional XSP Core (xc) metadata
Each chapter in the table of contents is specified with a title, chapter number and page number, using TocEntryType, specified in XSP as shown below:
<xsp:ObjectType name="TocEntryType" namespace="xspts"> <xsp:ScalarElement name="chapterTitle" namespace="xspts" type="xs:string" /> <xsp:Attribute ref="xspts:chapterNumber"/> <xsp:Attribute ref="xspts:pageNumber"/> </xsp:ObjectType>
The resultant XML Schema for the TocEntryType is as follows:
<xs:complexType xmlns="xspts" name="TocEntryType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence>
<xs:element name="chapterTitle" type="xs:string"/>
</xs:sequence>
<xs:attribute ref="xspts:chapterNumber"/>
<xs:attribute ref="xspts:pageNumber"/>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
<xs:complexType>
An example instance of the xspts:TocEntryCollection collection, showing the first three chapters might be:
<xspts:TocEntryCollection> <xspts:TocEntry xspts:chapterNumber="1" xspts:pageNumber="1"> <xspts:chapterTitle>Introduction</xspts:chapterTitle> </xspts:TocEntry> <xspts:TocEntry xspts:chapterNumber="2" xspts:pageNumber="26"> <xspts:chapterTitle>The XML Family of Specifications</xspts:chapterTitle> </xspts:TocEntry> <xspts:TocEntry xspts:chapterNumber="3" xspts:pageNumber="53"> <xspts:chapterTitle>The Ontology Web Language OWL</xspts:chapterTitle> </xspts:TocEntry> ... ... </xspts:TocEntryCollection>
The use of Containers, that is a nesting of elements, is common practice in XML.
A specific 'relation' (property) is designated as the type on which the container elements must conform.
The difference between CollectionElement and ContainerElement is that the latter converts an RDF list into an XML Schema container.
Specification attributes for xsp:ContainerElement are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| namespace | The prefix of the namespace | xs:string | 1..1 |
| name | The name of the container | xs:string | 1..1 |
| relation | A qname of the property that the container will be built on | xs:QName | 1..1 |
| type | Value of the type attribute must be the name of an objectType element under the root. | xs:QName | 1..1 |
A Default Namespace corresponds to the TargetNamespace and
the blank xmlns declaration in XML Schema.
Specification attributes for xsp:DefaultNamespace are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| prefix | The prefix of the namespace | xs:string | 1..1 |
| uri | The URI of the namespace | xs:string | 1..1 |
Using an example from NASA's Constellation Program, Telemetry and Command, the namespace C3I is specified as follows:
<DefaultNamespace
uri="https://nst.nasa.gov/esmd/cx/c3i.owl"
prefix="c3i"/>
An ElementGroup is an XML Schema construct for defining a reusable set of elements that can be
referenced from multiple elements.
Because XML Schema only supports single inheritance, an ElementGroup is useful when dealing with multiple inheritance in a model.
A dominant superclass must be chosen and properties from other inheritance paths must be treated as so-called 'mix-ins'.
An ElementGroup can be defined using one or more Element definitions, ElementGroup references, CollectionElement, NestedElement, StripingElement, and ScalarType definitions.
Specification attributes for an xsp:ElementGroup are as follows:
| Specification | Construct | Description | Type | Cardinality |
|---|---|---|---|---|
| name | attribute | The name of the Element Group | xs:string | 1..1 |
| namespace | attribute | The namespace of the Element Group | xs:string | 1..1 |
| Doc | element |
Documentation | xs:string | 0..n |
| ScalarElement | element |
An element definition within the group that is an extension of a simple type | ScalarElementType | 0..n |
| ReferenceElement | element |
A Reference Element that is a member of the group | ReferenceElementType | 0..n |
| NestedElement | element |
An element of the group that is defined within the group | NestedElementType | 0..n |
| StripingElement | element |
An element of the group whose relationship within the group is defined as an additional wrapper of the element. | StripingElementType | 0..n |
| CollectionElement | element |
A container of elements that is a member of the group | CollectionElementType | 0..n |
| ElementGroupRef | element |
An element of the group that is a reference to another Element Group | ElementGroupRefType | 0..n |
Consider a second example from Units of Measure, the "Quantity, Units and Dimensions (QUD)" models.
An ElementGroup for expressing additional properties for 'derived units' can be specified as follows:
<ElementGroup name="DerivedGroup" namespace="units"> <ReferenceElement name="derivedUsingFactor" minOccurs="0" maxOccurs="1" type="xs:double"> </ReferenceElement> <ReferenceElement name="operator" minOccurs="1" maxOccurs="1" type="maths:ArithmeticOperatorType"> </ReferenceElement> </ElementGroup>
Element Groups can contain other Element Groups. An example from the 'NASA Physical Quantities' is shown below:
<ElementGroup name="StressQuantityGroup" namespace="quantity">
<ElementGroupRef ref="quantity:ForcePerUnitAreaPropertyGroup">
...
</ElementGroup>
An ElementGroupRef is a reference to an ElementGroup.
Specification attributes for xsp:ElementGroupRef are as follows:
| Specification | Construct | Description | Type | Cardinality |
|---|---|---|---|---|
| ref | attribute | A QName reference to the Element Group |
xs:QName |
1..1 |
An Enumeration specifies a controlled list of permissible values expressed using
one or more EnumerationElement constructs.
Enumerations elements are either expressed globally or contained within the Enumeration itself as strings or QNames.
These three representations for Enumerations are:
QNames are references to XML instances of a Standard Vocabulary;The default is that enumerations contain their members.
An attribute called relation is provided for XML Schema
transformations. In the case of XML Schemas, if relation is specified then for
each element of the enumeration the pointer to the string is expressed as an
attribute value, otherwise it is the value of the element. The string given as
the value of relation is the property that will be used as the name of the
attribute reference in the generated XML Schema.
The base attribute is used to specify what simple type is used for the base.
For QNames, the base should be set to
xs:QName.
Each enumeration is a controlled vocabulary that can be translated from XSP into
multiple formats, including ASN.1, XML, RDF/OWL.
Specification attributes and elements for xsp:Enumeration are as follows:
| Specification | Construct | Description | Type | Cardinality |
|---|---|---|---|---|
| name | attribute | The name of the Enumeration | xs:string | 1..1 |
| namespace | attribute | The base part of the URI for the Enumeration | xs:string | 0..1 |
| representation | attribute | Specifies what specification approach will represent the enumeration. Three approaches are supported: XSD Strings, XSD QNames and Code Lists. | EnumerationRepresentationType | 1..1 |
| base | attribute | The type of the base that is the simple type that the enumeration extends.
The default is 'xs:string' but 'xs:QName' is needed for controlled vocabularies. |
xs:QName |
0..1 |
| default | attribute | The default value of the Enumeration | xs:string | 0..1 |
| EnumerationElement | element |
A member of the Enumeration | EnumerationElementType | 0..n |
The example which follows is an enumeration of Hazard Severity Types.
Setting the vocabulary attribute false makes the enumeration an XSD-style enumeration - all of the elements are defined in-situ.
In XSP, this is specified as follows:
<xsp:Enumeration name="HazardSeverityTypeEnumeration"
type="risk:RiskEnumeration"
namespace="risk"
default="marginal"
representation="xsd-strings"
<xsp:EnumerationElement name="risk:Negligible"
type="risk:HazardSeverityType"
code="1"
order="1"
literal="negligible"/>
<xsp:EnumerationElement name="risk:Minor"
type="risk:HazardSeverityType"
code="2"
order="2"
literal="minor"/>
<xsp:EnumerationElement name="risk:Marginal"
type="risk:HazardSeverityType"
code="4"
order="3"
literal="marginal"/>
<xsp:EnumerationElement name="risk:Critical"
type="risk:HazardSeverityType"
code="7"
order="4"
literal="critical"/>
<xsp:EnumerationElement name="risk:Catastrophic"
type="risk:HazardSeverityType"
code="9"
order="5"
literal="catastrophic"/>
</xsp:Enumeration>
Each Hazard Severity Type carries a literal, a code and an order attribute. The generated XML Schema for the enumeration of Hazard Severity Types is as follows:
<xs:simpleType xmlns="risk" name="HazardSeverityTypeEnumeration">
<!-- [T122] String-based enumeration-->
<xs:restriction base="xs:string">
<xs:enumeration value="negligible">
<xs:annotation>
<xs:documentation>
<xc:order>1</xc:order>
<xc:code>1</xc:code>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="minor">
<xs:annotation>
<xs:documentation>
<xc:order>2</xc:order>
<xc:code>2</xc:code>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="marginal">
<xs:annotation>
<xs:documentation>
<xc:order>3</xc:order>
<xc:code>4</xc:code>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="critical">
<xs:annotation>
<xs:documentation>
<xc:order>4</xc:order>
<xc:code>7</xc:code>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="catastrophic">
<xs:annotation>
<xs:documentation>
<xc:order>5</xc:order>
<xc:code>9</xc:code>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
In an XSD-style enumeration the additional attributes of the enumeration elements can only be expressed as structured comments.
A preferred approach is to use a vocabulary for the enumeration elements.
This is possible by setting the representation attribute to xsd-qnames.
Each choice specifies a QName as opposed to a string.
Using QNames allows all enumeration values to be verified and validated against a controlled vocabulary.
For the HazardSeverityTypeEnumeration example, the XSP specification is changed to:
<xsp:Enumeration name="risk:HazardSeverityTypeEnumeration"
type="risk:RiskEnumeration"
namespace="risk"
default="risk:Marginal"
representation="xsd-qnames"
base="xs:QName">
<xsp:EnumerationElementRef ref="risk:Negligible"/>
<xsp:EnumerationElementRef ref="risk:Minor"/>
<xsp:EnumerationElementRef ref="risk:Marginal"/>
<xsp:EnumerationElementRef ref="risk:Critical"/>
<xsp:EnumerationElementRef ref="risk:Catastrophic"/>
</xsp:Enumeration>
The standard vocabulary of 'Hazard Severity Types' is generated, separately in XML with the following structure:
<risk:HazardSeverityType name="Negligible"
xc:literal="negligible" xc:code="1" xc:order="1"/>
<risk:HazardSeverityType name="Minor"
xc:literal="minor" xc:code="2" xc:order="2"/>
<risk:HazardSeverityType name="Marginal"
xc:literal="marginal" xc:code="4" xc:order="3"/>
<risk:HazardSeverityType name="Critical"
xc:literal="critical" xc:code="8" xc:order="4"/>
<risk:HazardSeverityType name="Catastrophic"
xc:literal="catastrophic" xc:code="16" xc:order="5"/>
Attribution of enumeration elements as controlled vocabularies, provides a precise way of making the specification of all attributes. In XML Schema, additional attributes on enumerations would have to expressed as annotations.
A Codelist is represented as an XML file with both the collection and its members. The example given is an enumeration of currency codes from the UNCEFACT Specification of Currency Codes.
<xsp:Enumeration name="CurrencyCodeEnumeration"
type="qdt:CurrencyCodeType"
namespace="qdt"
default="clm54217:Euro"
representation="codelist"
<xsp:EnumerationElementRef ref="clm54217:ArgentinePeso" />
<xsp:EnumerationElementRef ref="clm54217:AzerbaijanianManat" />
...
...
<xsp:EnumerationElementRef ref="clm54217:EthopianBirr" />
<xsp:EnumerationElementRef ref="clm54217:Euro" />
...
...
<xsp:EnumerationElementRef ref="clm54217:TurkishLira"/>
<xsp:EnumerationElementRef ref="clm54217:US-Dollar"/>
...
...
<xsp:EnumerationElementRef ref="clm54217:YemeniRial"/>
<xsp:EnumerationElementRef ref="clm54217:ZimbabweDollar"/>
</xsp:Enumeration>
The resultant XML Standard Vocabulary, with both its enumeration and members, is as follows:
<xml:XML
...
...
<xmlns:xc="http://www.xspl.us/schemas/xc.xsd"/>
<xmlns:clm54217="urn:un:unece:uncefact:codelist:specification:54217:2001"/>
<xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"/>
...
...
<qdt:Enumeration name="CurrencyCodeEnumeration">
default="clm54217:Euro"
<xc:element ref="clm54217:ArgentinePeso" />
<xc:element ref="clm54217:AzerbaijanianManat" />
...
...
<xc:element ref="clm54217:EthopianBirr" />
<xc:element ref="clm54217:Euro" />
...
...
<xc:element ref="clm54217:TurkishLira"/>
<xc:element ref="clm54217:US-Dollar"/>
...
...
<xc:element ref="clm54217:YemeniRial"/>
<xc:element ref="clm54217:ZimbabweDollar"/>
</qdt:Enumeration>
<qdt:CurrencyCode name="ArgentinePeso" xc:code="ARS" xc:literal="ArgentinePeso" />
<qdt:CurrencyCode name="AzerbaijanianManat" xc:code="AZM" xc:literal="AzerbaijanianManat"/>
...
...
<qdt:CurrencyCode name="EthopianBirr" xc:code="ETB" xc:literal="EthopianBirr"/>
<qdt:CurrencyCode name="Euro" xc:code="EUR" xc:literal="Euro"/>
...
...
<qdt:CurrencyCode name="TurkishLira" xc:code="TRL" xc:literal="TurkishLira"/>
<qdt:CurrencyCode name="US-Dollar" xc:code="USD" xc:literal="Dollar"/>
...
...
<qdt:CurrencyCode name="YemeniRial" xc:code="YER" xc:literal="YemeniRial"/>
<qdt:CurrencyCode name="ZimbabweDollar" xc:code="ZWD" xc:literal="ZimbabweDollar"/>
</xml:XML>
Note that the explicit definition of the enumeration in XML allows the permissible values of the enumeration to be referred to by an application. For example, the codelist could be of value as a 'picklist' in a user interface, or in a validator for the document.
An EnumerationElement specifies a permissible value for an Enumeration.
Each EnumerationElement is a member of a controlled vocabulary of terms,
expressed in multiple formats, including ASN.1, XML, RDF/OWL.
Specification elements and attributes for xsp:EnumerationElement are as follows:
| Specification | Construct | Description | Type | Cardinality |
|---|---|---|---|---|
| code | attribute | An encoding for the enumeration element | xs:string | 0..1 |
| dc:description | attribute | Narrative text | xs:string | 0..1 |
| dc:description | element | Narrative text | xs:string | 0..n |
| literal | attribute | A well-known string that can be machine processable for the enumeration element | xs:string | 0..1 |
| name | attribute | The name of the Enumeration Element | xs:string | 0..n |
| namespace | attribute | The namespace of the attribute group | xs:string | 0..1 |
| order | attribute | Species the precedence of the enumeration element | xs:string | 0..1 |
| type | attribute | The type of the enumeration element | xs:QName |
0..1 |
As an example of a controlled vocabulary of enumeration elements, consider the 'SecurityLevelTypes' defined at the end of the 'Enumeration' section. The elements are specified as follows:
<xsp:EnumerationElement name="NoSecurityRestrictions"
namespace="security"
type="security:SecurityLevelType"
code="0" literal="none" order="1">
<dc:description>No security restrictions.</dc:description>
</xsp:EnumerationElement>
<xsp:EnumerationElement name="Restricted"
namespace="security"
type="security:SecurityLevelType"
code="1" literal="restricted" order="2">
<dc:description>During and before World War II, the U.S. had a category of classified
information called 'restricted', which was below confidential. The U.S. no longer has
a restricted classification, but many other nations and NATO do. The U.S. treats 'restricted'
information it receives from other governments as confidential. The U.S. does use the
term restricted data in a completely different way to refer to nuclear secrets.
</dc:description>
</xsp:EnumerationElement>
<xsp:EnumerationElement name="Unclassified"
namespace="security"
type="security:SecurityLevelType"
code="2" literal="unclassified" order="3">
<dc:description>Unclassified is not technically a "classification"; this is the
default, and refers to information that can be released to individuals without a
clearance (Level 0). Information that is unclassified is sometimes restricted in its
dissemination as SBU or FOUO.
</dc:description>
</xsp:EnumerationElement>
<xsp:EnumerationElement name="SensitiveButUnclassified"
namespace="security"
type="security:SecurityLevelType"
code="3" literal="sbu" order="4">
<dc:description>Sensitive but Unclassified (SBU) information should not be disclosed but
is not national security information and cannot be classified according to Executive Order
(EO)12958, as amended. These materials must be: properly marked, locked up when not under
the supervision of an authorized person, and encrypted while in transit over a non-secure
network. Some examples are: trade secrets, proprietary information, financial information,
personnel and medical records, procurement-sensitive information, IT system security plans,
contingency plans, audit logs (recordings of exceptions and other security-related events),
vulnerability reports, incident reports and Personally Identifiable Information (PII).
</dc:description>
</xsp:EnumerationElement>
<xsp:EnumerationElement name="Confidential"
namespace="security"
type="security:SecurityLevelType"
code="4" literal="confidential" order="5">
<dc:description>The lowest classification level (Level 1). It is defined as information which
would "damage" national security if disclosed. "Confidential" shall be applied
to information, the unauthorized disclosure of which reasonably could be expected to cause
damage to the national security that the original classification authority is able to identify
or describe [US Executive Order 12958].
</dc:description>
</xsp:EnumerationElement>
<xsp:EnumerationElement name="Secret"
namespace="security"
type="security:SecurityLevelType"
code="5" literal="secret" order="6">
<dc:description>"Secret" shall be applied to information, the unauthorized disclosure
of which reasonably could be expected to cause serious damage to the national security that the
original classification authority is able to identify or describe [US Executive Order 12958].
</dc:description>
</xsp:EnumerationElement>
<xsp:EnumerationElement name="TopSecret"
namespace="security"
type="security:SecurityLevelType"
code="6" literal="topsecret" order="7">
<dc:description>"Top Secret" shall be applied to information, the unauthorized
disclosure of which reasonably could be expected to cause exceptionally grave damage
to the national security that the original classification authority is able to identify
or describe [US Executive Order 12958].
</dc:description>
</xsp:EnumerationElement>
The corresponding XML file of the controlled vocabulary for security levels is shown below.
<security:SecurityLevelType rdf:id="security:NoSecurityRestrictions" rdfs:label="No Security Restrictions" xc:code="0" xc:literal="none" xc:order="1"> <dc:description>"No security restrictions."</dc:description> </security:SecurityLevelType> <security:SecurityLevelType rdf:id="security:Restricted" rdfs:label="Restricted" xc:code="1" xc:literal="restricted" xc:order="2"> <dc:description>"During and before World War II, the U.S. had a category of classified information called 'restricted', which was below confidential. The U.S. no longer has a restricted classification, but many other nations and NATO do. The U.S. treats "restricted" information it receives from other governments as confidential. The U.S. does use the term restricted data in a completely different way to refer to nuclear secrets." </dc:description> </security:SecurityLevelType> <security:SecurityLevelType rdf:id="security:Unclassified" rdfs:label="Unclassified" xc:code="2" xc:literal="unclassified" xc:order="3"> <dc:description>"Unclassified is not technically a "classification"; this is the default, and refers to information that can be released to individuals without a clearance (Level 0). Information that is unclassified is sometimes restricted in its dissemination as SBU or FOUO." </dc:description> </security:SecurityLevelType> <security:SecurityLevelType rdf:id="security:SensitiveButUnclassified" rdfs:label="Sensitive but Unclassified" xc:code="3" xc:literal="sbu" xc:order="4"> <dc:description>"Sensitive but Unclassified (SBU) information should not be disclosed but is not national security information and cannot be classified according to Executive Order (EO)12958, as amended. These materials must be: properly marked, locked up when not under the supervision of an authorized person, and encrypted while in transit over a non-secure network. Some examples are: trade secrets, proprietary information, financial information, personnel and medical records, procurement-sensitive information, IT system security plans, contingency plans, audit logs (recordings of exceptions and other security-related events), vulnerability reports, incident reports and Personally Identifiable Information (PII)." </dc:description> </security:SecurityLevelType> <security:SecurityLevelType rdf:id="security:Confidential" rdfs:label="Confidential" xc:code="4" xc:literal="confidential" xc:order="5"> <dc:description>"The lowest classification level (Level 1). It is defined as information which would "damage" national security if disclosed. "Confidential" shall be applied to information, the unauthorized disclosure of which reasonably could be expected to cause damage to the national security that the original classification authority is able to identify or describe [US Executive Order 12958]." </dc:description> </security:SecurityLevelType> <security:SecurityLevelType rdf:id="security:Secret" rdfs:label="Secret" xc:code="5" xc:literal="secret" xc:order="6"> <dc:description>""Secret" shall be applied to information, the unauthorized disclosure of which reasonably could be expected to cause serious damage to the national security that the original classification authority is able to identify or describe [US Executive Order 12958]." </dc:description> </security:SecurityLevelType> <security:SecurityLevelType rdf:id="security:TopSecret" rdfs:label="Top Secret" xc:code="6" xc:literal="topsecret" xc:order="7"> <dc:description>""Top Secret" shall be applied to information, the unauthorized disclosure of which reasonably could be expected to cause exceptionally grave damage to the national security that the original classification authority is able to identify or describe [US Executive Order 12958]." </dc:description> </security:SecurityLevelType>
An EnumerationElementRef specifies a reference to a permissible value for an Enumeration.
Each EnumerationElement that is referenced is a member of a controlled vocabulary of terms,
expressed in multiple formats, including ASN.1, XML, RDF/OWL.
Specification attributes for xsp:EnumerationElementRef are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| ref | A QName reference to the enumeration element |
xs:QName |
1..1 |
An example is given below for 'SecurityLevelType':
<xsp:Enumeration name="SecurityLevelTypeEnumeration" type="security:SecurityEnumeration" namespace="security" default="security:SensitiveButUnclassified" vocabulary="true"> <xsp:EnumerationElementRef ref="security:NoSecurityRestrictions"/> <xsp:EnumerationElementRef ref="security:Restricted"/> <xsp:EnumerationElementRef ref="security:Unclassified"/> <xsp:EnumerationElementRef ref="security:SensitiveButUnclassified"/> <xsp:EnumerationElementRef ref="security:Confidential"/> <xsp:EnumerationElementRef ref="security:Secret"/> <xsp:EnumerationElementRef ref="security:TopSecret"/> </xsp:Enumeration>
The following XSD is generated:
<xs:simpleType xmlns="security" name="SecurityLevelTypeEnumeration">
<!-- [T120] QName-based enumeration-->
<xs:restriction base="xs:QName">
<xs:enumeration value="security:NoSecurityRestrictions"/>
<xs:enumeration value="security:Restricted"/>
<xs:enumeration value="security:Unclassified"/>
<xs:enumeration value="security:SensitiveButUnclassified"/>
<xs:enumeration value="security:Confidential"/>
<xs:enumeration value="security:Secret"/>
<xs:enumeration value="security:TopSecret"/>
</xs:restriction>
</xs:simpleType>
A GlobalElement specifies that an element should be declared as a global element,
that is, outside of any complex types, for reuse.
Specification attributes for xsp:GlobalElement are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the Global Element | xs:string | 1..1 |
| namespace | The namespace of the Global Element | xs:string | 0..1 |
| minOccurs | The miminum cardinality of the Global Element. Only relevant if there is a Root Element that encapsulates the Global Element. | OccursType | 0..1 |
| maxOccurs | The maximum cardinality of the Global Element. Only relevant if there is a Root Element that encapsulates the Global Element. | OccursType | 0..1 |
Some examples of GlobalElement are shown below:
<xsp:GlobalElement name="Library" namespace="xspts" type="xspts:LibraryType"/> <xsp:GlobalElement name="Book" namespace="xspts" type="xspts:BookType"/> <xsp:GlobalElement name="Page" namespace="xspts" type="xspts:PageType"/>
The corresponding XSD is as follows:
<xs:element xmlns="xspts" name="Library" type="xspts:LibraryType"/> <xs:element xmlns="xspts" name="Book" type="xspts:BookType"/> <xs:element xmlns="xspts" name="Page" type="xspts:PageType"/>
A GlobalElementRef is a reference to an element that is declared as a global type.
This allows reuse of global elements across schemas.
Specification attributes for xsp:GlobalElementRef are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the Global Element | xs:QName | 1..1 |
| minOccurs | The miminum cardinality of the Global Element. | OccursType | 0..1 |
| maxOccurs | The maximum cardinality of the Global Element. | OccursType | 0..1 |
Examples of GlobalElementRef are shown below:
<xsp:GlobalElementRef name="org:Organization" minOccurs="0" maxOccurs="1"/> <xsp:GlobalElementRef name="qudt:Unit" minOccurs="1" maxOccurs="1"/> <xsp:GlobalElementRef name="tcmi:Parameter" minOccurs="0"/>
An Import specification corresponds to the xsd:import construct in XML Schema.
Specification attributes for xsp:Import are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the attribute group | xs:string | 1..1 |
| namespace | The namespace of the attribute group | xs:string | 0..1 |
Using examples from NASA, this is specified as follows:
<Import namespace="https://nst.nasa.gov/esmd/cx/c3i.owl"
schemaLocation="NExIOM_XSP_XSD-c3i-(v1.173).xsd"/>
<Import namespace="https://nst.nasa.gov/esmd/cx/cx.owl"
schemaLocation="NExIOM_XSP_XSD-cx-(v1.39).xsd">/>
<Import namespace="https://nst.nasa.gov/esmd/cx/cxda.owl"
schemaLocation="NExIOM_XSP_XSD-cxda-(v1.150).xsd"/>
<Import namespace="https://nst.nasa.gov/esmd/cx/governance.owl"
schemaLocation="NExIOM_XSP_XSD-gov-(v1.45).xsd"/>
An ListElement specifies a transformation to a seperator-based list for an element within an ElementGroup or ObjectType that can have multiple values.
Specification attributes for xsp:ListElement are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the attribute group | xs:string | 1..1 |
| namespace | The namespace of the attribute group | xs:string | 0..1 |
| type | The type of the list elements | xs:QName | 1..1 |
| minOccurs | The miminum cardinality of the Global Element. | OccursType | 0..1 |
| maxOccurs | The maximum cardinality of the Global Element. | OccursType | 0..1 |
A Namespace specification in XSP corresponds directly to an xmlns declaration in
XML Schema.
Specification attributes for xsp:Namespace are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the attribute group | xs:string | 1..1 |
| namespace | The namespace of the attribute group | xs:string | 0..1 |
Using examples from NASA, this is specified as follows:
<Namespace prefix="data"
uri="https://data.nasa.gov/qudt/3010/data.owl"/>
<Namespace prefix="c3i"
uri="https://data.nasa.gov/c3i/3104/c3i.owl"/>
<Namespace prefix="cx"
uri="https://data.nasa.gov/cx/3201/cx.owl"/>
<Namespace prefix="cxda"
uri="https://data.nasa.gov/cx/3203/cxda.owl"/>
<Namespace prefix="gov"
uri="https://data.nasa.gov/core/3030/governance.owl"/>
A common approach to defining XML documents is to nest elements within elements.
XSP supports this in ObjectType definitions by specifying one or more
NestedElement constructs as the contained elements within the Object.
The type attribute of a NestedElement must reference an ObjectType.
Specification attributes for xsp:NestedElement are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the attribute group | xs:string | 1..1 |
| namespace | The namespace of the attribute group | xs:string | 0..1 |
| relation | The semantic for the relationship from the parent to this child element | xs:QName |
0..1 |
| type | The type for the child element | xs:QName |
1..1 |
Specifications for xsp:ObjectType are as follows:
| Specification | Construct | Description | Type | Cardinality |
|---|---|---|---|---|
| name | attribute | The name of the Object Type | xs:string | 1..1 |
| namespace | attribute [0..1] | The namespace of the Object Type | xs:string | 0..1 |
| Doc | element | Documentation | xs:string | 0..n |
| BaseType | attribute [0..1] | One or more superclasses of the Object Type | xs:QName |
0..1 |
| SuperClass | element | One or more superclasses of the Object Type | xs:QName |
0..1 |
| SuperClass | attribute [0..1] | One (and only one) superclass of the Object Type, if expressed as an attribute | xs:QName |
0..1 |
| Attribute | element | Defines or references one or more Attributes | AttributeType | 0..1 |
| AttributeGroupRef | element | Reference to an Attribute Group | AttributeGroupRefType | 0..1 |
| ReferenceElement | element | References, as opposed to defines, another element | ReferenceElementType | 0..1 |
| ScalarElement | element | Defines, local to the Object Type, an element whose values must be of an XSD Simple Type | ScalarElementType | 0..1 |
| NestedElement | element | Defines local to the Object Type, an element of a specified Object Type | NestedElementType | 0..1 |
| StripingElement | element | Defines an Element that has RDF striping around the element | StripingElementType | 0..1 |
| CollectionElement | element | Definition of a CollectionElement within the Object Type | CollectionElementType | 0..1 |
| ElementGroupRef | element | Reference to a group of elements to be included within the Object Type | ElementGroupRefType | 0..1 |
An ObjectType is defined by identifying its content explicitly, as shown in the sections that follow.
The content of an ObjectType consists of sub-elements and attributes.
The sub-elements represent the content elements of the ObjectType.
The following elements can be specified within an ObjectType:
ScalarElement,
ReferenceElement,
NestedElement,
StripingElement, and
CollectionElement.
An example for 'LibraryType' follows.
<xsp:ObjectType name="LibraryType" namespace="xspts">
<xsp:CollectionElement name="LibraryBook" type="xspts:BookType"
relation="xspts:hasBook"/>
</xsp:ObjectType>
The resultant XML Schema is:
<xs:complexType xmlns="xspts" name="LibraryType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence>
<xs:element name="LibraryBookCollection" type="xspts:LibraryBookCollectionType">
<!-- [T806] Collection Element - relation is xspts:hasBook-->
<xs:annotation>
<xs:documentation>
<xc:relation>xspts:hasBook</xc:relation>
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
...
...
<!-- == LibraryBookCollectionType (Generated) == -->
<xs:complexType name="LibraryBookCollectionType">
<!-- [T807] Collection Element Type-->
<xs:sequence maxOccurs="unbounded">
<xs:element name="LibraryBook" type="xspts:BookType"/>
</xs:sequence>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
An example for 'BookType' follows.
<xsp:ObjectType name="BookType" namespace="xspts" baseType="xspts:PublicationType">
<xsp:SuperClass ref="xspts:Publication"/>
<xsp:SuperClass ref="xspts:LibraryAsset"/>
<xsp:AttributeGroupRef ref="xspts:BookAttributeGroup"/>
<xsp:NestedElement name="contents"
relation="xspts:toc"
type="xspts:TableOfContentsAsNestedType"/>
<xsp:NestedElement name="chapter"
relation="xspts:chapter"
type="xspts:ChapterWithStripingElementType"/>
</xsp:ObjectType>
The resultant XML Schema is:
<xs:complexType xmlns="xspts" name="BookType">
<xs:annotation>
<xs:documentation>
<xc:superClass>xspts:Publication</xc:superClass>
<xc:superClass>xspts:LibraryAsset</xc:superClass>
</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="xspts:PublicationType">
<xs:sequence>
<xs:element name="contents" type="xspts:TableOfContentsAsNestedType">
<!-- [T803] Nested Element - relation is xspts:toc-->
<xs:annotation>
<xs:documentation>
<xc:relation>xspts:toc</xc:relation>
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="chapter" type="xspts:ChapterWithStripingElementType">
<!-- [T803] Nested Element - relation is xspts:chapter-->
<xs:annotation>
<xs:documentation>
<xc:relation>xspts:chapter</xc:relation>
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attributeGroup ref="xspts:BookAttributeGroup"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
An example for 'TableOfContents' with all 'TocEntries' as reference elements follows.
<xsp:ObjectType name="TableOfContentsEntryAsRefType" namespace="xspts"> <xsp:Attribute ref="xspts:pageNumber"/> <xsp:ReferenceElement name="toc" type="xspts:TocEntryType" relation="xspts:hasTOC"/> </xsp:ObjectType>
The resultant XML Schema is:
<!-- == TableOfContentsEntryAsRefType == -->
<xs:complexType xmlns="xspts" name="TableOfContentsEntryAsRefType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence>
<xs:element name="toc">
<!-- [T801] Reference Element - Range must be of type xspts:TocEntryType-->
<xs:annotation>
<xs:documentation>
<rdfs:range>xspts:TocEntryType</rdfs:range>
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute ref="xspts:pageNumber"/>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
An example for 'TableOfContentsEntry' with the 'ChapterName' as a ScalarElement follows.
<xsp:ObjectType name="TableOfContentsEntryAsScalarType" namespace="xspts"> <xsp:Attribute ref="xspts:pageNumber"/> <xsp:ScalarElement name="ChapterName" type="xspts:ChapterNameType" /> </xsp:ObjectType>
The resultant XML Schema is:
<!-- == TableOfContentsEntryAsScalarType == -->
<xs:complexType xmlns="xspts" name="TableOfContentsEntryAsScalarType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence>
<xs:element name="ChapterName" type="xspts:ChapterNameType"/>
</xs:sequence>
<xs:attribute ref="xspts:pageNumber"/>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
...
...
<!-- == ChapterNameType == -->
<xs:simpleType xmlns="xspts" name="ChapterNameType">
<!-- [T302] Scalar Type-->
<xs:restriction base="xs:string"/>
</xs:simpleType>
An example for 'Chapter' defined using a StripingElement follows.
<xsp:ObjectType name="ChapterWithStripingElementType"
namespace="xspts"
superClass="xsp:BookPart">
<xsp:Attribute ref="xspts:chapterNumber"/>
<xsp:ScalarElement name="ChapterName" baseType="xs:string"/>
<xsp:StripingElement name="page"
namespace="xspts"
type="xspts:PageType"/>
relation="xspts:hasPage"
</xsp:ObjectType>
...
...
<xsp:ObjectType name="PageType" namespace="xspts">
<xsp:Attribute ref="xspts:pageNumber"/>
</xsp:ObjectType>
The resultant XML Schema is:
<xs:complexType xmlns="xspts" name="ChapterWithStripingElementType">
<!-- [T402] Object Type with superclass=xsp:BookPart-->
<xs:sequence>
<xs:element name="ChapterName" type="xs:string"/>
<xs:element name="page">
<!-- [T804] Striping Element - relation is xspts:hasPage-->
<xs:annotation>
<xs:documentation>
<xc:relation>xspts:hasPage</xc:relation>
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Page" type="xspts:PageType"/>
</xs:sequence>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute ref="xspts:chapterNumber"/>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
...
...
<xs:complexType xmlns="xspts" name="PageType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence/>
<xs:attribute ref="xspts:pageNumber"/>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
A ReferenceElement has a name attribute that
points to a value, expressed as a QName. If the attribute relation is specified
then, in the case of XML Schemas, the reference is expressed as an attribute
value, otherwise it is the value of the element. The string provided for
this attribute is the property that will become the name of the attribute
reference in the generated XML Schema. This is used for referencing
resources in the same or different namespaces, including references to
Standard Vocabulary elements.
Specification attributes for xsp:ReferenceElement are as
follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the attribute group | xs:string | 1..1 |
| namespace | The namespace of the attribute group | xs:string | 0..1 |
Consider, for example, a reference to a 'Unit' defined in the 'units' namespace. In XSP, this would be defined as follows:
<ReferenceElement name="Unit" type="unit:Unit"/>
This results in the following XML Schema content being generated:
<xs:element name="Unit">
<xs:annotation>
<xs:documentation>
Reference Element.
Attribute xc:ref is used to point to the referenced value,
which must be of type unit:UnitType
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:annotation>
<xs:documentation>A Reference Element Type</xs:documentation>
</xs:annotation>
...
</xs:complexType>
</xs:element>
An instance of 'unit', such as 'Length' would be expressed as follows:
<Unit ref="unit:Length"/>
The RootElement element is optional, and its name is the name of the root element in the
generated XML Schema.
The content of the RootElement is made up of one or more
ObjectTypes and ScalarElements
In the generated XML Schema File, they occur inside the root element, but for simplicity we
keep the structure of the XSP Schema relatively flat.
A ScalarElement should be defined for any element
whose datatype is a standard XML scalar datatype, that is, a SimpleType in XML Schema.
All other elements should be defined as ObjectTypes.
Specification attributes for xsp:RootElement are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the attribute group | xs:string | 1..1 |
| namespace | The namespace of the attribute group | xs:string | 0..1 |
The XML Schema element generated from a ScalarElement is a complex type that extends a
SimpleType. This allows an element to carry a value of type xs:anySimpleType
or any of its sub-types.
Specification attributes for xsp:ScalarElement are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the attribute group | xs:string | 1..1 |
| namespace | The namespace of the attribute group | xs:string | 0..1 |
For example, consider the specification of the title of a book:
<ScalarElement name="BookTitle" type="xs:string"></ScalarElement>
The XML Schema that results from this XSP is as follows:
<xs:element name="BookTitle">
<xs:annotation>
<xs:documentation>A Scalar Element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:annotation>
<xs:documentation>A Scalar Element Type</xs:documentation>
</xs:annotation>
<xs:simpleContent>
<xs:extension base="xs:anySimpleType">
...
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
An instance of use of BookTitle is shown below:
<BookTitle>XML for the Working Physicist</BookTitle>
A ScalarType specification in XSP corresponds to a global named complex type that
extends a SimpleType expressed with SimpleContent, allowing an element to carry a value of
type xs:anySimpleType or its sub-types.
Specification attributes for xsp:ScalarType are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the attribute group | xs:string | 1..1 |
| namespace | The namespace of the attribute group | xs:string | 0..1 |
Consider the example of a 'BirthDate'. This is specified as follows:
<ScalarType baseType="udt:DateType"
name="PersonBirthDateType" namespace="moj-cbc" superClasses="udt:Date"/>
The XML Schema that results from this XSP is as follows:
<xsd:complexType name="PersonBirthDateType">
<xsd:simpleContent>
<xsd:extension base="udt:DateType"/>
</xsd:simpleContent>
</xsd:complexType>
A StripingElement is a variation on a NestedElement. An XML
Schema pattern similar to RDF striping is generated. The generated pattern is
more verbose than that generated for a NestedElement, and is not
ordinarily used.
An RDF statement is made up of a subject, property and object. This structuring can be applied to XML elements in the following way. The outermost element of the XML element structure is the subject of the RDF statement, the next nested element is the property and the innermost element is the object of the RDF statement.
Striping explicitly distinguishes those XML elements that define "properties and relationships" from those that describe "subjects and objects", and therefore leads to cleaner models.
Specification attributes for xsp:StripingElement are as follows:
| Attribute | Description | Type | Cardinality |
|---|---|---|---|
| name | The name of the Striping Element | xs:string | 1..1 |
| namespace | The namespace of the Striping Element | xs:string | 0..1 |
| type | The type of the Striping Element | xs:QName | 0..1 |
| relation | The relation between the parent and the Striping Element | xs:QName | 0..1 |
| minOccurs | Minimum Cardinality | OccursType | 0..1 |
| maxOccurs | Maximum Cardinality | OccursType | 0..1 |
The XML example below describes the 'Lunar Surface Access Module (LSAM)' as a composite vehicle comprising the 'Descent Module' and the 'Ascent Module'.
<CompositeVehicle rdf:ID="LSAM">
<hasVehicle>
<SpaceVehicle rdf:ID="LSAM-AscentModule">
...
</SpaceVehicle>
</hasVehicle>
<hasVehicle>
<SpaceVehicle rdf:ID="LSAM-DecentModule">
...
</SpaceVehicle>
</hasVehicle>
</CompositeVehicle>
There are many cases where introducing additional XML elements will be problematic for XML Schemas. For example, existing XML standards cannot be extended in this manner. However, introducing additional XML attributes to represent properties typically does not cause problems for tools that use these Schemas. Attribute-Based RDF Striping is the recommended approach for XML SchemaPlus.
In this approach RDF/OWL properties are not expressed as interstitial elements but as attributes on parent and child elements - the subjects and objects of the RDF triples, respectively. The use of additional attributes typically does not break the parsing of XML instance documents, because the additional attributes are ignored by XML processing tools.
A single semantic relationship between a Parent and its child elements is expressed as a predicate
represented with a owl:ObjectProperty attribute
in the parent element. All children are then related to the parent through this
property.
The interpretation of these constructs is that the parent element is the subject of one or more triples that have the given property as predicate and the child elements as objects (using their respective rdf:ID values as identifiers).
Multiple semantic relationships from a parent element to contained elements must
be disambiguated on the child elements by each child carrying the
owl:ObjectProperty for the relationship using the attribute
xc:relation.
This establishes a semantic association between a child element with its parent,
and the resulting interpretation is a statement with the child element as subject and the
parent element as object.
The value of the owl:ObjectProperty attribute must be the Qualified Name (QName)
of an existing RDF/OWL property.
This structuring can be applied to XML elements by associating an inverse property with each child element. By means of introducing additional XML attributes, XML Schemas can be enhanced with semantic markup, without breaking legacy XML processing tools.
The XML example below describes the 'Lunar Surface Access Module (LSAM)' as a composite vehicle comprising the 'Descent Module' and the 'Ascent Module'. The Mass of the composite vehicle has been included to illustrate how 'Attribute-based RDF Striping' can explicitly state the relationship with the containing XML Element.
<Vehicle rdf:ID="LSAM">
<Vehicle rdf:ID="LSAM-AscentModule" xc:relation="system:hasVehicle">
...
</ Vehicle>
<Vehicle rdf:ID="LSAM-DescentModule" xc:relation="system:hasVehicle"
...
</ Vehicle>
<Parameter rdf:ID="LSAM-Mass" xc:relation="system:hasParameter"/>
</ Vehicle>
The next example is a complete XSP Schema from which the small examples in the specification were taken:
<?xml version="1.0" encoding="UTF-8"?>
<!-- XSP file
author: Ralph Hodgson
========================================
-->
<xsp:XSP
xsi:schemaLocation="http://www.xspl.us/schemas/xsp.xsd
../XSD/xsp-(v1.0).xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsp="http://www.xspl.us/schemas/xsp.xsd"
xmlns:xc="http://www.xspl.us/schemas/xc.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xspts="http://www.xspl.us/xsp/example/xspts.xsd"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:ccts="urn:un:unece:uncefact:documentation:2"
xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2"
xmlns:clm54217="urn:un:unece:uncefact:codelist:specification:54217:2001"
xmlns:risk="http://www.xspl.us/xsp/example/risk.owl"
xmlns:security="http://www.xspl.us/xsp/example/security.owl"
xmlns="http://www.xspl.us/xsp/example/test.owl">
<xsp:Doc>
<xsp:DocText>
----------------------------------------------
Test Suite Full Example for XML SchemaPlus
----------------------------------------------
version: 1.0
created by: Ralph Hodgson
last modified: July 23, 2009
modified by: Gokhan Soydan
----------------------------------------------
</xsp:DocText>
</xsp:Doc>
<!-- ====== Default Namespace ======= -->
<xsp:DefaultNamespace
uri="http://www.xspl.us/xsp/example/xspts.xsd" prefix="xspts"/>
<!-- ====== Namespaces ======= -->
<xsp:Namespace prefix="security"
uri="http://nst.nasa.gov/esmd/cx/security.owl" />
<xsp:Namespace prefix="xspts"
uri="http://www.xspl.us/xsp/example/xspts.xsd" />
<xsp:Namespace prefix="clm54217"
uri="urn:un:unece:uncefact:codelist:specification:54217:2001"/>
<!-- ====== Imports ======= -->
<xsp:Import
namespace="http://www.xspl.us/xsp/example/test-import.xsd"
schemaLocation="../XSD/xsp-test-import.xsd"/>
<!-- ====== Root Element ======= -->
<xsp:RootElement name="XSL-TestSuite"/>
<!-- ====== Attribute ======= -->
<xsp:Attribute name="chapterNumber" namespace="xspts" type="xs:integer"/>
<xsp:Attribute name="pageNumber" type="xs:integer"/>
<xsp:Attribute name="maxValue" type="xc:numericType"/>
<xsp:Attribute name="minValue" type="xc:numericType"/>
<xsp:Attribute name="targetValue" type="xc:numericType"/>
<xsp:Attribute name="title" type="xs:string"/>
<xsp:Attribute name="publisher" type="xs:string"/>
<xsp:Attribute name="year" type="xs:gYear"/>
<xsp:Attribute name="isbn" type="xs:string"/>
<!-- ====== Attribute Groups ======= -->
<xsp:AttributeGroup name="BookAttributeGroup" namespace="xspts">
<xsp:Attribute ref="xspts:title" use="required"/>
<xsp:Attribute ref="xspts:publisher" use="required"/>
<xsp:Attribute ref="xspts:year" use="required"/>
<xsp:Attribute ref="xspts:isbn" use="required"/>
</xsp:AttributeGroup>
<!-- ====== Global Elements ======= -->
<xsp:GlobalElement name="Book" namespace="xspts"
type="xspts:BookType"
minOccurs="0" maxOccurs="unbounded"/>
<xsp:GlobalElement name="Library" namespace="xspts"
type="xspts:LibraryType"
minOccurs="0" maxOccurs="1"/>
<!-- ====== Element Groups ======= -->
<xsp:ElementGroup name="LibraryElementsGroup">
<xsp:ScalarElement name="buildingName" baseType="xs:string"/>
<xsp:NestedElement name="libraryPublication" type="xspts:PublicationType"
relation="xspts:hasLibraryPublication"/>
</xsp:ElementGroup>
<!-- ====== Object Types ======= -->
<xsp:ObjectType name="BookPartType" namespace="xspts"/>
<xsp:ObjectType name="BookType" namespace="xspts" baseType="xspts:PublicationType">
<xsp:SuperClass ref="xspts:Publication"/>
<xsp:SuperClass ref="xspts:LibraryAsset"/>
<xsp:AttributeGroupRef ref="xspts:BookAttributeGroup"/>
<xsp:NestedElement name="toc"
relation="xspts:toc"
type="xspts:TocType"/>
<xsp:NestedElement name="chapter"
relation="xspts:chapter"
type="xspts:ChapterType"/>
</xsp:ObjectType>
<xsp:ObjectType name="ChapterType" namespace="xspts"
superClass="xsp:BookPart"
baseType="xspts:BookPartType">
<xsp:Attribute ref="xspts:chapterNumber"/>
<xsp:ScalarElement name="ChapterName" type="xspts:ChapterNameType"/>
<xsp:StripingElement name="page" namespace="xspts"
relation="xspts:hasPage"
type="xspts:PageType"/>
</xsp:ObjectType>
<xsp:ObjectType name="LibraryType" namespace="xspts">
<xsp:ElementGroupRef ref="xspts:LibraryElementsGroup"/>
<xsp:ReferenceElement name="libraryBook" type="xspts:BookType"
relation="xspts:hasBook"/>
</xsp:ObjectType>
<xsp:ObjectType name="PageType" namespace="xspts">
<xsp:Attribute ref="xspts:pageNumber"/>
</xsp:ObjectType>
<xsp:ObjectType name="PublicationType" namespace="xspts"/>
<xsp:ObjectType name="TocEntryType" namespace="xspts">
<xsp:ScalarElement name="chapterTitle" namespace="xspts" baseType="xs:string"/>
<xsp:Attribute ref="xspts:chapterNumber"/>
<xsp:Attribute ref="xspts:pageNumber"/>
</xsp:ObjectType>
<xsp:ObjectType name="TocType" namespace="xspts">
<xsp:CollectionElement name="TocEntry" type="xspts:TocEntryType"
relation="xspts:tocEntry"/>
</xsp:ObjectType>
<!-- ====== Enumerations ======= -->
<xsp:Enumeration name="CurrencyCodeEnumeration" namespace="qdt"
type="qdt:CurrencyCodeType"
default="clm54217:Euro" representation="codelist" base="xs:string">
<xsp:EnumerationElementRef ref="clm54217:ArgentinePeso" />
<xsp:EnumerationElementRef ref="clm54217:AzerbaijanianManat" />
<xsp:EnumerationElementRef ref="clm54217:EthopianBirr" />
<xsp:EnumerationElementRef ref="clm54217:Euro" />
<xsp:EnumerationElementRef ref="clm54217:TurkishLira"/>
<xsp:EnumerationElementRef ref="clm54217:US-Dollar"/>
<xsp:EnumerationElementRef ref="clm54217:YemeniRial"/>
<xsp:EnumerationElementRef ref="clm54217:ZimbabweDollar"/>
</xsp:Enumeration>
<xsp:Enumeration name="HazardSeverityTypeEnumeration" namespace="risk"
type="risk:RiskEnumeration"
default="marginal" representation="xsd-strings" base="xs:string">
<xsp:EnumerationElement name="risk:Negligible"
type="risk:HazardSeverityType"
code="1" order="1" literal="negligible"/>
<xsp:EnumerationElement name="risk:Marginal"
type="risk:HazardSeverityType"
code="4" order="3" literal="marginal"/>
<xsp:EnumerationElement name="risk:Critical"
type="risk:HazardSeverityType"
code="7" order="4" literal="critical"/>
</xsp:Enumeration>
<xsp:Enumeration name="SecurityLevelTypeEnumeration" namespace="security"
type="security:SecurityEnumeration"
default="security:SensitiveButUnclassified"
representation="xsd-qnames">
<xsp:EnumerationElementRef ref="security:Restricted"/>
<xsp:EnumerationElementRef ref="security:SensitiveButUnclassified"/>
<xsp:EnumerationElementRef ref="security:TopSecret"/>
</xsp:Enumeration>
<!-- ====== Enumeration Elements ======= -->
<xsp:EnumerationElement name="security:Restricted"
type="security:SecurityLevelType"
code="1" literal="restricted" order="2">
<dc:description>During and before World War II, the U.S. had a category of classified
information called 'restricted', which was below confidential. The U.S. no longer has a restricted
classification, but many other nations and NATO do. The U.S. treats "restricted"
information it receives from other governments as confidential. The U.S. does use the term
restricted data in a completely different way to refer to nuclear secrets.
</dc:description>
</xsp:EnumerationElement>
<xsp:EnumerationElement name="security:SensitiveButUnclassified"
type="security:SecurityLevelType"
code="3" literal="sbu" order="4">
<dc:description>Sensitive but Unclassified (SBU) information should not be disclosed but
is not national security information and cannot be classified according to Executive Order
(EO)12958, as amended. These materials must be: properly marked, locked up when not under
the supervision of an authorized person, and encrypted while in transit over a non-secure
network. Some examples are: trade secrets, proprietary information, financial information,
personnel and medical records, procurement-sensitive information, IT system security plans,
contingency plans, audit logs (recordings of exceptions and other security-related events),
vulnerability reports, incident reports and Personally Identifiable Information (PII).
</dc:description>
</xsp:EnumerationElement>
<xsp:EnumerationElement name="security:TopSecret"
type="security:SecurityLevelType"
code="6" literal="topsecret" order="7">
<dc:description>"Top Secret" shall be applied to information, the unauthorized
disclosure of which reasonably could be expected to cause exceptionally grave damage
to the national security that the original classification authority is able to identify
or describe [US Executive Order 12958].
</dc:description>
</xsp:EnumerationElement>
<!-- ====== Scalar Types ======= -->
<xsp:ScalarType name="AmountType" namespace="xspts" baseType="xs:decimal" >
<xsp:Doc>
<xsp:Namespace prefix="ccts" uri="urn:un:unece:uncefact:documentation:2"/>
<xsp:DocText>Testing structured annotations using CCTS constructs</xsp:DocText>
<xsp:DocElement name="ccts:UniqueID" value="UDT000001"/>
<xsp:DocElement name="ccts:CategoryCode" value="UDT"/>
<xsp:DocElement name="ccts:DictionaryEntryName" value="Amount.Type"/>
<xsp:DocElement name="ccts:VersionID" value="1.0"/>
<xsp:DocElement name="ccts:Definition"
value="A number of monetary units specified in a currency
where the unit of the currency is explicit or implied."/>
<xsp:DocElement name="ccts:RepresentationTermName" value="Amount"/>
<xsp:DocElement name="ccts:PrimitiveType" value="decimal"/>
<xsp:DocElement name="xsd:BuiltinType" value="decimal"/>
</xsp:Doc>
<xsp:Attribute name="currencyID" type="xs:integer" use="required"/>
</xsp:ScalarType>
<xsp:ScalarType name="ChapterNameType" baseType="xs:string" namespace="xspts"/>
</xsp:XSP>
Using Saxon9 and the XSLT transformer, 'XSP2XSD.xslt', the following XML Schema is generated:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.xspl.us/xsp/example/xspts.xsd"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xc="http://www.xspl.us/schemas/xc.xsd"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:security="http://nst.nasa.gov/esmd/cx/security.owl"
xmlns:xspts="http://www.xspl.us/xsp/example/xspts.xsd"
xmlns:clm54217="urn:un:unece:uncefact:codelist:specification:54217:2001"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
targetNamespace="http://www.xspl.us/xsp/example/xspts.xsd">
<!-- *** XSP to XSD Generator *** -->
<!-- *** Revision: 1.23 $ *** -->
<!-- *** Id: XSP2XSD-(v2.0).xslt,v 1.23 2009/07/22 01:15:50 arc\rhodgson Exp $ *** -->
<xs:annotation>
<xs:documentation xml:lang="en">
----------------------------------------------
Test Suite Full Example for XML SchemaPlus
----------------------------------------------
version: 1.0
created by: Ralph Hodgson
last modified: July 23, 2009
modified by: Gokhan Soydan
----------------------------------------------
</xs:documentation>
</xs:annotation>
<!--=== Imports ===-->
<xs:import namespace="http://purl.org/dc/elements/1.1/"
schemaLocation="../XSD/xsp-dc-(v1.0).xsd"/>
<xs:import namespace="http://www.xspl.us/schemas/xc.xsd"
schemaLocation="../XSD/xsp-xc-(v1.0).xsd"/>
<xs:import namespace="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
schemaLocation="../XSD/xsp-rdf-(v1.0).xsd"/>
<xs:import namespace="http://www.w3.org/2000/01/rdf-schema#"
schemaLocation="../XSD/xsp-rdfs-(v1.0).xsd"/>
<xs:import namespace="http://www.xspl.us/xsp/example/test-import.xsd"
schemaLocation="../XSD/xsp-test-import.xsd"/>
<!--=== Global Attributes ===-->
<xs:attribute xmlns="xspts" name="chapterNumber" type="xs:integer"/>
<xs:attribute name="pageNumber" type="xs:integer"/>
<xs:attribute name="maxValue" type="xc:numericType"/>
<xs:attribute name="minValue" type="xc:numericType"/>
<xs:attribute name="targetValue" type="xc:numericType"/>
<xs:attribute name="title" type="xs:string"/>
<xs:attribute name="publisher" type="xs:string"/>
<xs:attribute name="year" type="xs:gYear"/>
<xs:attribute name="isbn" type="xs:string"/>
<!-- == BookAttributeGroup == -->
<xs:attributeGroup xmlns="xspts" name="BookAttributeGroup">
<!-- [T504] An Attribute Group-->
<xs:attribute ref="xspts:title" use="required"/>
<xs:attribute ref="xspts:publisher" use="required"/>
<xs:attribute ref="xspts:year" use="required"/>
<xs:attribute ref="xspts:isbn" use="required"/>
</xs:attributeGroup>
<!--=== Element Groups ===-->
<!-- == LibraryElementsGroup == -->
<xs:group name="LibraryElementsGroup">
<!-- [T502] An Element Group-->
<xs:sequence>
<xs:element name="buildingName" type="xspts:buildingNameScalarType"/>
<xs:element name="libraryPublication" type="xspts:PublicationType">
<!-- [T803] Nested Element - relation is xspts:hasLibraryPublication-->
<xs:annotation>
<xs:documentation>
<xc:relation>xspts:hasLibraryPublication</xc:relation>
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:group>
<!--== Root Element ==-->
<xs:element name="XSL-TestSuite" type="XSL-TestSuiteRootType">
</xs:element>
<!--=== Scalar Types ===-->
<!-- == AmountType == -->
<xs:complexType xmlns="xspts" name="AmountType">
<!-- [T303] Scalar Type with attributes-->
<xs:annotation>
<xs:documentation xmlns:ccts="urn:un:unece:uncefact:documentation:2">Testing structured annotations using CCTS constructs
<ccts:UniqueID>UDT000001</ccts:UniqueID>
<ccts:CategoryCode>UDT</ccts:CategoryCode>
<ccts:DictionaryEntryName>Amount.Type</ccts:DictionaryEntryName>
<ccts:VersionID>1.0</ccts:VersionID>
<ccts:Definition>A number of monetary units specified in a currency where the unit of the currency is explicit or implied.</ccts:Definition>
<ccts:RepresentationTermName>Amount</ccts:RepresentationTermName>
<ccts:PrimitiveType>decimal</ccts:PrimitiveType>
<xsd:BuiltinType xmlns:xsd="urn:un:unece:uncefact:documentation:2">decimal</xsd:BuiltinType>
</xs:documentation>
</xs:annotation>
<xs:simpleContent>
<xs:extension base="xs:decimal">
<xs:attribute name="currencyID" type="xs:integer" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<!-- == ChapterNameType == -->
<xs:simpleType xmlns="xspts" name="ChapterNameType">
<!-- [T302] Scalar Type-->
<xs:restriction base="xs:string"/>
</xs:simpleType>
<!--=== Object Types ===-->
<!-- == BookPartType == -->
<xs:complexType xmlns="xspts" name="BookPartType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence/>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
<!-- == BookType == -->
<xs:complexType xmlns="xspts" name="BookType">
<xs:annotation>
<xs:documentation>
<xc:superClass>xspts:Publication</xc:superClass>
<xc:superClass>xspts:LibraryAsset</xc:superClass>
</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="xspts:PublicationType">
<xs:sequence>
<xs:element name="toc" type="xspts:TocType">
<!-- [T803] Nested Element - relation is xspts:toc-->
<xs:annotation>
<xs:documentation>
<xc:relation>xspts:toc</xc:relation>
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="chapter" type="xspts:ChapterType">
<!-- [T803] Nested Element - relation is xspts:chapter-->
<xs:annotation>
<xs:documentation>
<xc:relation>xspts:chapter</xc:relation>
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attributeGroup ref="xspts:BookAttributeGroup"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- == ChapterType == -->
<xs:complexType xmlns="xspts" name="ChapterType">
<!-- [T402] Object Type with superclass=xsp:BookPart-->
<xs:complexContent>
<xs:extension base="xspts:BookPartType">
<xs:sequence>
<xs:element name="ChapterName" type="xspts:ChapterNameType"/>
<xs:element name="page">
<!-- [T804] Striping Element - relation is xspts:hasPage-->
<xs:annotation>
<xs:documentation>
<xc:relation>xspts:hasPage</xc:relation>
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="Page" type="xspts:PageType"/>
</xs:sequence>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute ref="xspts:chapterNumber"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- == LibraryType == -->
<xs:complexType xmlns="xspts" name="LibraryType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence>
<xs:group ref="xspts:LibraryElementsGroup"/>
<xs:element name="libraryBook">
<!-- [T801] Reference Element - Range must be of type xspts:BookType-->
<xs:annotation>
<xs:documentation>
<rdfs:range>xspts:BookType</rdfs:range>
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
<!-- == PageType == -->
<xs:complexType xmlns="xspts" name="PageType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence/>
<xs:attribute ref="xspts:pageNumber"/>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
<!-- == PublicationType == -->
<xs:complexType xmlns="xspts" name="PublicationType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence/>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
<!-- == TocEntryType == -->
<xs:complexType xmlns="xspts" name="TocEntryType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence>
<xs:element name="chapterTitle" type="xspts:chapterTitleScalarType"/>
</xs:sequence>
<xs:attribute ref="xspts:chapterNumber"/>
<xs:attribute ref="xspts:pageNumber"/>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
<!-- == TocType == -->
<xs:complexType xmlns="xspts" name="TocType">
<!-- [T402] Object Type with no superclass-->
<xs:sequence>
<xs:element name="TocEntryCollection" type="xspts:TocEntryCollectionType">
<!-- [T806] Collection Element - relation is xspts:tocEntry-->
<xs:annotation>
<xs:documentation>
<xc:relation>xspts:tocEntry</xc:relation>
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
<!--=== Automatically Generated Types ===-->
<!-- == XSL-TestSuiteRootType (Generated) == -->
<xs:complexType name="XSL-TestSuiteRootType">
<!-- [T808] Root Type-->
<xs:choice maxOccurs="unbounded">
<xs:element xmlns="xspts" name="Book" type="xspts:BookType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element xmlns="xspts" name="Library" type="xspts:LibraryType" minOccurs="0"
maxOccurs="1"/>
</xs:choice>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
<!-- == buildingNameScalarType (Generated) == -->
<xs:complexType name="buildingNameScalarType">
<!-- [T702] Scalar Element Type-->
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<!-- == chapterTitleScalarType (Generated) == -->
<xs:complexType xmlns="xspts" name="chapterTitleScalarType">
<!-- [T702] Scalar Element Type-->
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<!-- == TocEntryCollectionType (Generated) == -->
<xs:complexType name="TocEntryCollectionType">
<!-- [T807] Collection Element Type-->
<xs:sequence maxOccurs="unbounded">
<xs:element name="TocEntry" type="xspts:TocEntryType"/>
</xs:sequence>
<xs:attributeGroup ref="xc:W3C-AttributeGroup"/>
<xs:attributeGroup ref="xc:XC-AttributeGroup"/>
</xs:complexType>
<!--=== Enumerations ===-->
<!--== No XSD needed for Codelist Enumeration: CurrencyCodeEnumeration ==-->
<!-- == HazardSeverityTypeEnumeration == -->
<xs:simpleType xmlns="risk" name="HazardSeverityTypeEnumeration">
<!-- [T122] String-based enumeration-->
<xs:restriction base="xs:string">
<xs:enumeration value="negligible">
<xs:annotation>
<xs:documentation>
<xc:order>1</xc:order>
<xc:code>1</xc:code>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="marginal">
<xs:annotation>
<xs:documentation>
<xc:order>3</xc:order>
<xc:code>4</xc:code>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="critical">
<xs:annotation>
<xs:documentation>
<xc:order>4</xc:order>
<xc:code>7</xc:code>
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<!-- == SecurityLevelTypeEnumeration == -->
<xs:simpleType xmlns="security" name="SecurityLevelTypeEnumeration">
<!-- [T120] QName-based enumeration-->
<xs:restriction base="xs:QName">
<xs:enumeration value="security:Restricted"/>
<xs:enumeration value="security:SensitiveButUnclassified"/>
<xs:enumeration value="security:TopSecret"/>
</xs:restriction>
</xs:simpleType>
<xs:annotation>
<xs:documentation>Generated using XSP2XSD XSLT.</xs:documentation>
</xs:annotation>
</xs:schema>
XML SchemaPlus documents are a form of XML file that provide a consise specification of an XML Schema, via an XSLT transformation. Formally, the syntax of a XML SchemaPlus is given by the file XSP Schema.xsd. An XSP Schema basically consists of introductory material defining namespaces, imports, and the desired name of the root element. Then it presents a list of ScalarElements, ObjectElements, and ObjectTypes. The latter two consist themselves of 5 possible kinds of sub-elements: Scalar, Reference, Nested, Striping, and Collection.
The editors would like to thank Alan Hudson, Harry Biersteker, Hugo Den Hollander, Bob DuCharme for their very helpful feedbacks and comments to the document.
Paul J. Keller and Ralph Hodgson