-
Notifications
You must be signed in to change notification settings - Fork 1
/
vo-dml-binding.xsd
288 lines (269 loc) · 12.9 KB
/
vo-dml-binding.xsd
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.ivoa.net/xml/vodml-binding/v0.9.1"
targetNamespace="http://www.ivoa.net/xml/vodml-binding/v0.9.1" attributeFormDefault="unqualified"
elementFormDefault="unqualified">
<xsd:complexType name="MappedModels">
<xsd:sequence>
<xsd:element name="model" type="ModelMapping" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ModelMapping">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="1" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
the name of the model - i.e. what appears in vo-dml:model/name for the particular model
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="file" type="xsd:string" minOccurs="1" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>the file name for the model</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="java-package" type="JavaName" minOccurs="0" maxOccurs="1" />
<xsd:element name="python-package" type="PythonName" minOccurs="0" maxOccurs="1" />
<!-- TODO put all the XML mapping into own element -->
<xsd:element name="xml-targetnamespace" type="xmlnsMapping" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
the xml namespace that is to be the target namespace for the generated model code
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="xmllegacy-targetnamespace" type="legacyxmlnsMapping" minOccurs="0" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>
the xml namespace that is to be the target namespace for the generated model code
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="xml" maxOccurs="1" minOccurs="0">
<xsd:annotation>
<xsd:documentation>customization of the xml serialization</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="compositionStyle" default="wrapped">
<xsd:annotation>
<xsd:documentation>
whether compositions with multiplicities greater than 1 should have a wrapper element
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="wrapped"></xsd:enumeration>
<xsd:enumeration value="unwrapped"></xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="json-baseURI" type="xsd:string" maxOccurs="1" minOccurs="0"></xsd:element>
<xsd:element name="json" maxOccurs="1" minOccurs="0">
<xsd:annotation>
<xsd:documentation>customization of the JSON serialization</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="lax" type="xsd:boolean" use="optional" default="false">
<xsd:annotation>
<xsd:documentation>whether definitions in the schema model should be "closed off" with "additionalProperties": false - if a type definition is expected to be extended, then this cannot be done
The default is false which indicates that types should be "closed off".
In general if a model is expected to be used a a "base model" then this should probably be set to true for the model.</xsd:documentation>
</xsd:annotation></xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="rdb" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:attribute name="inheritance-strategy">
<xsd:annotation>
<xsd:documentation>the inheritance strategy in generating tables - follows JPA strategies</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="joined"></xsd:enumeration>
<xsd:enumeration value="single-table"></xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
<xsd:attribute name="discriminatorColumnLength" type="xsd:int" use="optional" default="32">
<xsd:annotation>
<xsd:documentation>The size of the discrimator column</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="fetching" use="optional" default="lazy">
<xsd:annotation>
<xsd:documentation>
whether child objects from the database are fetched at initial query time or only on use
</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="lazy"></xsd:enumeration>
<xsd:enumeration value="eager"></xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="type-mapping" type="TypeMapping" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>the list of type mappings for the model.</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="type-detail" type="TypeDetail" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>the list of type detail the model.</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="xmlnsMapping">
<xsd:simpleContent>
<xsd:extension base="xsd:anyURI">
<xsd:attribute name="prefix" type="xsd:NCName">
<xsd:annotation>
<xsd:documentation>The namespace prefix to use in generated code</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="legacyxmlnsMapping">
<xsd:simpleContent>
<xsd:extension base="xsd:anyURI">
<xsd:attribute name="prefix" type="xsd:NCName">
<xsd:annotation>
<xsd:documentation>The namespace prefix to use in generated code</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="schemaFilename" type="xsd:string">
<xsd:annotation>
<xsd:documentation>The filename to use in generated schema</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="schemaLocation" type="xsd:string">
<xsd:annotation>
<xsd:documentation>The location to use in generated schema</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="TypeMapping">
<xsd:annotation>
<xsd:documentation>This allows a type from a model to be mapped onto an exiting rather than a generated type.
In general it must be used to map primitive types to various languages, but it can also be used for dataTypes.</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="vodml-id" type="xsd:string" minOccurs="1" />
<xsd:element name="java-type" type="JavaMapping" minOccurs="0" />
<xsd:element name="python-type" type="PythonMapping" minOccurs="0" />
<xsd:element name="xsd-type" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Maps to XSD predefined type such as xsd:string etc. SHould NOT have 'xsd' or 'xs' prefix, this must be
supplied by generator.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="json-type" type="JsonMapping" maxOccurs="1" minOccurs="0"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="JavaName">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[\w\-\d]{1}\w*(.[\w\-\d]{1}\w*)*">
<xsd:annotation>
<xsd:documentation>
TBD is this correct pattern for Java Package *and* class names?
</xsd:documentation>
</xsd:annotation>
</xsd:pattern>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="PythonName">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[\w\-\d]{1}\w*(.[\w\-\d]{1}\w*)*">
<xsd:annotation>
<xsd:documentation>
TBD is this correct pattern for Python Package *and* class names?
</xsd:documentation>
</xsd:annotation>
</xsd:pattern>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="JavaMapping">
<xsd:annotation>
<xsd:documentation>the java mapping for a type - the type should be resolveable without needing an import statement.</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="JavaName">
<xsd:attribute name="jpa-atomic" type="xsd:boolean" default="false">
<xsd:annotation>
<xsd:documentation>if this is true the type is atomic for JPA (does not appear in persistence.xml)</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="primitive-value-field" type="xsd:string" >
<xsd:annotation>
<xsd:documentation>if a mapped primitive does not map to a java primitive, then this specifies what the value fieldname is</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:complexType name="PythonMapping">
<xsd:annotation>
<xsd:documentation>the python mapping for a type</xsd:documentation>
</xsd:annotation>
<xsd:simpleContent>
<xsd:extension base="PythonName">
<xsd:attribute name="built-in" type="xsd:boolean" default="false">
<xsd:annotation>
<xsd:documentation>if this is true the type is a python built-in type and so does not need a import</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:element name="mappedModels" type="MappedModels">
<xsd:annotation>
<xsd:documentation>The list of mapped models - The tooling allows for each model to have its own binding file or for multiple models to have binding customization in a single file
</xsd:documentation>
</xsd:annotation></xsd:element>
<xsd:complexType name="TypeDetail">
<xsd:annotation>
<xsd:documentation>An eclectic mixture of possible mapping customizations.</xsd:documentation>
</xsd:annotation>
<xsd:all>
<xsd:element name="isAttribute" maxOccurs="1" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
is an attribute in the XML serialization - the default is for it to be represented as an element if this emply type is not present.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType></xsd:complexType>
</xsd:element>
<xsd:element name="length" type="xsd:string" maxOccurs="1" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
The length of the model element - arguably this really should be some sort of constraint in the model itsellf
- it has been included here as an intermediate measure whilst a constraint system is better specified.
</xsd:documentation>
</xsd:annotation>
</xsd:element></xsd:all>
<xsd:attribute name="vodml-id" type="xsd:string"></xsd:attribute>
</xsd:complexType>
<xsd:complexType name="JsonMapping">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="format" type="xsd:string" use="optional"></xsd:attribute>
<xsd:attribute name="built-in" type="xsd:boolean" use="optional" default="false">
<xsd:annotation>
<xsd:documentation>whether the type is a JSON built-in type
IMPL - this could be put into the code - especially as the number of JSON built-in types is small</xsd:documentation>
</xsd:annotation></xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<xsd:simpleType name="NewSimpleType">
<xsd:restriction base="xsd:string"></xsd:restriction>
</xsd:simpleType>
</xsd:schema>