domain.rng 7.04 KB
Newer Older
ankraft's avatar
ankraft committed
1 2
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
	datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
ankraft's avatar
ankraft committed
3
 
ankraft's avatar
ankraft committed
4 5 6 7 8

	<start>
		<ref name="Domain"/>
	</start>

ankraft's avatar
ankraft committed
9

ankraft's avatar
ankraft committed
10 11 12 13 14 15 16 17 18 19
	<define name="Domain">
		<element name="Domain">
			<optional>
				<attribute name="xml:base">
					<data type="anyURI"/>
				</attribute>
			</optional>
			<attribute name="id">
				<data type="ID"/>
			</attribute>
20
			<ref name="DocDef"/>
ankraft's avatar
ankraft committed
21 22
			<optional>
				<element name="Imports">
ankraft's avatar
ankraft committed
23
					<oneOrMore>
ankraft's avatar
ankraft committed
24
						<ref name="Domain"/>
ankraft's avatar
ankraft committed
25
					</oneOrMore>
ankraft's avatar
ankraft committed
26 27
				</element>
			</optional>
ankraft's avatar
ankraft committed
28 29
			<optional>
				<element name="Modules">
ankraft's avatar
ankraft committed
30
					<oneOrMore>
ankraft's avatar
ankraft committed
31 32 33
						<element name="ModuleClass">
							<ref name="ModuleDef"/>
						</element>
ankraft's avatar
ankraft committed
34
					</oneOrMore>
ankraft's avatar
ankraft committed
35 36 37 38
				</element>
			</optional>
			<optional>
				<element name="Devices">
ankraft's avatar
ankraft committed
39
					<oneOrMore>
ankraft's avatar
ankraft committed
40 41 42 43
						<element name="Device">
							<attribute name="id">
								<data type="Name"/>
							</attribute>
44 45
							<ref name="DocDef"/>
							<optional>
46
								<ref name="PropertiesDef"/>
47
							</optional>
ankraft's avatar
ankraft committed
48 49 50
							<optional>
								<ref name="Modules"/>
							</optional>
ankraft's avatar
ankraft committed
51 52
							<optional>
								<element name="SubDevices">
ankraft's avatar
ankraft committed
53
									<oneOrMore>
ankraft's avatar
ankraft committed
54 55 56 57
										<element name="SubDevice">
											<attribute name="id">
												<data type="Name"/>
											</attribute>
58 59
											<ref name="DocDef"/>
											<optional>
60
												<ref name="PropertiesDef"/>
61
											</optional>
ankraft's avatar
ankraft committed
62 63 64 65
											<optional>
												<ref name="Modules"/>
											</optional>
										</element>
ankraft's avatar
ankraft committed
66
									</oneOrMore>
ankraft's avatar
ankraft committed
67 68
								</element>
							</optional>
ankraft's avatar
ankraft committed
69
						</element>
ankraft's avatar
ankraft committed
70
					</oneOrMore>
ankraft's avatar
ankraft committed
71 72 73 74 75 76
				</element>
			</optional>
		</element>
	</define>


77 78
	<define name="PropertiesDef">
		<element name="Properties">
79
			<oneOrMore>
80
				<element name="Property">
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
					<attribute name="name">
						<text/>
					</attribute>
					<optional>
						<attribute name="optional">
							<data type="boolean"/>
						</attribute>
					</optional>
					<optional>
						<attribute name="value">
							<text/>
						</attribute>
					</optional>
					<ref name="DocDef"/>
					<ref name="SimpleType" />
				</element>
			</oneOrMore>
		</element>
	</define>


ankraft's avatar
ankraft committed
102
	<define name="DataTypeDef">
ankraft's avatar
ankraft committed
103
		<element name="DataType">
ankraft's avatar
ankraft committed
104 105 106 107 108
			<optional>
				<attribute name="name">
					<text/>
				</attribute>
			</optional>
ankraft's avatar
ankraft committed
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
			<optional>
				<attribute name="unitOfMeasure">
					<text/>
				</attribute>
			</optional>
			<ref name="DocDef"/>
			<choice>
				<ref name="StructType" />
				<ref name="ArrayType" />
				<ref name="SimpleType" />
			</choice>
			<optional>
				<ref name="ConstraintsDef"/>
			</optional>
		</element>
	</define>


	<define name="StructType">
		<element name="Struct">
ankraft's avatar
ankraft committed
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
			<oneOrMore>
				<ref name="DataTypeDef" />
			</oneOrMore>
		</element>
	</define>


	<define name="ArrayType">
		<element name="Array">
			<ref name="DataTypeDef" />
		</element>
	</define>


	<define name="SimpleType">
		<element name="SimpleType">
			<attribute name="type">
				<ref name="BasicType" />
			</attribute>
		</element>
	</define>


	<define name="BasicType">
ankraft's avatar
ankraft committed
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
		<choice>
			<value>integer</value>
			<value>boolean</value>
			<value>string</value>
			<value>byte</value>
			<value>float</value>
			<value>array</value>
			<value>enum</value>
			<value>date</value>
			<value>time</value>
			<value>datetime</value>
			<value>blob</value>
			<value>uri</value>
		</choice>
	</define>

ankraft's avatar
ankraft committed
169

ankraft's avatar
ankraft committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
	<define name="ConstraintsDef">
		<element name="Constraints">
			<oneOrMore>
				<element name="Constraint">
					<attribute name="name">
						<text/>
					</attribute>
					<optional>
						<attribute name="type">
							<ref name="BasicType" />
						</attribute>
					</optional>
					<optional>
						<attribute name="value">
							<text/>
						</attribute>
					</optional>
					<ref name="DocDef"/>
				</element>
			</oneOrMore>
		</element>
	</define>

ankraft's avatar
ankraft committed
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
	<define name="DocText">
		<zeroOrMore>
			<choice>
				<text/>
				<element name="em">
					<text/>
				</element>
				<element name="b">
					<text/>
				</element>
				<element name="tt">
					<text/>
				</element>
			</choice>
		</zeroOrMore>
	</define>


211 212
	<!-- <Doc> element is always optional -->
	<define name="DocDef">
ankraft's avatar
ankraft committed
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252
		<optional>
			<element name="Doc">
				<choice>
					<ref name="DocText"/>
					<zeroOrMore>
						<choice>
							<element name="p">
								<ref name="DocText"/>
							</element>
							<element name="img">
								<attribute name="src"/>
								<element name="caption">
									<text/>
								</element>
							</element>
						</choice>
					</zeroOrMore>
				</choice>
			</element>
		</optional>
	</define>


	<define name="ModuleDef">
		<attribute name="name">
			<text/>
		</attribute>
		<optional>
			<attribute name="optional">
				<data type="boolean"/>
			</attribute>
		</optional>
		<optional>
			<element name="extends">
				<attribute name="domain">
					<data type="IDREF"/>
				</attribute>
				<attribute name="class"/>
			</element>
		</optional>
253
		<ref name="DocDef"/>
254
		<optional>
255
			<ref name="PropertiesDef"/>
256
		</optional>
ankraft's avatar
ankraft committed
257 258 259 260 261 262 263 264 265 266 267 268 269 270
		<optional>
			<ref name="Actions"/>
		</optional>
		<optional>
			<ref name="Data"/>
		</optional>
		<optional>
			<ref name="Events"/>
		</optional>
	</define>


	<define name="Modules">
		<element name="Modules">
ankraft's avatar
ankraft committed
271
			<oneOrMore>
ankraft's avatar
ankraft committed
272 273 274
				<element name="Module">
					<ref name="ModuleDef"/>
				</element>
ankraft's avatar
ankraft committed
275
			</oneOrMore>
ankraft's avatar
ankraft committed
276 277 278 279 280 281
		</element>
	</define>


	<define name="Actions">
		<element name="Actions">
ankraft's avatar
ankraft committed
282
			<oneOrMore>
ankraft's avatar
ankraft committed
283 284 285 286 287 288 289 290 291
				<element name="Action">
					<attribute name="name">
						<text/>
					</attribute>
					<optional>
						<attribute name="optional">
							<data type="boolean"/>
						</attribute>
					</optional>
292
					<ref name="DocDef"/>
ankraft's avatar
ankraft committed
293 294 295
					<optional>
						<ref name="DataTypeDef"/>
					</optional>
296 297 298
					<optional>
						<ref name="ArgDef" />
					</optional>
ankraft's avatar
ankraft committed
299
				</element>
ankraft's avatar
ankraft committed
300
			</oneOrMore>
ankraft's avatar
ankraft committed
301 302 303
		</element>
	</define>

ankraft's avatar
ankraft committed
304

305 306
	<define name="ArgDef">
		<element name="Args">
ankraft's avatar
ankraft committed
307
			<oneOrMore>
308 309 310 311 312
				<element name="Arg">
					<attribute name="name"/>
					<ref name="DocDef"/>
					<ref name="DataTypeDef"/>
				</element>
ankraft's avatar
ankraft committed
313
			</oneOrMore>
314 315
		</element>
	</define>
ankraft's avatar
ankraft committed
316

ankraft's avatar
ankraft committed
317

ankraft's avatar
ankraft committed
318 319
	<define name="Data">
		<element name="Data">
ankraft's avatar
ankraft committed
320
			<oneOrMore>
ankraft's avatar
ankraft committed
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
				<element name="DataPoint">
					<attribute name="name">
						<text/>
					</attribute>
					<optional>
						<attribute name="optional">
							<data type="boolean"/>
						</attribute>
					</optional>
					<optional>
						<attribute name="writable">
							<data type="boolean"/>
						</attribute>
					</optional>
					<optional>
						<attribute name="readable">
							<data type="boolean"/>
						</attribute>
					</optional>
					<optional>
						<attribute name="eventable">
							<data type="boolean"/>
						</attribute>
					</optional>
345
					<ref name="DocDef"/>
ankraft's avatar
ankraft committed
346
					<ref name="DataTypeDef"/>
ankraft's avatar
ankraft committed
347
				</element>
ankraft's avatar
ankraft committed
348
			</oneOrMore>
ankraft's avatar
ankraft committed
349 350 351 352 353 354
		</element>
	</define>


	<define name="Events">
		<element name="Events">
ankraft's avatar
ankraft committed
355
			<oneOrMore>
ankraft's avatar
ankraft committed
356 357 358 359 360 361 362 363 364
				<element name="Event">
					<attribute name="name">
						<text/>
					</attribute>
					<optional>
						<attribute name="optional">
							<data type="boolean"/>
						</attribute>
					</optional>
365
					<ref name="DocDef"/>
366 367 368
					<optional>
						<ref name="Data" />
					</optional>
ankraft's avatar
ankraft committed
369
				</element>
ankraft's avatar
ankraft committed
370
			</oneOrMore>
ankraft's avatar
ankraft committed
371 372 373 374 375
		</element>
	</define>

</grammar>