source: DASISH/t5.6/docs/XMLandXSD/DASISH-schema.xsd @ 2889

Last change on this file since 2889 was 2889, checked in by olhsha, 11 years ago

adjusting the schema

File size: 16.5 KB
Line 
1<?xml version="1.1" encoding="UTF-8"?>
2<xs:schema targetNamespace="http://www.dasish.eu/ns/addit"
3    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.dasish.eu/ns/addit"
4    elementFormDefault="qualified">
5    <xs:import namespace="http://www.w3.org/XML/1998/namespace"
6        schemaLocation="http://www.w3.org/2005/08/xml.xsd"/>
7
8
9    <!--////////////////////////////////////////////////////-->
10    <!-- Annotation-body types according to the UML diagram -->
11
12    <!-- DASISH resources (cached representations, sources, users, annotations, notebooks) have an obligatory URIdasih element-->
13    <!-- The integrity of the references must be forced via the backend -->
14
15
16
17    <xs:complexType name="ResourceREF">
18        <xs:attribute name="ref" type="xs:anyURI" use="required"/>
19    </xs:complexType>
20
21
22    <!--////////////////////////-->
23    <!--Cached representations -->
24
25    <xs:complexType name="CachedRepresentation">
26        <xs:attribute name="URI" type="xs:anyURI" use="required"/>
27        <xs:attribute name="mimeType" type="xs:string" use="required"/>
28        <xs:attribute name="tool" type="xs:string" use="required"/>
29        <xs:attribute name="type" type="xs:string" use="required"/>
30    </xs:complexType>
31
32
33    <xs:complexType name="CachedRepresentations">
34        <xs:sequence>
35            <xs:element name="cachedRepresentation" type="ResourceREF" maxOccurs="unbounded"/>
36        </xs:sequence>
37    </xs:complexType>
38   
39    <!-- //////////////////////// -->
40    <!-- Version lists -->
41   
42    <xs:complexType name="Versions">
43        <xs:sequence>
44            <xs:element name="version" type="Version" minOccurs="1" maxOccurs="unbounded"/>
45        </xs:sequence>       
46        <xs:attribute name="URI" type="xs:anyURI" use="required"/>
47    </xs:complexType>
48
49
50    <xs:complexType name="Version">
51        <xs:sequence>
52            <xs:element name="version" type="xs:string"/>
53            <xs:element name="cachedRepresentations" type="CachedRepresentations"/>
54        </xs:sequence>
55    </xs:complexType>
56   
57
58    <!--////////////////////////////-->
59    <!-- Sources (== Targets in OA) -->
60
61
62    <xs:complexType name="Source">
63        <xs:sequence>
64            <xs:element name="versions-siblings" type="ResourceREF" minOccurs="1"/>
65        </xs:sequence>
66        <xs:attribute name="URI" type="xs:anyURI" use="required"/>
67        <xs:attribute name="timeSatmp" type="xs:dateTime" use="required"/>
68        <xs:attribute name="link" type="xs:anyURI" use="required"/>
69        <xs:attribute name="version" type="xs:string" use="required"/>
70    </xs:complexType>
71
72
73    <xs:complexType name="Sources">
74        <xs:sequence>
75            <xs:element name="targetSource" type="ResourceREF" minOccurs="1" maxOccurs="unbounded"/>
76        </xs:sequence>
77    </xs:complexType>
78
79
80    <xs:complexType name="SourceInfo">
81        <xs:complexContent>
82            <xs:extension base="ResourceREF">
83                <xs:sequence>
84                    <xs:element name="link" type="xs:anyURI" minOccurs="1" maxOccurs="1"/>
85                    <xs:element name="version" type="xs:string" minOccurs="1" maxOccurs="1"/>
86                </xs:sequence>
87            </xs:extension>
88        </xs:complexContent>
89    </xs:complexType>
90
91    <xs:complexType name="SourceInfos">
92        <xs:sequence>
93            <xs:element name="targetSource" type="SourceInfo" minOccurs="1" maxOccurs="unbounded"/>
94        </xs:sequence>
95    </xs:complexType>
96
97
98
99    <!-- News sources, new/old sources  -->
100
101    <xs:complexType name="NewSourceInfo">
102        <xs:sequence>
103            <xs:element name="link" type="xs:anyURI" minOccurs="1" maxOccurs="1"/>
104            <xs:element name="version" type="xs:string" minOccurs="1" maxOccurs="1"/>
105        </xs:sequence>
106        <xs:attribute ref="xml:id" use="required"/>
107    </xs:complexType>
108
109    <xs:complexType name="NewOrExistingSourceInfo">
110        <xs:choice>
111            <xs:element name="source" type="SourceInfo"/>
112            <xs:element name="newSource" type="NewSourceInfo"/>
113        </xs:choice>
114    </xs:complexType>
115
116
117    <xs:complexType name="NewOrExistingSourceInfos">
118        <xs:sequence>
119            <xs:element name="target" type="NewOrExistingSourceInfo" minOccurs="1"
120                maxOccurs="unbounded"/>
121        </xs:sequence>
122    </xs:complexType>
123
124    <!--////////////////////////////-->
125    <!-- Users -->
126
127    <xs:complexType name="User">
128        <xs:sequence>
129            <xs:element name="additionalInfo">
130                <xs:complexType>
131                    <xs:sequence>
132                        <xs:any processContents="lax" maxOccurs="unbounded"/>
133                    </xs:sequence>
134                    <xs:anyAttribute processContents="lax"/>
135                </xs:complexType>
136            </xs:element>
137        </xs:sequence>
138        <xs:attribute name="URI" type="xs:anyURI" use="required"/>
139        <xs:attribute name="displayName" type="xs:string" use="required"/>
140        <xs:attribute name="eMail" type="xs:string" use="required"/>
141    </xs:complexType>
142
143    <!-- TODO: make a type for e-mail string -->
144
145    <xs:complexType name="Users">
146        <xs:sequence>
147            <xs:element name="user" type="ResourceREF" maxOccurs="unbounded"/>
148        </xs:sequence>
149    </xs:complexType>
150
151
152    <xs:complexType name="UserInfo">
153        <xs:complexContent>
154            <xs:extension base="ResourceREF">
155                <xs:attribute name="displayName" type="xs:string" use="required"/>
156                <xs:attribute name="eMail" type="xs:string" use="required"/>
157            </xs:extension>
158        </xs:complexContent>
159    </xs:complexType>
160
161
162    <xs:complexType name="UserInfos">
163        <xs:sequence>
164            <xs:element name="user" type="UserInfo" maxOccurs="unbounded"/>
165        </xs:sequence>
166    </xs:complexType>
167
168    <xs:complexType name="CurrentUserInfo">
169        <xs:complexContent>
170            <xs:extension base="ResourceREF">
171                <xs:attribute name="currentUser" type="xs:boolean" use="required"/>
172            </xs:extension>
173        </xs:complexContent>
174    </xs:complexType>
175
176    <!--////////////////////////////-->
177    <!-- permission lists -->
178
179    <xs:simpleType name="Permission">
180        <xs:restriction base="xs:string">
181            <xs:enumeration value="owner"/>
182            <xs:enumeration value="reader"/>
183            <xs:enumeration value="writer"/>
184        </xs:restriction>
185    </xs:simpleType>
186
187    <xs:complexType name="UserWithPermission">
188        <xs:complexContent>
189            <xs:extension base="ResourceREF">
190                <xs:attribute name="permission" type="Permission" use="required"/>
191            </xs:extension>
192        </xs:complexContent>
193    </xs:complexType>
194
195    <xs:complexType name="PermissionList">
196        <xs:sequence>
197            <xs:element name="user" type="UserWithPermission" minOccurs="1" maxOccurs="unbounded"/>
198        </xs:sequence>
199    </xs:complexType>
200
201    <!-- no permission-list info required so far, it is just a list -->
202
203    <!--////////////////////////////-->
204    <!-- Annotation -->
205
206    <xs:complexType name="Annotation">
207        <xs:sequence>
208            <xs:element name="owner" type="ResourceREF" minOccurs="1"/>
209            <xs:element name="headline" type="xs:string" minOccurs="1"/>
210            <!-- schematron checks the length <== 100 -->
211            <xs:element name="body" type="AnnotationBody" minOccurs="1"/>
212            <xs:element name="targetSources" type="NewOrExistingSourceInfos" minOccurs="1"/>
213            <xs:element name="permissions" type="ResourceREF"/>
214        </xs:sequence>
215        <xs:attribute name="URI" type="xs:anyURI" use="required"/>
216        <xs:attribute name="timeStamp" type="xs:dateTime" use="required"/>
217    </xs:complexType>
218
219
220    <xs:complexType name="Annotations">
221        <xs:sequence>
222            <xs:element name="annotation" type="ResourceREF" minOccurs="1" maxOccurs="unbounded"/>
223        </xs:sequence>
224    </xs:complexType>
225
226    <xs:complexType name="AnnotationInfo">
227        <xs:complexContent>
228            <xs:extension base="ResourceREF">
229                <xs:sequence>
230                    <xs:element name="owner" type="ResourceREF" minOccurs="1" maxOccurs="1"/>
231                    <xs:element name="headline" type="xs:string" minOccurs="1" maxOccurs="1"/>
232                    <xs:element name="targetSources" type="Sources" minOccurs="1" maxOccurs="1"/>
233                </xs:sequence>
234            </xs:extension>
235        </xs:complexContent>
236    </xs:complexType>
237
238    <xs:complexType name="AnnotationInfos">
239        <xs:sequence>
240            <xs:element name="annotation" type="AnnotationInfo" maxOccurs="unbounded"/>
241        </xs:sequence>
242    </xs:complexType>
243
244    <xs:complexType name="AnnotationBody">
245        <xs:sequence>
246            <xs:any processContents="lax" maxOccurs="unbounded"/>
247        </xs:sequence>
248        <xs:anyAttribute processContents="lax"/>
249    </xs:complexType>
250
251
252
253    <!--////////////////////////////-->
254    <!-- Notebook -->
255
256    <xs:complexType name="Notebook">
257        <xs:sequence>
258            <xs:element name="title" type="xs:string"/>
259            <xs:element name="annotations" type="Annotations"/>
260            <xs:element name="permissions" type="ResourceREF"/>
261        </xs:sequence>
262        <xs:attribute name="URI" type="xs:anyURI"/>
263        <xs:attribute name="timeStamp" type="xs:dateTime" use="required"/>
264    </xs:complexType>
265
266
267    <xs:complexType name="Notebooks">
268        <xs:sequence>
269            <xs:element name="notebook" type="ResourceREF" minOccurs="1" maxOccurs="unbounded"/>
270        </xs:sequence>
271    </xs:complexType>
272
273    <xs:complexType name="NotebookInfo">
274        <xs:complexContent>
275            <xs:extension base="ResourceREF">
276                <xs:sequence>
277                    <xs:element name="title" type="xs:string"/>
278                </xs:sequence>
279            </xs:extension>
280        </xs:complexContent>
281    </xs:complexType>
282
283    <xs:complexType name="NotebookInfos">
284        <xs:sequence>
285            <xs:element name="notebook" type="NotebookInfo" maxOccurs="unbounded"/>
286        </xs:sequence>
287    </xs:complexType>
288
289    <!--- Actions (not a resource; used in the POST/PUT response envelope)-->
290
291    <xs:simpleType name="AnnotationActionName">
292        <xs:restriction base="xs:string">
293            <xs:enumeration value="CREATE_CACHED_REPRESENTATION"/>
294        </xs:restriction>
295    </xs:simpleType>
296   
297    <xs:simpleType name="PermissionActionName">
298        <xs:restriction base="xs:string">
299            <xs:enumeration value="PROVIDE_USER_INFO"/>
300        </xs:restriction>
301    </xs:simpleType>
302   
303    <xs:complexType name="BaseAction">
304        <xs:attribute name="object" type="xs:anyURI"/>
305        <xs:attribute name="message" type="xs:string"/>
306    </xs:complexType>
307   
308
309    <xs:complexType name="AnnotationAction">
310        <xs:complexContent>
311        <xs:extension base="BaseAction">
312           <xs:attribute name="action" type="AnnotationActionName" use="required"/>
313        </xs:extension>
314        </xs:complexContent>
315    </xs:complexType>
316
317    <xs:complexType name="PermissionAction">
318        <xs:complexContent>
319            <xs:extension base="BaseAction">
320                <xs:attribute name="action" type="PermissionActionName" use="required"/>
321            </xs:extension>
322        </xs:complexContent>
323    </xs:complexType>
324
325    <xs:complexType name="AnnotationActionList">
326        <xs:sequence>
327            <xs:element name="action" type="AnnotationAction" minOccurs="0"/>
328        </xs:sequence>
329    </xs:complexType>
330   
331    <xs:complexType name="PermissionActionList">
332        <xs:sequence>
333            <xs:element name="action" type="PermissionAction" minOccurs="0"/>
334        </xs:sequence>
335    </xs:complexType>
336   
337
338    <!-- response envelope (not a resource, used for all response on POST/PUT requests) -->
339
340    <!-- "envelope"-->
341    <xs:complexType name="ResponseBody">
342        <xs:choice>
343            <xs:element name="annotationResponse" type="AnnotationResponseBody"/>
344            <xs:element name="permissionResponse" type="PermissionResponseBody"/>
345        </xs:choice>
346    </xs:complexType>
347   
348    <xs:complexType name="AnnotationResponseBody">
349        <xs:sequence>               
350            <xs:element name="content" type="AnnotationResponseContent" minOccurs="1" maxOccurs="1"/>
351            <xs:element name="actions" type="AnnotationActionList" minOccurs="1" maxOccurs="1"/>
352        </xs:sequence>
353    </xs:complexType>
354
355    <!-- above: consistency check is left to "schematron":
356        it has to check if the list objects for CREATE_CACHED_REPRESENTATION(s) conisides with unresolved targets in the content element-annotation
357        the same for permission lists
358    -->
359   
360    <xs:complexType name="PermissionResponseBody">
361        <xs:sequence>               
362            <xs:element name="content" type="PermissionResponseContent" minOccurs="1" maxOccurs="1"/>
363            <xs:element name="actions" type="PermissionActionList" minOccurs="1" maxOccurs="1"/>
364        </xs:sequence>
365    </xs:complexType>
366   
367
368    <xs:complexType name="AnnotationResponseContent">
369        <xs:choice>
370            <xs:element name="annotation" type="Annotation"/>
371        </xs:choice>
372    </xs:complexType>
373
374   
375    <xs:complexType name="PermissionResponseContent">
376        <xs:choice>
377            <xs:element name="permissions" type="PermissionList"/>
378        </xs:choice>
379    </xs:complexType>
380
381    <!--/////////////////////////////////////-->
382    <!-- GET api/user/uid respond -->
383    <xs:element name="currentUserInfo" type="CurrentUserInfo"/>
384
385    <!--/////////////////////////////////////-->
386    <!-- GET api/annotations?source="http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"&access=read  respond -->
387    <xs:element name="annotations" type="AnnotationInfos"/>
388
389
390    <!--/////////////////////////////////////-->
391    <!-- GET api/annotations/AIDzzz  resolvable  -->
392    <!--  GET api/annotations/AID0xyy unresolvable target sources, step 1-->
393    <xs:element name="annotation" type="Annotation"/>
394
395    <!--/////////////////////////////////////-->
396    <!--  GET api/sources/SID0xyz/  unresolvable target sources, step 2  -->
397    <xs:element name="source" type="Source"/>
398   
399    <!--/////////////////////////////////////-->
400    <!--  GET api/versions/VIDaacc  unresolvable target sources, step 3  -->
401    <xs:element name="versions" type="Versions"/>
402   
403
404    <!--/////////////////////////////////////-->
405    <!-- GET api/sources/SID05/cached/CID0efef/metadata (unresolvable target sources step, 4)   -->
406    <xs:element name="cashedRepresentation" type="CachedRepresentation"/>
407
408    <!--/////////////////////////////////////-->
409    <!-- POST api/annotation   -->
410    <!-- request body -->
411    <xs:element name="newAnnotation" type="Annotation"/>
412   
413    <!-- respond -->
414    <xs:element name="respondNewAnnotation" type="ResponseBody"/>
415
416    <!--///////////////////////////////////-->
417    <!-- PUT api/annotations/<aid> -->
418   
419    <!-- Body of the request -->
420    <xs:element name="newBody" type="AnnotationBody"/>
421    <!-- Body of the respond -->
422    <xs:element name="respondNewAnnotationBody" type="ResponseBody"/>
423   
424   
425    <!-- GET api/annotations/<aid>/permissions -->
426
427    <xs:element name="permissions" type="PermissionList"/>
428
429   
430   
431    <!--///////////////////////////////////-->
432    <!-- GET api/users/info?email="xx@mpi.nl" -->
433    <xs:element name="user" type="UserInfo"/>
434   
435    <!--///////////////////////////////////-->
436    <!-- PUT api/annotations/<aid>/permissions -->
437    <!-- request body -->
438    <!--  permissions element-->
439   
440    <!--///////////////////////////////////-->
441    <!-- PUT api/annotations/<aid>/permissions/<uid>-->   
442    <!-- request body  -->   
443    <xs:element name="accessLevel" type="Permission"/>   
444    <!-- request response: no body, just http status  -->
445   
446    <!--/////////////////////////////////// -->
447    <!--remove a user from the permission list-->
448    <!-- DELETE api/annotations/<aid>/permissions/<uid> -->
449    <!-- request response: no body, just http status  -->
450   
451    <!--/////////////////////////////////// -->
452    <!--remove an annotation from the DB-->
453    <!-- DELETE api/annotations/<aid> -->
454    <!-- request response: no body, just http status  -->
455   
456    <!--/////////////////////////////////// -->
457    <!--  GET api/notebooks -->
458    <xs:element name="notebooks" type="NotebookInfos"/>
459   
460    <!--/////////////////////////////////// -->
461    <!--  GET api/notebooks/<nid> -->
462    <xs:element name="notebook" type="NotebookInfo"/>
463   
464    <!--/////////////////////////////////// -->
465    <!--  GET api/notebooks/<nid>/annotations -->
466    <!-- annotations element -->
467   
468    <!--/////////////////////////////////// -->
469    <!--  PUT api/notebooks/<nid>/<aid> -->
470    <!-- empty request body -->
471    <!-- empty response body, only http status -->
472   
473</xs:schema>
474
Note: See TracBrowser for help on using the repository browser.