Open Messaging Interface (O-MI), an Open Group Internet of Things (IoT) Standard – O-MI XSD Schema(Normative)

 

<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="omi.xsd" targetNamespace="omi.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified" id="omi">     <xs:element name="omiEnvelope">         <xs:annotation>             <xs:documentation>Root element of Open Messaging Interface.</xs:documentation>         </xs:annotation>         <xs:complexType>             <xs:sequence>                 <xs:choice>                     <xs:element name="read" type="readRequest"/>                     <xs:element name="write" type="writeRequest"/>                     <xs:element name="response" type="responseListType"/>                     <xs:element name="cancel" type="cancelRequest"/>                 </xs:choice>             </xs:sequence>             <xs:attribute name="version" use="required">                 <xs:annotation>                     <xs:documentation>Open messaging interface schema version that the message complies with.</xs:documentation>                 </xs:annotation>                 <xs:simpleType>                     <xs:restriction base="xs:string"/>                 </xs:simpleType>             </xs:attribute>             <xs:attribute name="ttl" use="required">                 <xs:annotation>                     <xs:documentation>Time-to-live in seconds. "-1" signifies "forever"</xs:documentation>                 </xs:annotation>                 <xs:simpleType>                     <xs:restriction base="xs:double">                         <xs:minInclusive value="-1"/>                     </xs:restriction>                 </xs:simpleType>             </xs:attribute>         </xs:complexType>     </xs:element>     <xs:element name="msg"/>     <xs:complexType name="requestBaseType">         <xs:annotation>             <xs:documentation>Base type for "read" and "write" requests.</xs:documentation>         </xs:annotation>         <xs:sequence>             <xs:element name="nodeList" type="nodesType" minOccurs="0"/>             <xs:element name="requestID" minOccurs="0"maxOccurs="unbounded">                 <xs:annotation>                     <xs:documentation>"requestID" is only included when "polling" for data that corresponds to an earlier subscription that returned the corresponding Id.</xs:documentation>                 </xs:annotation>             </xs:element>             <xs:element ref="msg" minOccurs="0"/>         </xs:sequence>         <xs:attribute name="callback" type="xs:anyURI" use="optional"/>         <xs:attribute name="msgformat" type="schemaID" use="optional">             <xs:annotation>                 <xs:documentation>Text string indicating the format of the payload in "msg", e.g. "csv", "obix" or similar. For an XML schema, this should correspond to the value of the schema’s “id” attribute, if present.</xs:documentation>             </xs:annotation>         </xs:attribute>         <xs:attribute name="targetType" use="optional" default="node">             <xs:annotation>                 <xs:documentation>Currently "node" or "device". Using "device" indicates that if the message "target object" is some kind of device connected to a node, then try to get the requested value from the "device".</xs:documentation>             </xs:annotation>             <xs:simpleType>                 <xs:restriction base="xs:string">                     <xs:enumeration value="device"/>                     <xs:enumeration value="node"/>                 </xs:restriction>             </xs:simpleType>         </xs:attribute>         <!-- URI of callback O-MI node where responses should be sent. -->     </xs:complexType>     <xs:complexType name="readRequest">         <xs:annotation>             <xs:documentation>Read request type.</xs:documentation>         </xs:annotation>         <xs:complexContent>             <xs:extension base="requestBaseType">                 <xs:attribute name="interval" use="optional">                     <xs:annotation>                         <xs:documentation>If an "interval" attibute is included, it indicates that this is a subscription request that uses the given interval. Values 0, -1 and -2 have special significations.</xs:documentation>                     </xs:annotation>                     <xs:simpleType>                         <xs:restriction base="xs:double">                             <xs:minInclusive value="-2"/>                         </xs:restriction>                     </xs:simpleType>                 </xs:attribute>                 <xs:attribute name="oldest" use="optional">                     <xs:annotation>                         <xs:documentation>Retrieve the oldest available number of historical data available.</xs:documentation>                     </xs:annotation>                     <xs:simpleType>                         <xs:restriction base="xs:int">                             <xs:minInclusive value="1"/>                         </xs:restriction>                     </xs:simpleType>                 </xs:attribute>                 <xs:attribute name="begin" type="xs:dateTime" use="optional">                     <xs:annotation>                         <xs:documentation>Retrieve data from this begin date.</xs:documentation>                     </xs:annotation>                 </xs:attribute>                 <xs:attribute name="end" type="xs:dateTime" use="optional">                     <xs:annotation>                         <xs:documentation>Retrieve data until this end date.</xs:documentation>                     </xs:annotation>                 </xs:attribute>                 <xs:attribute name="newest" use="optional">                     <xs:annotation>                         <xs:documentation>Retrieve the newest available number of historical data available</xs:documentation>                     </xs:annotation>                     <xs:simpleType>                         <xs:restriction base="xs:int">                             <xs:minInclusive value="1"/>                         </xs:restriction>                     </xs:simpleType>                 </xs:attribute>             </xs:extension>         </xs:complexContent>     </xs:complexType>     <xs:simpleType name="schemaID">         <xs:annotation>             <xs:documentation>Some "predefined" identifier for the format/semantics of "value", e.g. "csv", "obix.xsd".</xs:documentation>         </xs:annotation>         <xs:restriction base="xs:string"/>     </xs:simpleType>     <xs:complexType name="writeRequest">         <xs:annotation>             <xs:documentation>Write request type.</xs:documentation>         </xs:annotation>         <xs:complexContent>             <xs:extension base="requestBaseType"/>         </xs:complexContent>     </xs:complexType>     <xs:complexType name="responseListType">         <xs:annotation>             <xs:documentation>List of results.</xs:documentation>         </xs:annotation>         <xs:sequence>             <xs:element name="result" type="requestResultType" maxOccurs="unbounded"/>         </xs:sequence>     </xs:complexType>     <xs:complexType name="requestResultType">         <xs:annotation>             <xs:documentation>Result of a request.</xs:documentation>         </xs:annotation>         <xs:sequence>             <xs:element name="return" type="returnType" minOccurs="1"/>             <!-- Indicates success/failure of request. -->             <xs:element name="requestID" type="idType" minOccurs="0"/>             <!-- not needed if this is a response to a "immediate"/"non-callback" request, i.e. just status reply with "return" or reponse with "value".-->             <xs:element ref="msg" minOccurs="0"/>             <!-- response value. Completely free-format. Present if successful. -->             <xs:element name="nodeList" type="nodesType" minOccurs="0"/>             <!-- may be used to indicate from what node(s) the result comes.  -->             <xs:element ref="omiEnvelope" minOccurs="0">                 <xs:annotation>                     <xs:documentation>Present if the sender wants to submit a new request to the receiver. This is useful for engaging direct dialogs" while the connection is alive. It is also especially useful for communicating with firewall/NAT-protected nodes.</xs:documentation>                 </xs:annotation>             </xs:element>         </xs:sequence>         <xs:attribute name="msgformat" type="schemaID" use="optional">             <xs:annotation>                 <xs:documentation>Text string indicating the format of the payload in "msg", e.g. "csv", "obix" or similar.</xs:documentation>             </xs:annotation>         </xs:attribute>         <xs:attribute name="targetType" use="optional" default="node">             <xs:annotation>                 <xs:documentation>Currently "node" or "device". Value "device" indicates that the response comes directly from the "target object". Value "node" is intended to be used for indicating that even though the initial request was for "device", the returned value is the last known one by this node due to the unavailability of the "device" online.</xs:documentation>             </xs:annotation>             <xs:simpleType>                 <xs:restriction base="xs:string">                     <xs:enumeration value="device"/>                     <xs:enumeration value="node"/>                 </xs:restriction>             </xs:simpleType>         </xs:attribute>     </xs:complexType>     <xs:complexType name="returnType">         <xs:annotation>             <xs:documentation>Return status of request. Use HTTP codes / descriptions when applicable.</xs:documentation>         </xs:annotation>         <xs:simpleContent>             <xs:extension base="xs:string">                 <xs:attribute name="returnCode" use="required">                     <xs:annotation>                         <xs:documentation>Use HTTP codes when applicable.</xs:documentation>                     </xs:annotation>                     <xs:simpleType>                         <xs:restriction base="xs:token">                             <xs:pattern value="2[0-9]{2}|4[0-9]{2}|5[0-9]{2}|6[0-9]{2}"/>                         </xs:restriction>                     </xs:simpleType>                 </xs:attribute>                 <xs:attribute name="description" type="xs:string" use="optional"/>                 <xs:anyAttribute/>             </xs:extension>         </xs:simpleContent>     </xs:complexType>     <xs:complexType name="nodesType">         <xs:annotation>             <xs:documentation>The nodesType is used anywhere in the schema where lists of nodes can appear. </xs:documentation>         </xs:annotation>         <xs:sequence>             <xs:element name="node" type="xs:anyURI" minOccurs="1" maxOccurs="unbounded">                 <xs:annotation>                     <xs:documentation>Defines the URL/URI of an O-MI node. The node may be located using other means than this URL field, like discovery and routing functionality.</xs:documentation>                 </xs:annotation>             </xs:element>         </xs:sequence>         <xs:attribute name="type" type="xs:string" use="optional">             <xs:annotation>                 <xs:documentation>String indicating what format is being used for "node" addresses. By default a URL. </xs:documentation>             </xs:annotation>         </xs:attribute>     </xs:complexType>     <xs:complexType name="idType">         <xs:annotation>             <xs:documentation>Some kind of identifier with optional "format" attribute for indicating what kind of identifier is used. </xs:documentation>         </xs:annotation>         <xs:simpleContent>             <xs:extension base="xs:string">                 <xs:attribute name="format" type="xs:string" use="optional">                     <xs:annotation>                         <xs:documentation>Use for indicating what kind of identifier.</xs:documentation>                     </xs:annotation>                 </xs:attribute>             </xs:extension>         </xs:simpleContent>     </xs:complexType>     <xs:complexType name="cancelRequest">         <xs:annotation>             <xs:documentation>Cancel request type.</xs:documentation>         </xs:annotation>         <xs:sequence>             <xs:element name="nodeList" type="nodesType" minOccurs="0"/>             <xs:element name="requestID" type="idType" maxOccurs="unbounded"/>         </xs:sequence>     </xs:complexType> </xs:schema>