domain.xsd 9.22 KB
<?xml version="1.0" encoding="UTF-8"?>
<!--
  - domain.rng
  -
  - Version 3.0
  -
  - This work is released by the Smarthome Task Force of the HGI (Home
  - Gateway Initative), October 2015.
  - The work is created and released under the Apache License Version 2.0 .
  - See the license text at http://www.apache.org/licenses/LICENSE-2.0 for
  - full details.
-->
<xs:schema targetNamespace="http://homegatewayinitiative.org/xml/dal/3.0" 
	   xmlns="http://homegatewayinitiative.org/xml/dal/3.0" 
	   xmlns:xs="http://www.w3.org/2001/XMLSchema" 
	  
 elementFormDefault="qualified">
  <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
  <xs:element name="Domain">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="DocDef"/>
        <xs:element minOccurs="0" ref="Imports"/>
        <xs:element minOccurs="0" name="Modules">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" ref="ModuleClass"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element minOccurs="0" ref="Devices"/>
      </xs:sequence>
      <xs:attribute ref="xml:base"/>
      <xs:attribute name="id" use="required" type="xs:ID"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Imports">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="Domain"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="ModuleClass" type="ModuleDef"/>
  <xs:element name="Devices">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="Device"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Device">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="DocDef"/>
        <xs:element minOccurs="0" ref="Properties"/>
        <xs:element minOccurs="0" ref="Modules"/>
        <xs:element minOccurs="0" ref="SubDevices"/>
      </xs:sequence>
      <xs:attribute name="id" use="required" type="xs:Name"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="SubDevices">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="SubDevice"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="SubDevice">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="DocDef"/>
        <xs:element minOccurs="0" ref="Properties"/>
        <xs:element minOccurs="0" ref="Modules"/>
      </xs:sequence>
      <xs:attribute name="id" use="required" type="xs:Name"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Properties">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="Property"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Property">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="DocDef"/>
        <xs:element ref="SimpleType"/>
      </xs:sequence>
      <xs:attribute name="name" use="required"/>
      <xs:attribute name="optional" type="xs:boolean"/>
      <xs:attribute name="value"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="DataType">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="DocDef"/>
        <xs:choice>
          <xs:element ref="Struct"/>
          <xs:element ref="Array"/>
          <xs:element ref="SimpleType"/>
        </xs:choice>
        <xs:element minOccurs="0" ref="Constraints"/>
      </xs:sequence>
      <xs:attribute name="name"/>
      <xs:attribute name="unitOfMeasure"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Struct">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="DataType"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Array">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="DataType"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="SimpleType">
    <xs:complexType>
      <xs:attribute name="type" use="required" type="BasicType"/>
    </xs:complexType>
  </xs:element>
  <xs:simpleType name="BasicType">
    <xs:restriction base="xs:token">
      <xs:enumeration value="integer"/>
      <xs:enumeration value="boolean"/>
      <xs:enumeration value="string"/>
      <xs:enumeration value="byte"/>
      <xs:enumeration value="float"/>
      <xs:enumeration value="array"/>
      <xs:enumeration value="enum"/>
      <xs:enumeration value="date"/>
      <xs:enumeration value="time"/>
      <xs:enumeration value="datetime"/>
      <xs:enumeration value="blob"/>
      <xs:enumeration value="uri"/>
    </xs:restriction>
  </xs:simpleType>
  <xs:element name="Constraints">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="Constraint"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Constraint">
    <xs:complexType>
      <xs:group ref="DocDef"/>
      <xs:attribute name="name" use="required"/>
      <xs:attribute name="type" type="BasicType"/>
      <xs:attribute name="value"/>
    </xs:complexType>
  </xs:element>
  <xs:group name="DocText">
    <xs:sequence>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="em"/>
        <xs:element ref="b"/>
        <xs:element ref="tt"/>
      </xs:choice>
    </xs:sequence>
  </xs:group>
  <xs:element name="em" type="xs:string"/>
  <xs:element name="b" type="xs:string"/>
  <xs:element name="tt" type="xs:string"/>
  <!-- <Doc> element is always optional -->
  <xs:group name="DocDef">
    <xs:sequence>
      <xs:element minOccurs="0" ref="Doc"/>
    </xs:sequence>
  </xs:group>
  <xs:element name="Doc">
    <xs:complexType mixed="true">
      <xs:choice>
        <xs:group ref="DocText"/>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element ref="p"/>
          <xs:element ref="img"/>
        </xs:choice>
      </xs:choice>
    </xs:complexType>
  </xs:element>
  <xs:element name="p">
    <xs:complexType mixed="true">
      <xs:group ref="DocText"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="img">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="caption"/>
      </xs:sequence>
      <xs:attribute name="src" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="caption" type="xs:string"/>
  <xs:complexType name="ModuleDef">
    <xs:sequence>
      <xs:element minOccurs="0" ref="extends"/>
      <xs:group ref="DocDef"/>
      <xs:element minOccurs="0" ref="Properties"/>
      <xs:element minOccurs="0" ref="Actions"/>
      <xs:element minOccurs="0" ref="Data"/>
      <xs:element minOccurs="0" ref="Events"/>
    </xs:sequence>
    <xs:attribute name="name" use="required"/>
    <xs:attribute name="optional" type="xs:boolean"/>
  </xs:complexType>
  <xs:element name="extends">
    <xs:complexType>
      <xs:attribute name="domain" use="required" type="xs:IDREF"/>
      <xs:attribute name="class" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Modules">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="Module"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Module" type="ModuleDef"/>
  <xs:element name="Actions">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="Action"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Action">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="DocDef"/>
        <xs:element minOccurs="0" ref="DataType"/>
        <xs:element minOccurs="0" ref="Args"/>
      </xs:sequence>
      <xs:attribute name="name" use="required"/>
      <xs:attribute name="optional" type="xs:boolean"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Args">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="Arg"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Arg">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="DocDef"/>
        <xs:element ref="DataType"/>
      </xs:sequence>
      <xs:attribute name="name" use="required"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Data">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="DataPoint"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="DataPoint">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="DocDef"/>
        <xs:element ref="DataType"/>
      </xs:sequence>
      <xs:attribute name="name" use="required"/>
      <xs:attribute name="optional" type="xs:boolean"/>
      <xs:attribute name="writable" type="xs:boolean"/>
      <xs:attribute name="readable" type="xs:boolean"/>
      <xs:attribute name="eventable" type="xs:boolean"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="Events">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="Event"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="Event">
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="DocDef"/>
        <xs:element minOccurs="0" ref="Data"/>
      </xs:sequence>
      <xs:attribute name="name" use="required"/>
      <xs:attribute name="optional" type="xs:boolean"/>
    </xs:complexType>
  </xs:element>
</xs:schema>