diff --git a/SDT/schema4.0/docs/SDT_Components.md b/SDT/schema4.0/docs/SDT_Components.md index 411ac6be7f4c846a935ed0674f50f61618ff5bb5..b04b3f5a599dbb4b97adecf6e3e89981f96e63de 100644 --- a/SDT/schema4.0/docs/SDT_Components.md +++ b/SDT/schema4.0/docs/SDT_Components.md @@ -396,12 +396,13 @@ A *ProductClass* can be defined by implementing the functionalities of an existi All elements of [DeviceClass](#DeviceClass) can be reused in *ProductClass*, but the *optional* attribute of those elements is not applicable (ignored if present). - **[Doc](#Documentation)** : Documentation for the *ProductClass*. Optional. +- **[Extend](#Extending)** : Extension of a parent *ProductClass* from which this *ProductClass* is extended. Optional. - **[Properties](#Property)** : Further meta-data (or properties) about the *ProductClass*. Optional. - **[ModuleClasses](#ModuleClass)** : A list of *ModuleClass* components that are local to the *ProductClass*. Optional. - **[SubDevices](#SubDevice)** : A list of *SubDevice* components. Optional. -- **[DeviceClass](#DeviceClass)** : Reference to a *DeviceClass* which is implemented by this *ProductClass*. Optional. -- **Extends** : Reference to a parent *ProductClass* from which this *ProductClass* is extended. Optional. -**Note**: New extended *Properties* and *ModuleClasses* **shall** have different names from those in the implemented *DeviceClass* if they're defined in the same *Domain*. Also, when extending a *ProductClass* that has a [DeviceClass](#DeviceClass) defined (or in any other parent in the inheritance hierarchy) then the child *ProductClass* **must not** define another [DeviceClass](#DeviceClass). +- **ExtendDevice** : Extension of a [DeviceClass](#DeviceClass) which is implemented by this *ProductClass*. Optional. + +**Note**: New extended *Properties* and *ModuleClasses* **shall** have different names from those in the extended *DeviceClass* if they're defined in the same *Domain*. Also, when extending a *ProductClass* that has a [DeviceClass](#DeviceClass) extended (or in any other parent in the inheritance hierarchy) then the child *ProductClass* **must not** extend another [DeviceClass](#DeviceClass). #### Example ```xml @@ -426,9 +427,9 @@ All elements of [DeviceClass](#DeviceClass) can be reused in *ProductClass*, but <!-- List of Actions, Events and DataPoints goes here--> </ModuleClass> </ModuleClasses> - <DeviceClass> + <ExtendDevice> <Extend domain="adomain" entity="aDeviceClass" /> - </DeviceClass> + </ExtendDevice> </ProductClass> ``` diff --git a/SDT/schema4.0/docs/SDT_UML.uxf b/SDT/schema4.0/docs/SDT_UML.uxf index 3346d4985df1e8896a66f06be011ece45a171ed5..39ac9acf3d32324521c7c81fb8ec9a0139503d03 100644 --- a/SDT/schema4.0/docs/SDT_UML.uxf +++ b/SDT/schema4.0/docs/SDT_UML.uxf @@ -993,11 +993,12 @@ fontsize=12 *@ id : Name* /@ semanticURI : uri/ /- Doc : Doc/ +/- Extend : Extend/ /* Properties : Property/ /* ModuleClasses : ModuleClass/ /* SubDevices : SubDevice/ -/- DeviceClass : Extend/ -/- Extend : Extend/ +/- ExtendDevice : Extend/ + fg=blue</panel_attributes> <additional_attributes/> </element> diff --git a/SDT/schema4.0/docs/images/Product.png b/SDT/schema4.0/docs/images/Product.png index 5da397e839cd889f8032684474cd97fd0666db1b..62fb6ea0dd5e35a9c2763fd144083839916a76b8 100644 Binary files a/SDT/schema4.0/docs/images/Product.png and b/SDT/schema4.0/docs/images/Product.png differ diff --git a/SDT/schema4.0/docs/images/SDT_UML_Basic_Elements.png b/SDT/schema4.0/docs/images/SDT_UML_Basic_Elements.png index 188558e7d6854fb8c58b881e6fa414cb3bb6fe7e..8f80abac56bc9e67db37855268b4d8f0b145569d 100644 Binary files a/SDT/schema4.0/docs/images/SDT_UML_Basic_Elements.png and b/SDT/schema4.0/docs/images/SDT_UML_Basic_Elements.png differ diff --git a/SDT/schema4.0/docs/images/SDT_simplified.png b/SDT/schema4.0/docs/images/SDT_simplified.png index c1295aab52c307f87e3e7cdf0c7ee3a808c19b97..f3ff40db0d91f40696e54e5a7e03d980b153214e 100644 Binary files a/SDT/schema4.0/docs/images/SDT_simplified.png and b/SDT/schema4.0/docs/images/SDT_simplified.png differ diff --git a/SDT/schema4.0/etc/domain.rnc b/SDT/schema4.0/etc/domain.rnc index 0b395f54ee8b136f9cd5258f25ec1234647dc76b..35adcaa351d8d6edbfbb410a9d4c9f9f10b1ccc4 100644 --- a/SDT/schema4.0/etc/domain.rnc +++ b/SDT/schema4.0/etc/domain.rnc @@ -138,7 +138,7 @@ ProductClassesDef = PropertiesDef?, ModuleClassesDef?, SubDevicesRef?, - element DeviceClass { ExtendDef }? + element ExtendDevice { ExtendDef }? }+ } Actions = @@ -187,19 +187,18 @@ Events = Data? }+ } -ExtendDef = - element Extend { - attribute domain { xsd:Name }, - attribute entity { xsd:Name }, - (element Exclude { +ExtendDef = element Extend { ExtendBodyDef } +ExtendBodyDef = + attribute domain { xsd:Name }, + attribute entity { xsd:Name }, + (element Exclude { + attribute name { xsd:Name }, + attribute type { ExtendType } + }+ + | element Include { attribute name { xsd:Name }, attribute type { ExtendType } - } - | element Include { - attribute name { xsd:Name }, - attribute type { ExtendType } - })? - } + }+)? ExtendType = "action" | "datapoint" diff --git a/SDT/schema4.0/src/domain.rng b/SDT/schema4.0/src/domain.rng index 66352e0316657c20bd44944d2ef8ad002117465a..8427bee425c123c531091bbdee7522da9cec5d28 100644 --- a/SDT/schema4.0/src/domain.rng +++ b/SDT/schema4.0/src/domain.rng @@ -392,7 +392,7 @@ <ref name="SubDevicesRef" /> </optional> <optional> - <element name="DeviceClass"> + <element name="ExtendDevice"> <ref name="ExtendDef" /> </element> </optional> @@ -535,34 +535,43 @@ <define name="ExtendDef"> - <element name="Extend"> - <attribute name="domain"> - <data type="Name"/> - </attribute> - <attribute name="entity"> - <data type="Name"/> - </attribute> - <optional> - <choice> - <element name="Exclude"> - <attribute name="name"> - <data type="Name"/> - </attribute> - <attribute name="type"> - <ref name="ExtendType" /> - </attribute> - </element> - <element name="Include"> - <attribute name="name"> - <data type="Name"/> - </attribute> - <attribute name="type"> - <ref name="ExtendType" /> - </attribute> - </element> - </choice> - </optional> - </element> + <element name="Extend"> + <ref name="ExtendBodyDef" /> + </element> + </define> + + + <define name="ExtendBodyDef"> + <attribute name="domain"> + <data type="Name"/> + </attribute> + <attribute name="entity"> + <data type="Name"/> + </attribute> + <optional> + <choice> + <oneOrMore> + <element name="Exclude"> + <attribute name="name"> + <data type="Name"/> + </attribute> + <attribute name="type"> + <ref name="ExtendType" /> + </attribute> + </element> + </oneOrMore> + <oneOrMore> + <element name="Include"> + <attribute name="name"> + <data type="Name"/> + </attribute> + <attribute name="type"> + <ref name="ExtendType" /> + </attribute> + </element> + </oneOrMore> + </choice> + </optional> </define> diff --git a/SDT/schema4.0/src/domain.xsd b/SDT/schema4.0/src/domain.xsd index 7759d6fd2c4a89609548e6777ad3ffb28b88a04f..3c250160f78aa12360c5f0b8623cb3d545ec164a 100644 --- a/SDT/schema4.0/src/domain.xsd +++ b/SDT/schema4.0/src/domain.xsd @@ -211,24 +211,25 @@ <xs:element name="DeviceClasses"> <xs:complexType> <xs:sequence> - <xs:element maxOccurs="unbounded" name="DeviceClass"> - <xs:complexType> - <xs:complexContent> - <xs:extension base="DocDef"> - <xs:sequence> - <xs:element minOccurs="0" ref="Properties"/> - <xs:element minOccurs="0" ref="ModuleClasses"/> - <xs:element minOccurs="0" ref="SubDevices"/> - </xs:sequence> - <xs:attribute name="id" use="required" type="xs:Name"/> - <xs:attribute name="semanticURI" type="xs:anyURI"/> - </xs:extension> - </xs:complexContent> - </xs:complexType> - </xs:element> + <xs:element maxOccurs="unbounded" ref="DeviceClass"/> </xs:sequence> </xs:complexType> </xs:element> + <xs:element name="DeviceClass"> + <xs:complexType> + <xs:complexContent> + <xs:extension base="DocDef"> + <xs:sequence> + <xs:element minOccurs="0" ref="Properties"/> + <xs:element minOccurs="0" ref="ModuleClasses"/> + <xs:element minOccurs="0" ref="SubDevices"/> + </xs:sequence> + <xs:attribute name="id" use="required" type="xs:Name"/> + <xs:attribute name="semanticURI" type="xs:anyURI"/> + </xs:extension> + </xs:complexContent> + </xs:complexType> + </xs:element> <xs:element name="SubDevices"> <xs:complexType> <xs:sequence> @@ -291,13 +292,7 @@ <xs:element minOccurs="0" ref="Properties"/> <xs:element minOccurs="0" ref="ModuleClasses"/> <xs:element minOccurs="0" ref="SubDevices"/> - <xs:element minOccurs="0" name="DeviceClass"> - <xs:complexType> - <xs:sequence> - <xs:element ref="Extend"/> - </xs:sequence> - </xs:complexType> - </xs:element> + <xs:element minOccurs="0" ref="ExtendDevice"/> </xs:sequence> <xs:attribute name="id" use="required" type="xs:Name"/> <xs:attribute name="semanticURI" type="xs:anyURI"/> @@ -305,6 +300,13 @@ </xs:complexContent> </xs:complexType> </xs:element> + <xs:element name="ExtendDevice"> + <xs:complexType> + <xs:sequence> + <xs:element ref="Extend"/> + </xs:sequence> + </xs:complexType> + </xs:element> <xs:element name="Actions"> <xs:complexType> <xs:sequence> @@ -395,16 +397,15 @@ </xs:complexContent> </xs:complexType> </xs:element> - <xs:element name="Extend"> - <xs:complexType> - <xs:choice minOccurs="0"> - <xs:element ref="Exclude"/> - <xs:element ref="Include"/> - </xs:choice> - <xs:attribute name="domain" use="required" type="xs:Name"/> - <xs:attribute name="entity" use="required" type="xs:Name"/> - </xs:complexType> - </xs:element> + <xs:element name="Extend" type="ExtendBodyDef"/> + <xs:complexType name="ExtendBodyDef"> + <xs:choice minOccurs="0"> + <xs:element maxOccurs="unbounded" ref="Exclude"/> + <xs:element maxOccurs="unbounded" ref="Include"/> + </xs:choice> + <xs:attribute name="domain" use="required" type="xs:Name"/> + <xs:attribute name="entity" use="required" type="xs:Name"/> + </xs:complexType> <xs:element name="Exclude"> <xs:complexType> <xs:attribute name="name" use="required" type="xs:Name"/> diff --git a/SDT/schema4.0/test/deviceModbusTemperature.xml b/SDT/schema4.0/test/deviceModbusTemperature.xml new file mode 100644 index 0000000000000000000000000000000000000000..1ad3801748e038aa29bea14ce1ee076fbde2a0b3 --- /dev/null +++ b/SDT/schema4.0/test/deviceModbusTemperature.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<Domain xmlns="http://www.onem2m.org/xml/sdt/4.0" xmlns:xi="http://www.w3.org/2001/XInclude" id="modbus" > + <ModuleClasses> + <ModuleClass name="temperature"> + <Doc>This ModuleClass provides capabilities to represent the current temperature and target temperature of devices such as an air conditioner, refrigerator, oven, etc.</Doc> + <Data> + <DataPoint name="currentTemperature" readable="true" writable="false" eventable="true" optional="false"> + <Doc>The current temperature.</Doc> + <DataType> + <SimpleType type="float" /> + </DataType> + </DataPoint> + <DataPoint name="targetTemperature" readable="true" writable="true" eventable="true" optional="true"> + <Doc>The desired temperature to reach.</Doc> + <DataType> + <SimpleType type="float" /> + </DataType> + </DataPoint> + <DataPoint name="unit" readable="true" writable="false" eventable="true" optional="true"> + <Doc>The unit of measure for the temperature values. The default is Celsius (C).</Doc> + <DataType> + <SimpleType type="string" /> + </DataType> + </DataPoint> + <DataPoint name="minValue" readable="true" writable="false" eventable="true" optional="true"> + <Doc>Minimum value of "targetTemperature".</Doc> + <DataType> + <SimpleType type="float" /> + </DataType> + </DataPoint> + <DataPoint name="maxValue" readable="true" writable="false" eventable="true" optional="true"> + <Doc>Maximum value of "targetTemperature".</Doc> + <DataType> + <SimpleType type="float" /> + </DataType> + </DataPoint> + <DataPoint name="stepValue" readable="true" writable="false" eventable="true" optional="true"> + <Doc>Step value allowed for "targetTemperature".</Doc> + <DataType> + <SimpleType type="float" /> + </DataType> + </DataPoint> + </Data> + </ModuleClass> + </ModuleClasses> + + <DeviceClasses> + <DeviceClass id="deviceModbusTemperature"> + <Doc>This is a test device.</Doc> + <Properties> + <Property name="address"> + <SimpleType type="string" /> + </Property> + <Property name="functionCode"> + <SimpleType type="string" /> + </Property> + <Property name="registers"> + <SimpleType type="string" /> + </Property> + <Property name="slaveID"> + <SimpleType type="string" /> + </Property> + </Properties> + <ModuleClasses> + + <!-- If a device has more than one functionality some or all properties can be moved to the ModuleClass. --> + + <ModuleClass name="temperature"> + <Extend domain="modbus" entity="temperature" /> + </ModuleClass> + </ModuleClasses> + </DeviceClass> + </DeviceClasses> +</Domain> \ No newline at end of file diff --git a/SDT/schema4.0/test/extends-test.xml b/SDT/schema4.0/test/extends-test.xml index f7e8b884b3e56b6a72852a4fcab621352f6f1611..bc39389aba49432c6e5d63f17ef6e1654d5c5ca8 100644 --- a/SDT/schema4.0/test/extends-test.xml +++ b/SDT/schema4.0/test/extends-test.xml @@ -20,6 +20,7 @@ <ModuleClass name="TestExtendsChild"> <Extend domain="extend-test" entity="TestExtendsParent"> <Exclude name="TestExtendsDataPoint2" type="datapoint" /> + <Exclude name="TestExtendsDataPoint1" type="datapoint" /> </Extend> <Data> <DataPoint name="TestExtendsDataPoint3" writable="true"> @@ -30,4 +31,4 @@ </Data> </ModuleClass> </ModuleClasses> -</Domain> \ No newline at end of file +</Domain> diff --git a/SDT/schema4.0/test/productClass-test.xml b/SDT/schema4.0/test/productClass-test.xml index 52b5a6660f7450bbff36a0e04c823ea1ecb4d868..c83ba9312bec444f08b569eab476ba7b7e6b23f3 100644 --- a/SDT/schema4.0/test/productClass-test.xml +++ b/SDT/schema4.0/test/productClass-test.xml @@ -22,9 +22,9 @@ </ModuleClasses> </SubDevice> </SubDevices> - <DeviceClass> + <ExtendDevice> <Extend domain="deviceClass.test" entity="Test" /> - </DeviceClass> + </ExtendDevice> </ProductClass> <!-- Derived ProductClass -->