Skip to content

7.2 XSD creation rules

7.2.1 General rules

7.2.1.1 General principle for creating XSDs

During initialization (clause 6.2.1) a Ontology-based Interworking IPE creates XSD files for device types, service types and operation types, according to the class definitions (sub-classes of class:Device, class:Service, class:Operation) in the ontology. Each XSD file contains the definition of a single specialization of a <flexContainer> resource type together with the type definitions that are used for custom attribute s of that specialization. All of these XSD files are stored as <contentInstance> child- resources of a <container> resource that acts as a XSD-storage and that is a child resource of the IPE's <AE> .

The content of these XSD files is entirely based on the information contained in the oneM2M compliant ontology that describes the data model of the interworked technology and which is derived from the oneM2M Base Ontology.
A Ontology-based Interworking IPE can create these XSD files automatically.

In clauses 7.2.2, 7.2.3, 7.2.4 templates for specialization of <flexContainer> resources for Device, Service and Operation are given. These templates need to be filled in with parameters. The parameters and how they relate to classes, object properties and data properties of the ontology are given in the next clause 7.2.1.2.

The attribute: containerDefinition of these XSDs shall have a value identical to the absolute, hierarchical address of the <contentInstance> containing the <flexContainer> specialization (see table below).
Example: //m2m.service.com/IN-CSE-0001/bigFatCse/name_of_IPE_AE/ww.XYZ.com_WashingMachines /testService.xsd

Note

The present specification does not specify short names for primitive parameters, resource attributes, resource types and complex data types members. Such short names can be created on a proprietary basis for individual implementations but for interoperability reasons they are not recommended.

7.2.1.2 Parameters for XSD templates

In the subsequent clauses the following conventions for parameters to fill in XSD templates is used. The column "replacement rules" explains how the parameter is derived from the ontology.

Note

This convention follows roughly conventions of ENTITY declarations for DTD. Each ENTITY that is to be replaced in the XSD starts with "&" and ends with";".

Table 7.2.1.2-1: Conventions for creation of XSDs from ontologies

convention

Is short for

replacement rule

&IPE;

resource ID of the <AE> resource of the IPE

Out of scope of the present document.

&XSDSTORAGE;



resource name of the <container> resource of the 'XSD-storage'.
also identifies the XML targetnamespace: targetNamespace="&XSDSTORAGE;"

Shall be identical to the name of the ontology, omitting "http://" and changing each "/" (slash) into "_" (underscore).
Base OntologyThe 'XSD-storage' <container> is a child-resource of the <AE> resource of the IPE and has <contentinstance> child resources that contain XSDs for the individual <flexContainer> specializations.
Example for &XSDSTORAGE;: ww.XYZ.com_WashingMachines

&XSDFILE;







resource name of a <contentInstance> child-resource of the 'XSD-storage'that contains a XSD for a <flexContainer> specialization.







Shall be the concatenation of

  • &DEVICE; or
  • &SERVICE; or
  • &OPERATION;



and ".xsd"
Example: "testService.xsd"

&CONTAINERDEFINITIONVALUE;







The value of attribute containerDefinition of the specialization of the <flexContainer>







Shall be identical to the absolute, hierarchical address of the <contentinstance> containing the <flexContainer> specialization.
It is the concatenation of:
[address of the Gen-IWK IPE],
"/", &XSDSTORAGE;,"/",
&XSDFILE;
Example:
//m2m.service.com/IN-CSE-0001/bigFatCse/name_of_IPE_AE/ww.XYZ.com_WashingMachines /testService.xsd

&DEVICE;
&DEVICE_1;
...
&DEVICE_n;

Name of <flexContainer > specialization type for a device or a sub-device.




Shall be identical to a class name of a class:Device that is in the range of object property:consistsOf. It identifies a device type.
Base Ontology



&SERVICE_1;
...
&SERVICE_n;

Name of <flexContainer > specialization type for a Service



Shall be identical to the name of a Service class in the ontology.
The class is in the range of object property:hasService of a Device.
(See Note 3)

&OPERATION_1;
...
&OPERATION_n;

Name of <flexContainer > specialization type for an Operation
See Note 1

Shall be identical to the name of an Operation class in the ontology
The class is in the range of object property:hasOperation of a Service.

&THINGPROPERTY_1;
...
&THINGPROPERTY_n;

Name of a customAttribute of the Device's <flexContainer> describing a ThingpProperty of the device.



Shall be identical to the name of a ThingProperty class in the ontology
The class is in the range of object property: hasThingProperty of a Device

&INPUTDATAPOINT_1;
...
&INPUTDATAPOINT_n;

Name of a customAttribute of the Service's <flexContainer> describing an InputDataPoint



Shall be identical to the name of a InputDataPoint class of the service
The class is in the range of object property:hasInputDataPoint of a Service.

&OUTPUTDATAPOINT_1;
...
&OUTPUTDATAPOINT_n;

Name of a customAttribute of the Service's <flexContainer> describing an OutputDataPoint



Shall be identical to the name of a OutputDataPoint class of the service
The class is in the range of object property:hasOutputDataPoint of a Service.

&OPERATIONINPUT_1;
...
&OPERATIONINPUT_n;

Name of a customAttribute of the Operation's <flexContainer> describing an OperationInput



Shall be identical to the name of a OperationInput class of the Operation
The class is in the range of object property:hasInput of an Operation.

&OPERATIONOUTPUT_1;
...
&OPERATIONOUTPUT_n;

Name of a customAttribute of the Operation's <flexContainer> describing an OperationOutput



Shall be identical to the name of a OperationOutput class of the Operation.
The class is in the range of object property:hasOutput of an Operation.

&SIMPLEDATATYPE;























One out of:
xs:NCName ,
xs:anySimpleType ,
xs:anyType ,
xs:anyURI ,
xs:base64Binary ,
xs:boolean ,
xs:decimal ,
xs:dateTime,
xs:double ,
xs:duration ,
xs:float ,
xs:hexBinary ,
xs:integer ,
xs:language ,
xs:nonNegativeInteger ,
xs:normalizedString ,
xs:positiveInteger ,
xs:string ,
xs:token ,
xs:unsignedInt ,
xs:unsignedLong ,
xs:unsignedShort

Shall be identical to the value of the data property:hasDataType























&RESTRICTIONVALUE;

The value of the restriction

Is a regular expression in case of restriction type &RESTRICTIONTYPE; = xs:pattern, in all other cases a number

&TYPENAME;



Name of the type of a variable (Inut/OutputDataPoint, OperationInput/Output,Thingproperty) or name of a sub-structure in a StructuredTypeVariable



Shall be identical to the name the class of a Variable or sub-structure (i.e. a Variable that is the range of object property:hasSubStructure), adding "Type" to that name.
e.g. if the name of an OutputDataPoint class is &OUTPUTDATAPOINT; = "temperature" then the &TYPENAME; is "temperatureType".
If "temperature" is a StructuredTypeVariable, containing substructures with &VARIABLENAME_1; = "fahrenheit" and &VARIABLENAME_2; = "accuracy" then the two &TYPENAME;s would be "fahrenheitType" and "accuracyType"

&VARIABLENAME_1;
&VARIABLENAME_2;
...
&VARIABLENAME_n;

name of a sub-structure in a StructuredTypeVariable




Shall be identical to the class name of a Variable that is the range of object property:hasSubStructure




NOTE 1: In case the operation produces operation output an instance of the <flexContainer > for that operation may have a child-resource of the same <flexContainer> specialization type for that Operation to contain the operation output data.
NOTE 2: For the kind of restriction (xs:minInclusive, xs:maxInclusive ... ) of simple data types no convention is given in this table. Its entry in the XSD file is given by the line:
&lt;_kind-of-restriction_ value="&amp;RESTRICTIONVALUE;"/> where kind-of-restriction is given by the value in the range of a specific sub-property of Data Property: hasDataRestriction of a SimpeTypeVariable. It is possible to specify no restrictions, one restriction or multiple restrictions for a simple data type.
NOTE 3: Sub-services (range of object property:hasSubService of a Service) are not considered in this release.

7.2.1.3 Data typing for Variables

7.2.1.3.1 Information on datatypes contained in the ontology

All classes of the Base Ontology that describe data (i.e. InputDataPoint, OutputDataPoint, OperationInput, OperationOutput, ThingProperty are sub-classes of either the class:SimpleTypeVariable or the class StructuredTypeVariable. (This is due to the fact that class:Variable is the disjoint union of classes SimpleTypeVariable and StructuredTypeVariable).

Class: Variable and its sub-classes Class:SimpleTypeVariable and StructuredTypeVariable support (i.e. are the domain class of) properties that allow to specify the datatype of the variable:

  • Class:SimpleTypeVariable supports data property:isDataList (range: xsd:Boolean).
    If a class of the ontology that describes the Interworked Device is a sub-class of class:SimpleTypeVariable and "isDataList value TRUE " is specified then the class describes a list data type. Similarly, if "isDataList value FALSE " is specified or property:isDataList is not specified then the class describes a data type describing a single value.
  • Class:SimpleTypeVariable supports data property:hasDataType. The range of data property:hasDataType is the set of following strings:

    {"xs:NCName" , "xs:anySimpleType" , "xs:anyType" , "xs:anyURI" , "xs:base64Binary" , "xs:boolean" , "xs:dateTime" , "xs:decimal" , "xs:double" , "xs:duration" , "xs:float" , "xs:hexBinary" , "xs:integer" , "xs:language" , "xs:nonNegativeInteger" , "xs:normalizedString" , "xs:positiveInteger" , "xs:string" , "xs:token" , "xs:unsignedInt" , "xs:unsignedLong" , "xs:unsignedShort"}

This data property indicates that the data type of the Variable is exactly one of these simple XML data types, contained in https://www.w3.org/TR/xmlschema11-2 (see [3] clause 6.3.1).
For example if a class of the ontology that describes the Interworked Device is a sub-class of class:SimpleTypeVariable and " hasDataTypevalue "xs:integer"" is specified then the class describes an integer value (or, if additionally "isDataList value TRUE" is specified, then the class describes a list of integer values).

  • Class:SimpleTypeVariable also supports data property:hasDataRestriction and its sub-properties:

    • hasDataRestriction_minInclusive,
    • hasDataRestriction_maxInclusive,
    • hasDataRestriction_minExclusive,
    • hasDataRestriction_maxExclusive,
    • hasDataRestriction_length,
    • hasDataRestriction_minLength,
    • hasDataRestriction_maxLength,
    • hasDataRestriction_pattern,

    which specify restrictions on the permissible values of the data. - In addition Class: StructuredTypeVariable supports object property:hasSubStructure (range: class:Variable).
    This object property allows to create complex, structured data types. Each class in the range of object property:hasSubStructure signifies an element of the structure.

EXAMPLE:

If a class XY of the ontology is a sub-class of class:Variable and supports object property:

  • hasSubStructure range class:X (class:X being a sub-class of class:Variable)
  • hasSubStructure range class:Y (class:Y being a sub-class of class:Variable)

then class XY is also a sub-class of class: StructuredTypeVariable and describes a structured data type that has data types X and Y as sub structures.

Note

The data properties:hasDataType, isDataList and the object property:hasSubStructure are mutually exclusive:
class:SimpleTypeVariable specifies (is defined as a sub-class of: )"hasSubStructure exactly 0 Variable".
A data type cannot at the same time be a simple data type and a structured data type!

7.2.1.3.2 Construction of Simple Data Types

If class:Variable supports:

  • data property: isDataList value FALSE
  • data property: hasDataTypevalue \(SIMPLEDATATYPE\)

then the XSD for the <flexContainer> that contains a customAttribute of that type (given by &TYPENAME;) needs to contain the typedefinition for that customAttribute.

Table 7.2.1.3.2-1: Type definition for Simple Types

<!-- ********************** -->
<!-- Ontology based IWK Simple Types -->
<!-- ********************** -->

<xs:simpleType name="&TYPENAME;">
    <xs:restriction base="&SIMPLEDATATYPE;">
        <!-- next lines for restrictions of the values. Remove not needed ones, Multiple restrictiontypes possible -->
        <xs:minInclusive value="&RESTRICTIONVALUE;"/>
        <!-- ... xs:minInclusive, xs:maxInclusive, xs:minExclusive, xs:maxExclusive, xs:length, xs:minLength, xs:maxLength, xs:pattern -->
        <xs:maxInclusive value="&RESTRICTIONVALUE;"/>
        <!-- end of lines only for restrictions of the values -->
    </xs:restriction>  
</xs:simpleType>

Example:

if the name of an OutputDataPoint class is &OUTPUTDATAPOINT; = "temperature", which contains a temperature value in Celsius, then a type definition could be

<xs:simpleType name="temperatureType">
    <xs:restriction base="xs:float">
        < xs:minInclusive value="−273.15"/>
        < xs:maxInclusive value="100"/>
    </xs:restriction>  
</xs:simpleType>
7.2.1.3.3 List Data Types

If class:Variable supports:

  • data property: isDataList value TRUE
  • data property: hasDataTypevalue \(SIMPLEDATATYPE\)

then the XSD for the <flexContainer> that contains a customAttribute of that type (given by &TYPENAME;) needs to contain the typedefinition for that customAttribute.

Table 7.2.1.3.3-1: Type definition for List Data Types

<!--********************** -->
<!-- Ontology based IWK Simple Types (Lists)-->
<!--********************** -->

<xs:simpleType name="&TYPENAME;">
    <xs:restriction>
        <xs:simpleType>
            <xs:list>
                <xs:simpleType>
                    <xs:restriction base="&SIMPLEDATATYPE;">
                    </xs:restriction>
                </xs:simpleType>
            </xs:list>
        </xs:simpleType>
        <!-- next lines for restrictions of the values. Remove not needed ones, Multiple restrictiontypes possible -->
        <xs: xs:pattern value="&RESTRICTIONVALUE;"/>
        <!-- ... xs:minInclusive, xs:maxInclusive, xs:minExclusive, xs:maxExclusive, xs:length, xs:minLength, xs:maxLength, xs:pattern -->
        <xs:maxLength value="&RESTRICTIONVALUE;"/>
        <!-- end of lines only for restrictions of the values -->
    </xs:restriction>   
</xs:simpleType>
Example:

if the name of an OutputDataPoint class is &OUTPUTDATAPOINT; = "temperatureSeries", which contains a list of up to 10 temperature values, then a type definition could be

<xs:simpleType name="temperatureSeriesType">
    <xs:restriction>
        <xs:simpleType>
            <xs:list>
                <xs:simpleType>
                    <xs:restriction base="xs:float">
                    </xs:restriction>
                </xs:simpleType>
            </xs:list>
        </xs:simpleType>
        < xs:minInclusive value="−273.15"/>
        <xs:maxLength value="10"/>
    </xs:restriction>   
</xs:simpleType>
7.2.1.3.4 Structured Data Types

If class:Variable supports:

  • data property: isDataList value FALSE
  • object property: hasSubStructure with range class:&VARIABLENAME_1;
  • object property: hasSubStructure with range class:&VARIABLENAME_2;
  • ...
  • object property: hasSubStructure with range class:&VARIABLENAME_n;

then the XSD for the <flexContainer> that contains that customAttribute needs to contain the typedefinition (given by &TYPENAME;) for that customAttribute.
Additionally (simple or complex) typedefinitions for the Variables that are in the range of object property: hasSubStructure (given by &TYPENAME_1; ... &TYPENAME_n;) need to be contained in the XSD.

Table 7.2.1.3.4-1: Type definition for Structured Data Types

<!--********************** -->
<!-- Ontology based IWK Complex Types -->
<!--********************** -->

<xs:complexType name="&TYPENAME;">
    <xs:sequence>
        <!-- should include all classes:Variable that are in the range of object property:hasSubStructure  -->
        <xs:element name="&VARIABLENAME_1;"  type=" obi:&TYPENAME_1;"/>
        <!-- ... -->
        <xs:element name="&VARIABLENAME_n;"  type=" obi:&TYPENAME_n;"/>
    </xs:sequence>
</xs:complexType>

Example:

if the name of a OutputDataPoint class is &OUTPUTDATAPOINT; = "accurateTemperature" and that "accurateTemperature" is a StructuredTypeVariable, containing substructures with &VARIABLENAME_1; = "fahrenheit" and &VARIABLENAME_2; = "accuracy" then then a type definition could be

<xs:complexType name="accurateTemperatureType">
    <xs:sequence>
        <!-- should include all classes:Variable that are in the range of object property:hasSubStructure  -->
        <xs:element name="fahrenheit"  type="fahrenheitType"/>
        <!-- ... -->
        <xs:element name="accuracy"  type="accuracyType"/>
    </xs:sequence>
</xs:complexType>

7.2.2 XSD template for sub-classes of Base Ontology class: Device

This clause only applies for the case when an Interworked Device is represented as <flexContainer>. In case an Interworked Device is represented as <AE> the resource definition of the <AE> resource in oneM2M TS-0001 [2] applies.

Specific XSD definition for class:Device to be substituted at the placeholder in the XSD skeleton in clause 7.2.1.2

The value of attribute containerDefinition of the specialization of the <flexContainer> shall be set as specified in table 7.2.1.2-1.

Example: <xs:element name="containerDefinition" type="//m2m.service.com/IN-CSE-0001/bigFatCse/name_of_IPE_AE/ww.XYZ.com_WashingMachines /testDevice.xsd" />.

Table 7.2.2-1: Template definition of a <flexContainer> for Device

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
Copyright Notification

The oneM2M Partners authorize you to copy this document, provided that you retain all copyright and other proprietary notices 
contained in the original materials on any copies of the materials and that you comply strictly with these terms. 
This copyright permission does not constitute an endorsement of the products or services, nor does it encompass the granting of 
any patent rights. The oneM2M Partners assume no responsibility for errors or omissions in this document. 
© 2016, oneM2M Partners Type 1 (ARIB, ATIS, CCSA, ETSI, TIA, TSDSI, TTA, TTC). All rights reserved.

Notice of Disclaimer & Limitation of Liability 

The information provided in this document is directed solely to professionals who have the appropriate degree of experience to understand 
and interpret its contents in accordance with generally accepted engineering or other professional standards and applicable regulations. 
No recommendation as to products or vendors is made or should be implied. 

NO REPRESENTATION OR WARRANTY IS MADE THAT THE INFORMATION IS TECHNICALLY ACCURATE OR SUFFICIENT OR CONFORMS TO ANY STATUTE, 
GOVERNMENTAL RULE OR REGULATION, AND FURTHER, NO REPRESENTATION OR WARRANTY IS MADE OF MERCHANTABILITY OR FITNESS FOR ANY 
PARTICULAR PURPOSE OR AGAINST INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS. 
NO oneM2M PARTNER TYPE 1 SHALL BE LIABLE, BEYOND THE AMOUNT OF ANY SUM RECEIVED IN PAYMENT BY THAT PARTNER FOR THIS DOCUMENT, WITH RESPECT TO 
ANY CLAIM, AND IN NO EVENT SHALL oneM2M BE LIABLE FOR LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES. 
oneM2M EXPRESSLY ADVISES ANY AND ALL USE OF OR RELIANCE UPON THIS INFORMATION PROVIDED IN THIS DOCUMENT IS AT THE RISK OF THE USER.

-->

<!DOCTYPE placeholders [    <!--  ==== examples; see description in table 7.2.1.2-1 ====  --> 
<!ENTITY XSDSTORAGE     "ww.XYZ.com_WashingMachines">  <!-- Example targetNamespace value -->
<!ENTITY DEVICE             "testDevice">           <!-- Example name of the device defined in this file-->
<!ENTITY DEVICE_1              "device_1">          <!--  Example name of sub-device -->
<!ENTITY DEVICE_n              "device_n">          <!--  Example name of sub-device -->
<!ENTITY SERVICE_1        "service_1">          <!--  Example name of service of this device -->
<!ENTITY SERVICE_n        "service_n">          <!--  Example name of service of this device -->
<!ENTITY THINGPROPERTY_1      "tp_1">           <!--  Example name of thingProperty of this device -->
<!ENTITY THINGPROPERTY_n      "tp_n">           <!--  Example name of thingProperty of this device -->
<!ENTITY TYPENAME_1        "tp_1Type">          <!--  Example type name (of thingProperty) -->
<!ENTITY TYPENAME_2 "variablename_1Type">       <!--  Example type name (of sub-structure) -->
<!ENTITY TYPENAME_3 "variablename_3Type">       <!--  Example type name (of sub-structure) -->
<!ENTITY TYPENAME_n       " tp_nType ">         <!--  Example type name (of thingProperty) -->
<!ENTITY VARIABLENAME_1 "variablename_1">   <!--  Example variable name (of sub-structure) -->
<!ENTITY VARIABLENAME_n "variablename_n">   <!--  Example variable name (of sub-structure) -->
<!ENTITY SIMPLEDATATYPE "xs:integer">           <!--  Example simple datatype -->
<!ENTITY RESTRICTIONVALUE "100">                <!--  Example value of a type restriction -->        
]>
<xs:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="&XSDSTORAGE;"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:m2m="http://www.onem2m.org/xml/protocols" 
    xmlns:obi="&XSDSTORAGE;"
    elementFormDefault="unqualified" attributeFormDefault="unqualified">

    <xs:import namespace="http://www.onem2m.org/xml/protocols" schemaLocation="CDT-semanticDescriptor-v3_0_0.xsd"/>
    <xs:import namespace="http://www.onem2m.org/xml/protocols" schemaLocation="CDT-subscription-v3_0_0.xsd"/>

    <!-- include XSDs of child resources: (sub-)Devices and Services used in this Device -->
    <xs:include schemaLocation="&DEVICE_1;.xsd" />
    <!-- ... -->
    <xs:include schemaLocation="&DEVICE_n;.xsd" />´
    <xs:include schemaLocation="&SERVICE_1;.xsd" />
    <!-- ... -->
    <xs:include schemaLocation="&SERVICE_n;.xsd" />


    <xs:element name="&DEVICE;" substitutionGroup="m2m:sg_flexContainerResource">
        <xs:complexType>
            <xs:complexContent>
                <!-- Inherit Common Attributes from data type "flexContainerResource" -->
                <xs:extension base="m2m:flexContainerResource">
                    <xs:sequence>

                        <!-- Resource Specific Attributes -->

                 <!-- nodeLink as custom attribute -->
                        <xs:element name="nodeLink" type="xs:anyURI" minOccurs="0"/>                        
                        <!-- all OperationInput- and Outputs are listed here as custom attributes -->
                        <xs:element name="&THINGPROPERTY_1;" type=" obi:&TYPENAME_1;" minOccurs="0"/>
                        <!-- ... -->
                        <xs:element name="&THINGPROPERTY_n;" type=" obi:&TYPENAME_n;" minOccurs="0"/>


                        <!-- Child Resources -->

                        <xs:choice minOccurs="0" maxOccurs="1">
                            <xs:element name="childResource" type="m2m:childResourceRef" minOccurs="1" maxOccurs="unbounded"/>
                            <xs:choice minOccurs="1" maxOccurs="unbounded">

                                <!-- Device specific Child Resources (sub-Devices of the Device) -->
                                <xs:element ref=" obi:&DEVICE_1;"/>
                                <!-- ... -->
                                <xs:element ref=" obi:&DEVICE_n;"/>

                                <!-- Device specific Child Resources (Services of the Device) -->
                                <xs:element ref=" obi:&SERVICE_1;"/>
                                <!-- ... -->
                                <xs:element ref=" obi:&SERVICE_n;"/>

                                <!-- Common Child Resources -->
                                <xs:element ref="m2m:semanticDescriptor"/>
                                <xs:element ref="m2m:subscription"/>
                            </xs:choice>
                        </xs:choice>

                    </xs:sequence>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:element>


    <!-- types used for ThingProperties of this Device -->

    <!-- ********************** -->
    <!-- Ontology based IWK Simple Types -->
    <!-- ********************** -->

    <xs:simpleType name="&TYPENAME_1;">
        <xs:restriction base="&SIMPLEDATATYPE;"/>
    </xs:simpleType>

    <xs:simpleType name="&TYPENAME_2;">
        <xs:restriction base="&SIMPLEDATATYPE;">
            <!-- next lines for restrictions of the values. Remove not needed ones, Multiple restrictiontypes possible -->
            <xs:minInclusive value="&RESTRICTIONVALUE;"/>
            <!-- ... xs:minInclusive, xs:maxInclusive, xs:minExclusive, xs:maxExclusive, xs:length, xs:minLength, xs:maxLength, xs:pattern -->
            <xs:maxInclusive value="&RESTRICTIONVALUE;"/>
            <!-- end of lines only for restrictions of the values -->
        </xs:restriction>  
    </xs:simpleType>


    <!--********************** -->
    <!-- Ontology based IWK Simple Types (Lists)-->
    <!--********************** -->

    <xs:simpleType name="&TYPENAME_3;">
        <xs:restriction>
            <xs:simpleType>
                <xs:list>
                    <xs:simpleType>
                        <xs:restriction base="&SIMPLEDATATYPE;">
                        </xs:restriction>
                    </xs:simpleType>
                </xs:list>
            </xs:simpleType>
            <!-- next lines for restrictions of the values. Remove not needed ones, Multiple restrictiontypes possible -->
            <xs: xs:pattern value="&RESTRICTIONVALUE;"/>
            <!-- ... xs:minInclusive, xs:maxInclusive, xs:minExclusive, xs:maxExclusive, xs:length, xs:minLength, xs:maxLength, xs:pattern -->
            <xs:maxLength value="&RESTRICTIONVALUE;"/>
            <!-- end of lines only for restrictions of the values -->
        </xs:restriction>   
    </xs:simpleType>


    <!--********************** -->
    <!-- Ontology based IWK Complex Types -->
    <!--********************** -->

    <xs:complexType name="&TYPENAME_n;">
        <xs:sequence>
            <!-- should include all classes:Variable that are in the range of object property:hasSubStructure  -->
            <xs:element name="&VARIABLENAME_1;"  type=" obi:&TYPENAME_2;"/>
            <!-- ... -->
            <xs:element name="&VARIABLENAME_n;"  type=" obi:&TYPENAME_3;"/>
        </xs:sequence>
    </xs:complexType>

</xs:schema>

7.2.3 XSD template for sub-classes of Base Ontology class: Service

Specific XSD definition for class:Service to be substituted at the placeholder in the XSD skeleton in clause 7.2.1.2.

The value of attribute containerDefinition of the specialization of the <flexContainer> shall be set as specified in table 7.2.1.2-1.

Example: <xs:element name="containerDefinition" type="//m2m.service.com/IN-CSE-0001/bigFatCse/name_of_IPE_AE/ww.XYZ.com_WashingMachines /testService.xsd" />.

Table 7.2.3-1: Template definition of a <flexContainer> for Service

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
Copyright Notification

The oneM2M Partners authorize you to copy this document, provided that you retain all copyright and other proprietary notices 
contained in the original materials on any copies of the materials and that you comply strictly with these terms. 
This copyright permission does not constitute an endorsement of the products or services, nor does it encompass the granting of 
any patent rights. The oneM2M Partners assume no responsibility for errors or omissions in this document. 
© 2016, oneM2M Partners Type 1 (ARIB, ATIS, CCSA, ETSI, TIA, TSDSI, TTA, TTC). All rights reserved.

Notice of Disclaimer & Limitation of Liability 

The information provided in this document is directed solely to professionals who have the appropriate degree of experience to understand 
and interpret its contents in accordance with generally accepted engineering or other professional standards and applicable regulations. 
No recommendation as to products or vendors is made or should be implied. 

NO REPRESENTATION OR WARRANTY IS MADE THAT THE INFORMATION IS TECHNICALLY ACCURATE OR SUFFICIENT OR CONFORMS TO ANY STATUTE, 
GOVERNMENTAL RULE OR REGULATION, AND FURTHER, NO REPRESENTATION OR WARRANTY IS MADE OF MERCHANTABILITY OR FITNESS FOR ANY 
PARTICULAR PURPOSE OR AGAINST INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS. 
NO oneM2M PARTNER TYPE 1 SHALL BE LIABLE, BEYOND THE AMOUNT OF ANY SUM RECEIVED IN PAYMENT BY THAT PARTNER FOR THIS DOCUMENT, WITH RESPECT TO 
ANY CLAIM, AND IN NO EVENT SHALL oneM2M BE LIABLE FOR LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES. 
oneM2M EXPRESSLY ADVISES ANY AND ALL USE OF OR RELIANCE UPON THIS INFORMATION PROVIDED IN THIS DOCUMENT IS AT THE RISK OF THE USER.

-->

<!DOCTYPE placeholders [    <!--  ==== examples; see description in table 7.2.1.2-1 ====  --> 
<!ENTITY XSDSTORAGE     "ww.XYZ.com_WashingMachines">  <!-- Example targetNamespace value -->
<!ENTITY SERVICE            "testService">          <!-- Example name of the service defined in this file-->
<!ENTITY OPERATION_1    "operation_1">          <!--  Example name of operation -->
<!ENTITY OPERATION_n    "operation_n">          <!--  Example name of operation -->
<!ENTITY INPUTDATAPOINT_1      "idp_1">         <!--  Example name of inputDataPoint of this service -->
<!ENTITY INPUTDATAPOINT_n      "idp_n">         <!--  Example name of inputDataPoint of this service -->
<!ENTITY OUTPUTDATAPOINT_1   "odp_1">       <!--  Example name of outputDataPoint of this service -->
<!ENTITY OUTPUTDATAPOINT_n   "odp_n">       <!--  Example name of outputDataPoint of this service -->
<!ENTITY TYPENAME_1        "idp_1Type">         <!--  Example type name (of DataPoint) -->
<!ENTITY TYPENAME_2 "variablename_1Type">       <!--  Example type name (of sub-structure) -->
<!ENTITY TYPENAME_3 "variablename_3Type">       <!--  Example type name (of sub-structure) -->
<!ENTITY TYPENAME_n       " odp_nType ">            <!--  Example type name (of DataPoint) -->
<!ENTITY VARIABLENAME_1 "variablename_1">   <!--  Example variable name (of sub-structure) -->
<!ENTITY VARIABLENAME_n "variablename_n">   <!--  Example variable name (of sub-structure) -->
<!ENTITY SIMPLEDATATYPE "xs:integer">           <!--  Example simple datatype -->
<!ENTITY RESTRICTIONVALUE "100">                <!--  Example value of a type restriction -->        
]>
<xs:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="&XSDSTORAGE;"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:m2m="http://www.onem2m.org/xml/protocols" 
    xmlns:obi="&XSDSTORAGE;"
    elementFormDefault="unqualified" attributeFormDefault="unqualified">

    <xs:import namespace="http://www.onem2m.org/xml/protocols" schemaLocation="CDT-semanticDescriptor-v3_0_0.xsd"/>
    <xs:import namespace="http://www.onem2m.org/xml/protocols" schemaLocation="CDT-subscription-v3_0_0.xsd"/>

    <!-- include XSDs of child resources: Operations used in this Service -->
    <xs:include schemaLocation="&OPERATION_1;.xsd" />
    <!-- ... -->
    <xs:include schemaLocation="&OPERATION_n;.xsd" />


    <xs:element name="&SERVICE;" substitutionGroup="m2m:sg_flexContainerResource">
        <xs:complexType>
            <xs:complexContent>
                <!-- Inherit Common Attributes from data type "flexContainerResource" -->
                <xs:extension base="m2m:flexContainerResource">
                    <xs:sequence>

                        <!-- Resource Specific Attributes -->

                        <!-- all Input- and OutputDatapoints are listed here as custom attributes -->
                        <xs:element name="&INPUTDATAPOINT_1;" type=" obi:&TYPENAME_1;" minOccurs="0"/>
                        <xs:element name="&OUTPUTDATAPOINT_1;" type=" obi:&TYPENAME_1;" minOccurs="0"/>
                        <!-- ... -->
                        <xs:element name="&INPUTDATAPOINT_n;" type=" obi:&TYPENAME_n;" minOccurs="0"/>
                        <xs:element name="&OUTPUTDATAPOINT_n;" type=" obi:&TYPENAME_n;" minOccurs="0"/>


                        <!-- Child Resources -->

                        <xs:choice minOccurs="0" maxOccurs="1">
                            <xs:element name="childResource" type="m2m:childResourceRef" minOccurs="1" maxOccurs="unbounded"/>
                            <xs:choice minOccurs="1" maxOccurs="unbounded">

                                <!-- Service specific Child Resources (Operations of the Service) -->
                                <xs:element ref=" obi:&OPERATION_1;"/>
                                <!-- ... -->
                                <xs:element ref=" obi:&OPERATION_n;"/>

                                <!-- Common Child Resources -->
                                <xs:element ref="m2m:semanticDescriptor"/>
                                <xs:element ref="m2m:subscription"/>
                            </xs:choice>
                        </xs:choice>

                    </xs:sequence>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:element>


<!-- types used for Datapoints of this Service -->

    <!-- ********************** -->
    <!-- Ontology based IWK Simple Types -->
    <!-- ********************** -->

    <xs:simpleType name="&TYPENAME_1;">
        <xs:restriction base="&SIMPLEDATATYPE;"/>
    </xs:simpleType>

    <xs:simpleType name="&TYPENAME_2;">
        <xs:restriction base="&SIMPLEDATATYPE;">
            <!-- next lines for restrictions of the values. Remove not needed ones, Multiple restrictiontypes possible -->
            <xs:minInclusive value="&RESTRICTIONVALUE;"/>
            <!-- ... xs:minInclusive, xs:maxInclusive, xs:minExclusive, xs:maxExclusive, xs:length, xs:minLength, xs:maxLength, xs:pattern -->
            <xs:maxInclusive value="&RESTRICTIONVALUE;"/>
            <!-- end of lines only for restrictions of the values -->
        </xs:restriction>  
    </xs:simpleType>


    <!--********************** -->
    <!-- Ontology based IWK Simple Types (Lists)-->
    <!--********************** -->

    <xs:simpleType name="&TYPENAME_3;">
        <xs:restriction>
            <xs:simpleType>
                <xs:list>
                    <xs:simpleType>
                        <xs:restriction base="&SIMPLEDATATYPE;">
                        </xs:restriction>
                    </xs:simpleType>
                </xs:list>
            </xs:simpleType>
            <!-- next lines for restrictions of the values. Remove not needed ones, Multiple restrictiontypes possible -->
            <xs:pattern value="&RESTRICTIONVALUE;"/>
            <!-- ... xs:minInclusive, xs:maxInclusive, xs:minExclusive, xs:maxExclusive, xs:length, xs:minLength, xs:maxLength, xs:pattern -->
            <xs:maxLength value="&RESTRICTIONVALUE;"/>
            <!-- end of lines only for restrictions of the values -->
        </xs:restriction>   
    </xs:simpleType>


    <!--********************** -->
    <!-- Ontology based IWK Complex Types -->
    <!--********************** -->

    <xs:complexType name="&TYPENAME_n;">
        <xs:sequence>
            <!-- should include all classes:Variable that are in the range of object property:hasSubStructure  -->
            <xs:element name="&VARIABLENAME_1;"  type=" obi:&TYPENAME_2;"/>
            <!-- ... -->
            <xs:element name="&VARIABLENAME_n;"  type=" obi:&TYPENAME_3;"/>
        </xs:sequence>
    </xs:complexType>

</xs:schema>

7.2.4 XSD template for sub-classes of Base Ontology class: Operation

Specific XSD definition for class:Operation to be substituted at the placeholder in the XSD skeleton in clause 7.2.1.2.

The value of attribute containerDefinition of the specialization of the <flexContainer> shall be set as specified in table 7.2.1.2-1.

Example: <xs:element name="containerDefinition" type="//m2m.service.com/IN-CSE-0001/bigFatCse/name_of_IPE_AE/ww.XYZ.com_WashingMachines /testOperation.xsd" />.

Table 7.2.4-1: Template definition of a <flexContainer> for Operation

<?xml version="1.0" encoding="UTF-8"?>
<!-- 
Copyright Notification

The oneM2M Partners authorize you to copy this document, provided that you retain all copyright and other proprietary notices 
contained in the original materials on any copies of the materials and that you comply strictly with these terms. 
This copyright permission does not constitute an endorsement of the products or services, nor does it encompass the granting of 
any patent rights. The oneM2M Partners assume no responsibility for errors or omissions in this document. 
© 2016, oneM2M Partners Type 1 (ARIB, ATIS, CCSA, ETSI, TIA, TSDSI, TTA, TTC). All rights reserved.

Notice of Disclaimer & Limitation of Liability 

The information provided in this document is directed solely to professionals who have the appropriate degree of experience to understand 
and interpret its contents in accordance with generally accepted engineering or other professional standards and applicable regulations. 
No recommendation as to products or vendors is made or should be implied. 

NO REPRESENTATION OR WARRANTY IS MADE THAT THE INFORMATION IS TECHNICALLY ACCURATE OR SUFFICIENT OR CONFORMS TO ANY STATUTE, 
GOVERNMENTAL RULE OR REGULATION, AND FURTHER, NO REPRESENTATION OR WARRANTY IS MADE OF MERCHANTABILITY OR FITNESS FOR ANY 
PARTICULAR PURPOSE OR AGAINST INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS. 
NO oneM2M PARTNER TYPE 1 SHALL BE LIABLE, BEYOND THE AMOUNT OF ANY SUM RECEIVED IN PAYMENT BY THAT PARTNER FOR THIS DOCUMENT, WITH RESPECT TO 
ANY CLAIM, AND IN NO EVENT SHALL oneM2M BE LIABLE FOR LOST PROFITS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES. 
oneM2M EXPRESSLY ADVISES ANY AND ALL USE OF OR RELIANCE UPON THIS INFORMATION PROVIDED IN THIS DOCUMENT IS AT THE RISK OF THE USER.

-->

<!DOCTYPE placeholders [    <!--  ==== examples; see description in table 7.2.1.2-1 ====  --> 
<!ENTITY XSDSTORAGE     "ww.XYZ.com_WashingMachines">  <!-- Example targetNamespace value -->
<!ENTITY OPERATION      "testOperation">            <!--  Example name of operation defined in this file -->
<!ENTITY OPERATIONINPUT_1    "oip_1">           <!--  Example name of operationInput of this service -->
<!ENTITY OPERATIONINPUT_n    "oip_n">           <!--  Example name of operationInput of this service -->
<!ENTITY OPERATIONOUTPUT_1 "oop_1">         <!--  Example name of operationOutput of this service -->
<!ENTITY OPERATIONOUTPUT_n "oop_n">         <!--  Example name of operationOutput of this service -->
<!ENTITY TYPENAME_1        "oip_1Type">         <!--  Example type name (of operationInput) -->
<!ENTITY TYPENAME_2 "variablename_1Type">       <!--  Example type name (of sub-structure) -->
<!ENTITY TYPENAME_3 "variablename_3Type">       <!--  Example type name (of sub-structure) -->
<!ENTITY TYPENAME_n       " oop_nType ">            <!--  Example type name (of operationOutput) -->
<!ENTITY VARIABLENAME_1 "variablename_1">   <!--  Example variable name (of sub-structure) -->
<!ENTITY VARIABLENAME_n "variablename_n">   <!--  Example variable name (of sub-structure) -->
<!ENTITY SIMPLEDATATYPE "xs:integer">           <!--  Example simple datatype -->
<!ENTITY RESTRICTIONVALUE "100">                <!--  Example value of a type restriction -->        
]>

<xs:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="&XSDSTORAGE;"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:m2m="http://www.onem2m.org/xml/protocols" 
    xmlns:obi="&XSDSTORAGE;"
    elementFormDefault="unqualified" attributeFormDefault="unqualified">

    <xs:import namespace="http://www.onem2m.org/xml/protocols" schemaLocation="CDT-semanticDescriptor-v3_0_0.xsd"/>
    <xs:import namespace="http://www.onem2m.org/xml/protocols" schemaLocation="CDT-subscription-v3_0_0.xsd"/>

    <!--  for operations no includes needed from obi: namespace -->

    <xs:element name="&OPERATION;" substitutionGroup="m2m:sg_flexContainerResource">
        <xs:complexType>
            <xs:complexContent>
                <!-- Inherit Common Attributes from data type "flexContainerResource" -->
                <xs:extension base="m2m:flexContainerResource">
                    <xs:sequence>

                        <!-- Resource Specific Attributes for operations-->

                        <!-- all OperationInput- and Outputs are listed here as custom attributes -->
                        <xs:element name="&OPERATIONINPUT_1;" type=" obi:&TYPENAME_1;" minOccurs="0"/>
                        <xs:element name="&OPERATIONOUTPUT_1;" type=" obi:&TYPENAME_n;" minOccurs="0"/>
                        <!-- ... -->
                        <xs:element name="&OPERATIONINPUT_n;" type=" obi:&TYPENAME_1;" minOccurs="0"/>
                        <xs:element name="&OPERATIONOUTPUT_n;" type=" obi:&TYPENAME_n;" minOccurs="0"/>


                        <!-- Child Resources -->

                        <xs:choice minOccurs="0" maxOccurs="1">
                            <xs:element name="childResource" type="m2m:childResourceRef" minOccurs="1" maxOccurs="unbounded"/>
                            <xs:choice minOccurs="1" maxOccurs="unbounded">

                                <!-- Child Resource for Operations that have OperationOutputs is an Operation of the same type -->
                                <xs:element ref="&OPERATION;"/>

                                <!-- Common Child Resources -->
                                <xs:element ref="m2m:semanticDescriptor"/>
                                <xs:element ref="m2m:subscription"/>
                            </xs:choice>
                        </xs:choice>

                    </xs:sequence>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:element>


    <!-- types used for OperationInputs and -Outputs of this Operation -->

    <!-- ********************** -->
    <!-- Ontology based IWK Simple Types -->
    <!-- ********************** -->

    <xs:simpleType name="&TYPENAME_1;">
        <xs:restriction base="&SIMPLEDATATYPE;"/>
    </xs:simpleType>

    <xs:simpleType name="&TYPENAME_2;">
        <xs:restriction base="&SIMPLEDATATYPE;">
            <!-- next lines for restrictions of the values. Remove not needed ones, Multiple restriction types possible -->
            <xs:minInclusive value="&RESTRICTIONVALUE;"/>
            <!-- ... xs:minInclusive, xs:maxInclusive, xs:minExclusive, xs:maxExclusive, xs:length, xs:minLength, xs:maxLength, xs:pattern -->
            <xs:maxInclusive value="&RESTRICTIONVALUE;"/>
            <!-- end of lines only for restrictions of the values -->
        </xs:restriction>  
    </xs:simpleType>


    <!--********************** -->
    <!-- Ontology based IWK Simple Types (Lists)-->
    <!--********************** -->

    <xs:simpleType name="&TYPENAME_3;">
        <xs:restriction>
            <xs:simpleType>
                <xs:list>
                    <xs:simpleType>
                        <xs:restriction base="&SIMPLEDATATYPE;">
                        </xs:restriction>
                    </xs:simpleType>
                </xs:list>
            </xs:simpleType>
            <!-- next lines for restrictions of the values. Remove not needed ones, Multiple restrictiontypes possible -->
            <xs:pattern value="&RESTRICTIONVALUE;"/>
            <!-- ... xs:minInclusive, xs:maxInclusive, xs:minExclusive, xs:maxExclusive, xs:length, xs:minLength, xs:maxLength, xs:pattern -->
            <xs:maxLength value="&RESTRICTIONVALUE;"/>
            <!-- end of lines only for restrictions of the values -->
        </xs:restriction>   
    </xs:simpleType>


    <!--********************** -->
    <!-- Ontology based IWK Complex Types -->
    <!--********************** -->

    <xs:complexType name="&TYPENAME_n;">
        <xs:sequence>
            <!-- should include all classes:Variable that are in the range of object property:hasSubStructure  -->
            <xs:element name="&VARIABLENAME_1;"  type=" obi:&TYPENAME_2;"/>
            <!-- ... -->
            <xs:element name="&VARIABLENAME_n;"  type=" obi:&TYPENAME_3;"/>
        </xs:sequence>
    </xs:complexType>

</xs:schema>
## Annex A (informative): Example for Ontology-based Interworking