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

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

little-bug fixing

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