Commit 65fd4ce7 authored by ankraft's avatar ankraft

Added new extend definition. Adapted test cases

parent 8da029f2
......@@ -53,7 +53,7 @@ DataTypeDef =
attribute unitOfMeasure { text }?,
attribute semanticURI { xsd:anyURI }?,
DocDef,
(ExtendsDef | (StructType | ArrayType | SimpleType | EnumType)),
(ExtendDef | (StructType | ArrayType | SimpleType | EnumType)),
ConstraintsDef?
}
StructType = element Struct { DataTypeDef+ }
......@@ -116,8 +116,7 @@ ModuleClasses =
attribute optional { xsd:boolean }?,
attribute semanticURI { xsd:anyURI }?,
DocDef,
ExtendsDef,
# TODO: singular
ExtendDef,
PropertiesDef?,
Actions?,
Data?,
......@@ -168,21 +167,25 @@ Events =
Data?
}+
}
ExtendsDef =
# TODO: singular
element extends {
# TODO: Uppercase , singular
ExtendDef =
element Extend {
attribute domain { xsd:Name },
attribute class { text },
element excludes {
# TODO: Uppercase + "...s" -> Excludes
element exclude {
attribute name { text },
attribute type {
text
# TODO: add ExcludeTypes
}
}+
}?
attribute entity { xsd:Name },
(element Exclude {
attribute name { xsd:Name },
attribute type { ExtendType }
}
| element Include {
attribute name { xsd:Name },
attribute type { ExtendType }
})?
}?
ExtendType =
"action"
| "datapoint"
| "event"
| "moduleclass"
| "product"
| "property"
| "device"
| "subdevice"
......@@ -150,7 +150,7 @@
</optional>
<ref name="DocDef"/>
<choice>
<ref name="ExtendsDef" />
<ref name="ExtendDef" />
<choice>
<ref name="StructType" />
<ref name="ArrayType" />
......@@ -330,7 +330,7 @@
</attribute>
</optional>
<ref name="DocDef"/>
<ref name="ExtendsDef" /> <!-- TODO: singular -->
<ref name="ExtendDef" />
<optional>
<ref name="PropertiesDef"/>
</optional>
......@@ -471,30 +471,52 @@
</define>
<define name="ExtendsDef"> <!-- TODO: singular -->
<define name="ExtendDef">
<optional>
<element name="extends"> <!-- TODO: Uppercase , singular-->
<element name="Extend">
<attribute name="domain">
<data type="Name"/>
</attribute>
<attribute name="class"/>
<attribute name="entity">
<data type="Name"/>
</attribute>
<optional>
<element name="excludes"> <!-- TODO: Uppercase + "...s" -> Excludes-->
<oneOrMore>
<element name="exclude">
<attribute name="name">
<text/>
</attribute>
<attribute name="type">
<text/> <!-- TODO: add ExcludeTypes -->
</attribute>
</element>
</oneOrMore>
</element>
<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>
</optional>
</define>
<define name="ExtendType">
<choice>
<value>action</value>
<value>datapoint</value>
<value>event</value>
<value>moduleclass</value>
<value>product</value>
<value>property</value>
<value>device</value>
<value>subdevice</value>
</choice>
</define>
</grammar>
......@@ -117,7 +117,7 @@
<xs:extension base="DocDef">
<xs:sequence>
<xs:choice>
<xs:group ref="ExtendsDef"/>
<xs:group ref="ExtendDef"/>
<xs:choice>
<xs:element ref="Struct"/>
<xs:element ref="Array"/>
......@@ -262,7 +262,7 @@
<xs:complexContent>
<xs:extension base="DocDef">
<xs:sequence>
<xs:group ref="ExtendsDef"/>
<xs:group ref="ExtendDef"/>
<xs:element minOccurs="0" ref="Properties"/>
<xs:element minOccurs="0" ref="Actions"/>
<xs:element minOccurs="0" ref="Data"/>
......@@ -363,31 +363,43 @@
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:group name="ExtendsDef">
<xs:group name="ExtendDef">
<xs:sequence>
<xs:element minOccurs="0" ref="extends"/>
<xs:element minOccurs="0" ref="Extend"/>
</xs:sequence>
</xs:group>
<xs:element name="extends">
<xs:element name="Extend">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="excludes"/>
</xs:sequence>
<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="class" use="required"/>
<xs:attribute name="entity" use="required" type="xs:Name"/>
</xs:complexType>
</xs:element>
<xs:element name="excludes">
<xs:element name="Exclude">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" ref="exclude"/>
</xs:sequence>
<xs:attribute name="name" use="required" type="xs:Name"/>
<xs:attribute name="type" use="required" type="ExtendType"/>
</xs:complexType>
</xs:element>
<xs:element name="exclude">
<xs:element name="Include">
<xs:complexType>
<xs:attribute name="name" use="required"/>
<xs:attribute name="type" use="required"/>
<xs:attribute name="name" use="required" type="xs:Name"/>
<xs:attribute name="type" use="required" type="ExtendType"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="ExtendType">
<xs:restriction base="xs:token">
<xs:enumeration value="action"/>
<xs:enumeration value="datapoint"/>
<xs:enumeration value="event"/>
<xs:enumeration value="moduleclass"/>
<xs:enumeration value="product"/>
<xs:enumeration value="property"/>
<xs:enumeration value="device"/>
<xs:enumeration value="subdevice"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
......@@ -83,15 +83,15 @@
<!-- Inheriting ModuleClasses from the global generic ModuleClasses -->
<ModuleClass name="installationLocation">
<extends domain="example.based.on.echonetLite" class="installationLocation"/>
<Extend domain="example.based.on.echonetLite" entity="installationLocation"/>
</ModuleClass>
<ModuleClass name="measuredInstantaneousPowerConsumption">
<extends domain="example.based.on.echonetLite" class="measuredInstantaneousPowerConsumption"/>
<Extend domain="example.based.on.echonetLite" entity="measuredInstantaneousPowerConsumption"/>
</ModuleClass>
<ModuleClass name="temperatureSensorDataPoints">
<extends domain="example.based.on.echonetLite" class="temperatureSensorDataPoints"/>
<Extend domain="example.based.on.echonetLite" entity="temperatureSensorDataPoints"/>
</ModuleClass>
......@@ -99,7 +99,7 @@
the change of name. -->
<ModuleClass name="washingMachineOperationStatus">
<extends domain="example.based.on.echonetLite" class="operationStatus"/>
<Extend domain="example.based.on.echonetLite" entity="operationStatus"/>
<!-- This Module extends the global one with an event. -->
......
......@@ -48,7 +48,7 @@
</Events>
</ModuleClass>
<ModuleClass name="power">
<extends class="BooleanState" domain="hgi.dal.core"/>
<Extend entity="BooleanState" domain="hgi.dal.core"/>
</ModuleClass>
</ModuleClasses>
</DeviceClass>
......
......@@ -20,7 +20,7 @@
<Data>
<DataPoint name="TestDataPoint" writable="true">
<DataType>
<extends domain="datatypes-test" class="temperatureType" />
<Extend domain="datatypes-test" entity="temperatureType" />
</DataType>
</DataPoint>
</Data>
......
......@@ -13,7 +13,7 @@
</Properties>
<ModuleClasses>
<ModuleClass name="aModuleClass">
<extends domain="hgi.dal.core" class="BooleanState"></extends>
<Extend domain="hgi.dal.core" entity="BooleanState" />
</ModuleClass>
</ModuleClasses>
</DeviceClass>
......
......@@ -12,19 +12,19 @@
<DeviceClass id="airConditioner">
<ModuleClasses>
<ModuleClass name="operationStatus">
<extends domain="example1.SDT" class="operationStatus"/>
<Extend domain="example1.SDT" entity="operationStatus"/>
</ModuleClass>
<ModuleClass name="installationLocation">
<extends domain="example1.SDT" class="installationLocation"/>
<Extend domain="example1.SDT" entity="installationLocation"/>
</ModuleClass>
<ModuleClass name="measuredCumulativePowerConsumption">
<extends domain="example1.SDT" class="measuredCumulativePowerConsumption"/>
<Extend domain="example1.SDT" entity="measuredCumulativePowerConsumption"/>
</ModuleClass>
<ModuleClass name="measuredCumulativePowerConsumption">
<extends domain="example1.SDT" class="measuredCumulativePowerConsumption"/>
<Extend domain="example1.SDT" entity="measuredCumulativePowerConsumption"/>
</ModuleClass>
<ModuleClass name="onTimerSetting">
<extends domain="example1.SDT" class="onTimerSetting"/>
<Extend domain="example1.SDT" entity="onTimerSetting"/>
</ModuleClass>
</ModuleClasses>
</DeviceClass>
......
......@@ -12,22 +12,22 @@
<DeviceClass id="waschingMachine">
<ModuleClasses>
<ModuleClass name="operationStatus">
<extends domain="example1.SDT" class="operationStatus"/>
<Extend domain="example1.SDT" entity="operationStatus"/>
</ModuleClass>
<ModuleClass name="installationLocation">
<extends domain="example1.SDT" class="installationLocation"/>
<Extend domain="example1.SDT" entity="installationLocation"/>
</ModuleClass>
<ModuleClass name="measuredCumulativePowerConsumption">
<extends domain="example1.SDT" class="measuredCumulativePowerConsumption"/>
<Extend domain="example1.SDT" entity="measuredCumulativePowerConsumption"/>
</ModuleClass>
<ModuleClass name="measuredCumulativePowerConsumption">
<extends domain="example1.SDT" class="measuredCumulativePowerConsumption"/>
<Extend domain="example1.SDT" entity="measuredCumulativePowerConsumption"/>
</ModuleClass>
<ModuleClass name="onTimerSetting">
<extends domain="example1.SDT" class="onTimerSetting"/>
<Extend domain="example1.SDT" entity="onTimerSetting"/>
</ModuleClass>
<ModuleClass name="statusDoor">
<extends domain="example1.SDT" class="statusDoor"/>
<Extend domain="example1.SDT" entity="statusDoor"/>
</ModuleClass>
</ModuleClasses>
</DeviceClass>
......
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Test the extends element -->
<Domain id="extends-test" xmlns="http://homegatewayinitiative.org/xml/dal/4.0" xmlns:xi="http://www.w3.org/2001/XInclude">
<Domain id="extend-test" xmlns="http://homegatewayinitiative.org/xml/dal/4.0" xmlns:xi="http://www.w3.org/2001/XInclude">
<ModuleClasses>
<ModuleClass name="TestExtendsParent">
<Data>
......@@ -18,11 +18,9 @@
</Data>
</ModuleClass>
<ModuleClass name="TestExtendsChild">
<extends domain="extends-test" class="TestExtendsParent">
<excludes>
<exclude name="TestExtendsDataPoint2" type="datapoint" />
</excludes>
</extends>
<Extend domain="extend-test" entity="TestExtendsParent">
<Exclude name="TestExtendsDataPoint2" type="datapoint" />
</Extend>
<Data>
<DataPoint name="TestExtendsDataPoint3" writable="true">
<DataType>
......
......@@ -159,7 +159,7 @@
The proprietry interface for turning all switches of the extension block on and off.
The action "BooleanState:get" returns "true" when any of the sub-devices is in the state "on", otherwise it returns "false".
</Doc>
<extends domain="hgi.dal.core" class="BooleanState"/>
<Extend domain="hgi.dal.core" entity="BooleanState"/>
<Properties>
<Property name="version" value="1.0.0">
<Doc>Version for this ModuleClass</Doc>
......@@ -265,7 +265,7 @@
</Properties>
<ModuleClasses>
<ModuleClass name="power">
<extends domain="hgi.dal.core" class="BooleanState"/>
<Extend domain="hgi.dal.core" entity="BooleanState"/>
</ModuleClass>
</ModuleClasses>
</SubDevice>
......@@ -292,7 +292,7 @@
</Properties>
<ModuleClasses>
<ModuleClass name="power">
<extends domain="hgi.dal.core" class="BooleanState"/>
<Extend domain="hgi.dal.core" entity="BooleanState"/>
</ModuleClass>
</ModuleClasses>
</SubDevice>
......
......@@ -20,7 +20,7 @@
<Data>
<DataPoint name="TestDataPoint" writable="true" semanticURI="http://example.com/TestDataPoint.rdf">
<DataType>
<extends domain="datatypes-test" class="temperatureType" />
<Extend domain="datatypes-test" entity="temperatureType" />
</DataType>
</DataPoint>
</Data>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment