summaryrefslogtreecommitdiffstats
path: root/test/unittests/schemas/rule.rng
blob: 242eff88d79c8457cbb029fcfcc9812d7e6ea0cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0" 
	 xmlns:ann="http://relaxng.org/ns/compatibility/annotations/1.0"
         datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
  <start>
      <ref name="element-rule"/>
  </start>

  <define name="element-rule">
    <element name="rule">
     <choice>
     <attribute name="id-ref"><data type="IDREF"/></attribute>
     <group>
      <attribute name="id"><data type="ID"/></attribute>
      <choice>
	<externalRef href="score.rng"/>
	<attribute name="score-attribute"><text/></attribute>
      </choice>
      <optional>
	<attribute name="boolean-op">
	  <choice>
	    <value>or</value>
	    <value>and</value>
	  </choice>
	</attribute>
      </optional>
      <optional>
	<attribute name="role"><text/></attribute>
      </optional>
      <oneOrMore>
	<choice>
          <element name="expression">
	    <attribute name="id"><data type="ID"/></attribute>
	    <attribute name="attribute"><text/></attribute>
	    <attribute name="operation">
	      <choice>
		<value>lt</value>
		<value>gt</value>
		<value>lte</value>
		<value>gte</value>
		<value>eq</value>
		<value>ne</value>
		<value>defined</value>
		<value>not_defined</value>
	      </choice>
	    </attribute>
	    <optional>
	      <attribute name="value"><text/></attribute>
	    </optional>
	    <optional>
	      <attribute name="type" ann:defaultValue="string">
		<choice>
		  <value>string</value>
		  <value>number</value>
		  <value>version</value>
		</choice>
	      </attribute>
	    </optional>
	  </element>
          <element name="date_expression">
	    <attribute name="id"><data type="ID"/></attribute>
	    <choice>
	      <group>
		<attribute name="operation"><value>in_range</value></attribute>
		<choice>
		  <group>
		    <optional>
		      <attribute name="start"><text/></attribute>
		    </optional>
		    <attribute name="end"><text/></attribute>
		  </group>
		  <group>
		    <attribute name="start"><text/></attribute>
		    <element name="duration">
		      <ref name="date-common"/>
		    </element>
		  </group>
		</choice>
	      </group>
	      <group>
		<attribute name="operation"><value>gt</value></attribute>
		<attribute name="start"><text/></attribute>
	      </group>
	      <group>
		<attribute name="operation"><value>lt</value></attribute>
		<choice>
		  <attribute name="end"><text/></attribute>
		</choice>
	      </group>
	      <group>
		<attribute name="operation"><value>date_spec</value></attribute>
		<element name="date_spec">
		  <ref name="date-common"/>
		</element> 
	      </group>
	    </choice>
	  </element> 
	  <ref name="element-rule"/>
	</choice>
      </oneOrMore>
     </group>
     </choice>
    </element>
  </define>

  <define name="date-common">
    <attribute name="id"><data type="ID"/></attribute>
    <optional>
      <attribute name="hours"><text/></attribute>
    </optional>
    <optional>
      <attribute name="monthdays"><text/></attribute>
    </optional>
    <optional>
      <attribute name="weekdays"><text/></attribute>
    </optional>
    <optional>
      <attribute name="yearsdays"><text/></attribute>
    </optional>
    <optional>
      <attribute name="months"><text/></attribute>
    </optional>
    <optional>
      <attribute name="weeks"><text/></attribute>
    </optional>
    <optional>
      <attribute name="years"><text/></attribute>
    </optional>
    <optional>
      <attribute name="weekyears"><text/></attribute>
    </optional>
    <optional>
      <attribute name="moon"><text/></attribute>
    </optional>
  </define>

</grammar>