Changes between Version 48 and Version 49 of DASISH/XSD and XML


Ignore:
Timestamp:
05/14/13 12:02:16 (11 years ago)
Author:
olhsha
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DASISH/XSD and XML

    v48 v49  
    1818The xsd schema is designed according to the following paradigm:
    1919
    20 -- There are five xsd-types corresponding to five sorts of resources in DASISH: {{{CachedRepresentation}}}, {{{Source}}}, {{{User}}}, {{{Annotation}}}, {{{Notebook}}}.
     20-- There are 6 xsd-types corresponding to five sorts of resources in DASISH: {{{CachedRepresentation}}}, {{{Source}}}, {{{User}}}, {{{Annotation}}}, {{{Notebook}}}., {{{Lists of Permissions}}}.
    2121
    2222--  Each of these types has an obligatory attribute "URI" which contains DASISH identifier pointing to the location of the resource on the DASISH server.
    2323
    24 -- There are five lists-of-reference types: {{{CachedRepresentations}}}, {{{Sources}}}, {{{Users}}}, {{{Annotations}}}, {{{Notebooks}}}. Their names are just plural English forms of the corresponding types. 
    25 
    26 -- There are corresponding resource-info types:  {{{SourceInfo}}}, {{{UserInfo}}}, {{{AnnotationInfo}}}, {{{NotebookInfo}}}. They contain reference to the corresponding resource plus the most important information about the resource. We have not introduced the info-type for Cached representations because there is no actual need for it and the type itself not that big.
     24-- There are corresponding lists-of-reference types: {{{CachedRepresentations}}}, {{{Sources}}}, {{{Users}}}, {{{Annotations}}}, {{{Notebooks}}}. Their names are just plural English forms of the corresponding types. 
     25
     26-- There are corresponding resource-info types:  {{{SourceInfo}}}, {{{UserInfo}}}, {{{AnnotationInfo}}}, {{{NotebookInfo}}}. They contain reference to the corresponding resource plus the most important information about the resource. We have not introduced the info-type for Cached representations because there is no actual need for it and the type itself not that big. There is no info version of a list of permission either.
    2727
    2828-- There are  corresponding list-of-resource-info types:  {{{SourceInfos}}}, {{{UserInfos}}}, {{{AnnotationInfos}}},{{{NotebookInfos}}}.
     
    3232=== Handling new (not yet in the DB) sources ===
    3333
    34 Adding annotation with the target sources which are not yet in the DB needs special treatment. It becomes clear when the POST body for a new annotation must be serialized. Two approaches seem to be plausible.
     34Adding annotation with the target sources which are not yet in the DB needs special treatment. It becomes clear when the POST body for a new annotation must be serialized. Two approaches seem to be plausible. We will follow the FIRST option.
    3535
    36361) A "strongly-typed" schema. An annotation contains a list of elements-"targets". Each of them can be  either a source element or a new-source element. It is implemented using xs:choice construct for elements. A source and a new-source element differs by one attribute: a source has obligatory "ref" attribute, and a new source has an obligatory "xml:id" attribute.
     
    4242See [source:DASISH/t5.6/docs/XMLandXSD/DASISH-schema-alternative.xsd DASISH-alternative-xsd].
    4343
    44 Olha: personally I'm pro first "strongly-typed" version, because the second schema allows to validate senseless xmls. However, the serializations compliant with the weakly-typed schema look better because they have 1 level of elements less.
     44The reference to the second, "weakly-typed",  version of the XSD-schema is left for the reference, however it is not maintained any more.
    4545
    4646
     
    6868{{{#!xml
    6969<?xml version="1.0" encoding="UTF-8"?>
     70<!-- list of annotation-infos -->
    7071<annotations xmlns="http://www.dasish.eu/ns/addit"
    7172 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     
    101102== Responding GET api/annotations/AIDzzz (example of resolvable target sources) ==
    102103
    103 The serialization compliant with the strongly-typed schema:
    104 
    105 {{{#!xml
    106 ?xml version="1.0" encoding="UTF-8"?>
     104
     105{{{#!xml
     106<?xml version="1.0" encoding="UTF-8"?>
     107<!-- annotation as it is presented in the DB;
     108    (also sent in the respond envelope after creating/updating an annotation,
     109    if its targets  are resolved) -->
    107110<annotation xmlns="http://www.dasish.eu/ns/addit"
    108111    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     
    130133        </target>
    131134    </targetSources>
    132     <readers>
    133         <reader ref="http://dasish.eu/users/UIde1fe1f"/>
    134         <reader ref="http://dasish.eu/users/UIdefef"/>
    135         <reader ref="http://dasish.eu/users/UIdefff"/>
    136     </readers>
    137     <writers>
    138         <writer ref="http://dasish.eu/users/UIde1fe1f"/>
    139         <writer ref="http://dasish.eu/users/UIdefef"/>
    140     </writers>
    141 </annotation>
    142 }}}
    143 
    144 The serialization compliant with the weakly-typed schema:
    145 
    146 {{{#!xml
    147 <?xml version="1.0" encoding="UTF-8"?>
    148 <annotation xmlns="http://www.dasish.eu/ns/addit"
    149     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    150     xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd"
    151     URI="http://dasish/annotations/AIDzzz" timeStamp="2013-05-04T18:13:51.0Z">
    152     <owner ref="http://dasish.eu/users/UIde1fe1f"/>
    153     <headline>Nativity Facade</headline>
    154     <body type="relation">
    155         <relation>different</relation>
    156         <this ref="http://dasish.eu/sources/SIDaacc"/>
    157         <that ref="http://dasish.eu/sources/SIDaaaa"/>
    158     </body>
    159     <targetSources>
    160         <targetSource ref="http://dasish.eu/sources/SIDaacc">
    161                 <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#Nativity_Fa.C3.A7ade</link>
    162                 <version>20.04.2013</version>
    163         </targetSource>
    164         <targetSource ref="http://dasish.eu/sources/SIDaaaa">
    165                 <link>http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#Passion_Fa.C3.A7ade</link>
    166                 <version>20.04.2013</version>
    167         </targetSource>
    168     </targetSources>
    169     <readers>
    170         <reader ref="http://dasish.eu/users/UIde1fe1f"/>
    171         <reader ref="http://dasish.eu/users/UIdefef"/>
    172         <reader ref="http://dasish.eu/users/UIdefff"/>
    173     </readers>
    174     <writers>
    175         <writer ref="http://dasish.eu/users/UIde1fe1f"/>
    176         <writer ref="http://dasish.eu/users/UIdefef"/>
    177     </writers>
    178 </annotation>
    179 }}}
     135    <permissions ref="http://dasish.eu/permissions/PermissionsListIDefef"/>
     136</annotation>
     137}}}
     138
    180139
    181140== Responding GET api/annotations/AIDzyy (example usage for unresolvable target sources) ==