From 2d82a80a181e7eb12b6bb5216e56f97af6e394f7 Mon Sep 17 00:00:00 2001
From: ankraft <an.kraft@googlemail.com>
Date: Thu, 25 Apr 2019 17:03:12 +0200
Subject: [PATCH] Added support for semanticURI attribute

---
 SDT/schema4.0/etc/domain.rnc            | 12 +++++
 SDT/schema4.0/src/domain.rng            | 61 +++++++++++++++++++++++++
 SDT/schema4.0/src/domain.xsd            | 12 +++++
 SDT/schema4.0/test/semanticURI-test.xml | 31 +++++++++++++
 4 files changed, 116 insertions(+)
 create mode 100644 SDT/schema4.0/test/semanticURI-test.xml

diff --git a/SDT/schema4.0/etc/domain.rnc b/SDT/schema4.0/etc/domain.rnc
index 7224166..8dc3a81 100644
--- a/SDT/schema4.0/etc/domain.rnc
+++ b/SDT/schema4.0/etc/domain.rnc
@@ -12,6 +12,7 @@ Domain =
   element Domain {
     attribute xml:base { xsd:anyURI }?,
     attribute id { xsd:Name },
+    attribute semanticURI { xsd:anyURI }?,
     DocDef,
     element Imports { Domain+ }?,
     element DataTypes { DataTypeDef+ }?,
@@ -19,12 +20,14 @@ Domain =
     element DeviceClasses {
       element DeviceClass {
         attribute id { xsd:Name },
+        attribute semanticURI { xsd:anyURI }?,
         DocDef,
         PropertiesDef?,
         ModuleClasses?,
         element SubDevices {
           element SubDevice {
             attribute id { xsd:Name },
+            attribute semanticURI { xsd:anyURI }?,
             DocDef,
             PropertiesDef?,
             ModuleClasses?
@@ -39,6 +42,7 @@ PropertiesDef =
       attribute name { text },
       attribute optional { xsd:boolean }?,
       attribute value { text }?,
+      attribute semanticURI { xsd:anyURI }?,
       DocDef,
       SimpleType
     }+
@@ -47,6 +51,7 @@ DataTypeDef =
   element DataType {
     attribute name { text }?,
     attribute unitOfMeasure { text }?,
+    attribute semanticURI { xsd:anyURI }?,
     DocDef,
     (ExtendsDef | (StructType | ArrayType | SimpleType | EnumType)),
     ConstraintsDef?
@@ -76,6 +81,7 @@ EnumValueDef =
     attribute name { text },
     attribute value { text },
     attribute type { BasicType }?,
+    attribute semanticURI { xsd:anyURI }?,
     DocDef
   }
 ConstraintsDef =
@@ -84,6 +90,7 @@ ConstraintsDef =
       attribute name { text },
       attribute type { BasicType }?,
       attribute value { text }?,
+      attribute semanticURI { xsd:anyURI }?,
       DocDef
     }+
   }
@@ -107,6 +114,7 @@ ModuleClasses =
     element ModuleClass {
       attribute name { text },
       attribute optional { xsd:boolean }?,
+      attribute semanticURI { xsd:anyURI }?,
       DocDef,
       ExtendsDef,
       # TODO: singular
@@ -121,6 +129,7 @@ Actions =
     element Action {
       attribute name { text },
       attribute optional { xsd:boolean }?,
+      attribute semanticURI { xsd:anyURI }?,
       DocDef,
       DataTypeDef?,
       ArgDef?
@@ -130,6 +139,7 @@ ArgDef =
   element Args {
     element Arg {
       attribute name { text },
+      attribute semanticURI { xsd:anyURI }?,
       DocDef,
       DataTypeDef
     }+
@@ -142,6 +152,7 @@ Data =
       attribute writable { xsd:boolean }?,
       attribute readable { xsd:boolean }?,
       attribute eventable { xsd:boolean }?,
+      attribute semanticURI { xsd:anyURI }?,
       DocDef,
       DataTypeDef
     }+
@@ -151,6 +162,7 @@ Events =
     element Event {
       attribute name { text },
       attribute optional { xsd:boolean }?,
+      attribute semanticURI { xsd:anyURI }?,
       DocDef,
       Data?
     }+
diff --git a/SDT/schema4.0/src/domain.rng b/SDT/schema4.0/src/domain.rng
index 715c324..c98e91d 100644
--- a/SDT/schema4.0/src/domain.rng
+++ b/SDT/schema4.0/src/domain.rng
@@ -28,6 +28,11 @@
 			<attribute name="id">
 				<data type="Name"/>
 			</attribute>
+			<optional>
+				<attribute name="semanticURI">
+					<data type="anyURI"/>
+				</attribute>
+			</optional>
 			<ref name="DocDef"/>
 			<optional>
 				<element name="Imports">
@@ -53,6 +58,11 @@
 							<attribute name="id">
 								<data type="Name"/>
 							</attribute>
+							<optional>
+								<attribute name="semanticURI">
+									<data type="anyURI"/>
+								</attribute>
+							</optional>
 							<ref name="DocDef"/>
 							<optional>
 								<ref name="PropertiesDef"/>
@@ -67,6 +77,11 @@
 											<attribute name="id">
 												<data type="Name"/>
 											</attribute>
+											<optional>
+												<attribute name="semanticURI">
+													<data type="anyURI"/>
+												</attribute>
+											</optional>
 											<ref name="DocDef"/>
 											<optional>
 												<ref name="PropertiesDef"/>
@@ -103,6 +118,11 @@
 							<text/>
 						</attribute>
 					</optional>
+					<optional>
+						<attribute name="semanticURI">
+							<data type="anyURI"/>
+						</attribute>
+					</optional>
 					<ref name="DocDef"/>
 					<ref name="SimpleType" />
 				</element>
@@ -123,6 +143,11 @@
 					<text/>
 				</attribute>
 			</optional>
+			<optional>
+				<attribute name="semanticURI">
+					<data type="anyURI"/>
+				</attribute>
+			</optional>
 			<ref name="DocDef"/>
 			<choice>
 				<ref name="ExtendsDef" />
@@ -205,10 +230,16 @@
 					<ref name="BasicType"/>
 				</attribute>
 			</optional>
+			<optional>
+				<attribute name="semanticURI">
+					<data type="anyURI"/>
+				</attribute>
+			</optional>
 			<ref name="DocDef"/>
 		</element>
 	</define>
 
+
 	<define name="ConstraintsDef">
 		<element name="Constraints">
 			<oneOrMore>
@@ -226,6 +257,11 @@
 							<text/>
 						</attribute>
 					</optional>
+					<optional>
+						<attribute name="semanticURI">
+							<data type="anyURI"/>
+						</attribute>
+					</optional>					
 					<ref name="DocDef"/>
 				</element>
 			</oneOrMore>
@@ -288,6 +324,11 @@
 							<data type="boolean"/>
 						</attribute>
 					</optional>
+					<optional>
+						<attribute name="semanticURI">
+							<data type="anyURI"/>
+						</attribute>
+					</optional>
 					<ref name="DocDef"/>
 					<ref name="ExtendsDef" /> <!-- TODO: singular -->
 					<optional>
@@ -320,6 +361,11 @@
 							<data type="boolean"/>
 						</attribute>
 					</optional>
+					<optional>
+						<attribute name="semanticURI">
+							<data type="anyURI"/>
+						</attribute>
+					</optional>
 					<ref name="DocDef"/>
 					<optional>
 						<ref name="DataTypeDef"/>
@@ -338,6 +384,11 @@
 			<oneOrMore>
 				<element name="Arg">
 					<attribute name="name"/>
+					<optional>
+						<attribute name="semanticURI">
+							<data type="anyURI"/>
+						</attribute>
+					</optional>
 					<ref name="DocDef"/>
 					<ref name="DataTypeDef"/>
 				</element>
@@ -373,6 +424,11 @@
 							<data type="boolean"/>
 						</attribute>
 					</optional>
+					<optional>
+						<attribute name="semanticURI">
+							<data type="anyURI"/>
+						</attribute>
+					</optional>
 					<ref name="DocDef"/>
 					<ref name="DataTypeDef"/>
 				</element>
@@ -393,6 +449,11 @@
 							<data type="boolean"/>
 						</attribute>
 					</optional>
+					<optional>
+						<attribute name="semanticURI">
+							<data type="anyURI"/>
+						</attribute>
+					</optional>
 					<ref name="DocDef"/>
 					<optional>
 						<ref name="Data" />
diff --git a/SDT/schema4.0/src/domain.xsd b/SDT/schema4.0/src/domain.xsd
index 3b8bbeb..954fe24 100644
--- a/SDT/schema4.0/src/domain.xsd
+++ b/SDT/schema4.0/src/domain.xsd
@@ -27,6 +27,7 @@
           </xs:sequence>
           <xs:attribute ref="xml:base"/>
           <xs:attribute name="id" use="required" type="xs:Name"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -62,6 +63,7 @@
             <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>
@@ -82,6 +84,7 @@
             <xs:element minOccurs="0" ref="ModuleClasses"/>
           </xs:sequence>
           <xs:attribute name="id" use="required" type="xs:Name"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -103,6 +106,7 @@
           <xs:attribute name="name" use="required"/>
           <xs:attribute name="optional" type="xs:boolean"/>
           <xs:attribute name="value"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -125,6 +129,7 @@
           </xs:sequence>
           <xs:attribute name="name"/>
           <xs:attribute name="unitOfMeasure"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -178,6 +183,7 @@
           <xs:attribute name="name" use="required"/>
           <xs:attribute name="value" use="required"/>
           <xs:attribute name="type" type="BasicType"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -196,6 +202,7 @@
           <xs:attribute name="name" use="required"/>
           <xs:attribute name="type" type="BasicType"/>
           <xs:attribute name="value"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -263,6 +270,7 @@
           </xs:sequence>
           <xs:attribute name="name" use="required"/>
           <xs:attribute name="optional" type="xs:boolean"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -284,6 +292,7 @@
           </xs:sequence>
           <xs:attribute name="name" use="required"/>
           <xs:attribute name="optional" type="xs:boolean"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -303,6 +312,7 @@
             <xs:element ref="DataType"/>
           </xs:sequence>
           <xs:attribute name="name" use="required"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -326,6 +336,7 @@
           <xs:attribute name="writable" type="xs:boolean"/>
           <xs:attribute name="readable" type="xs:boolean"/>
           <xs:attribute name="eventable" type="xs:boolean"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
@@ -346,6 +357,7 @@
           </xs:sequence>
           <xs:attribute name="name" use="required"/>
           <xs:attribute name="optional" type="xs:boolean"/>
+          <xs:attribute name="semanticURI" type="xs:anyURI"/>
         </xs:extension>
       </xs:complexContent>
     </xs:complexType>
diff --git a/SDT/schema4.0/test/semanticURI-test.xml b/SDT/schema4.0/test/semanticURI-test.xml
new file mode 100644
index 0000000..1d6d310
--- /dev/null
+++ b/SDT/schema4.0/test/semanticURI-test.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Test the data types references -->
+
+<Domain id="semanticURI-test" xmlns="http://homegatewayinitiative.org/xml/dal/4.0" xmlns:xi="http://www.w3.org/2001/XInclude" semanticURI="http://example.com/semanticURI-test.rdf">
+	<DataTypes>
+		<DataType name="temperatureType" unitOfMeasure="C" semanticURI="http://example.com/temperatureType.rdf">
+			<SimpleType type="float"/>
+		</DataType>
+		<DataType name="anEnumType" semanticURI="http://example.com/anEnumType.rdf">
+			<EnumType>
+				<EnumValue name="red" type="integer" value="1" semanticURI="http://example.com/anEnumType-red.rdf"/>
+				<EnumValue name="green" value="2" semanticURI="http://example.com/anEnumType-green.rdf"/>
+				<EnumValue name="blue" value="3" semanticURI="http://example.com/anEnumType-blue.rdf"/>
+			</EnumType>
+		</DataType>
+	</DataTypes>
+
+	<ModuleClasses>
+		<ModuleClass name="TestDataTypes" semanticURI="http://example.com/TestDataTypes.rdf">
+			<Data>
+				<DataPoint name="TestDataPoint" writable="true" semanticURI="http://example.com/TestDataPoint.rdf">
+					<DataType>
+						<extends domain="datatypes-test" class="temperatureType" />
+					</DataType>
+				</DataPoint>
+			</Data>
+		</ModuleClass>
+	</ModuleClasses>
+
+
+</Domain>
\ No newline at end of file
-- 
GitLab