30 | | Adding annotation with the target sources which are not yet in DB needs special treatment. Two options seem reasonable. |
31 | | |
32 | | 1) See [source:DASISH/t5.6/docs/XMLandXSD/DASISH-schema.xsd DASISH-xsd]. |
| 32 | === Handling new (not yet in the DB sources) === |
| 33 | |
| 34 | Adding annotation with the target sources which are not yet in DB needs special treatment. It becomes clear when the POST body for a new annotation must be serialized. Two approaches seem to be plausible. |
| 35 | |
| 36 | 1) A "strongly-typed" schema. An annotation contain a list of elements-"targets". Each of them can be either source element or a new-source element. It is implemented using xs:choice construct for elements. A source and new-source element differs by one attribute: a source has obligatory "ref" attribute, and a new source has an obligatory "xml:id" attribute. |
| 37 | |
| 38 | See [source:DASISH/t5.6/docs/XMLandXSD/DASISH-schema.xsd DASISH-xsd]. |
| 39 | |
| 40 | 2) A "weakly-typed" schema. An annotation contain a list of elements-"targets", which are the same elements, which have two non-obligatory attributes, "ref" and "xml:id". The type-checking "''at least one of the attributes is present and they are mutually exclusive''" may be left later to schematron or so. |
| 41 | |
| 42 | See [source:DASISH/t5.6/docs/XMLandXSD/DASISH-schema-alternative.xsd DASISH-alternative-xsd]. |
| 43 | |
| 44 | Olha: personally I'm pro first "strongly-typed" version, because the second schema allows to validate sence-less xmls. |