{{{ #!html

Contents

}}} [[PageOutline(1-3, , inline)]] {{{ #!comment Obviously, your page starts below this block }}} = XSD Schema = == Preamble == The xsd schema is designed according to the following paradigm: -- There are five xsd-types corresponding to five sorts of resources in DASISH: {{{CachedRepresentation}}}, {{{Source}}}, {{{User}}}, {{{Annotation}}}, {{{Notebook}}}. -- Each of these types has an obligatory attribute "URI" which contains DASISH identifier pointing to the location of the resource on the DASISH server. -- There are five lists-of-reference types: {{{CachedRepresentations}}}, {{{Sources}}}, {{{Users}}}, {{{Annotations}}}, {{{Notebooks}}}. Their names are just plural English forms of the corresponding types. -- 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 are corresponding list-of-resource-info types: {{{SourceInfos}}}, {{{UserInfos}}}, {{{AnnotationInfos}}},{{{NotebookInfos}}}. There is a number of auxiliary types as well. A commonly-used one is ResourceREF which contains the attribute "ref" of type {{{xs:anyURI}}}. It allows to have announce elements-references and avoid mixing-them-up with elements-resources, without adding REF to the name. For instance {{{}}}. === Handling new (not yet in the DB) sources === 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. 1) 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. See [source:DASISH/t5.6/docs/XMLandXSD/DASISH-schema.xsd DASISH-xsd]. 2) A "weakly-typed" schema. An annotation contain a list of elements-"targets" of the same type that contains 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 for later to schematron or so. See [source:DASISH/t5.6/docs/XMLandXSD/DASISH-schema-alternative.xsd DASISH-alternative-xsd]. 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. = Scenario XML's validated vs the given schema = See [[DASISH/Scenario]] == Responding GET api/user/uid == {{{#!xml }}} == Responding GET api/annotations?link="http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"&access=read == The root element below is of type {{{AnnotationInfos}}} (the list of {{{AnnotationInfo}}}). {{{#!xml My client is not in a hurry Nativity Facade Nativity Facade (old site) }}} == Responding GET api/annotations/AIDzzz (example of resolvable target sources) == The serialization compliant with the strongly-typed schema: {{{#!xml ?xml version="1.0" encoding="UTF-8"?> Nativity Facade different http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#Nativity_Fa.C3.A7ade 20.04.2013 http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#Passion_Fa.C3.A7ade 20.04.2013 }}} The serialization compliant with the weakly-typed schema: {{{#!xml Nativity Facade different http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#Nativity_Fa.C3.A7ade 20.04.2013 http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#Passion_Fa.C3.A7ade 20.04.2013 }}} == Responding GET api/annotations/AIDzyy (example usage for unresolvable target sources) == The respond for an annotation with unresolved target sources and the respond for an annotation with resolved target sources (see above) are both instances of the same schema element. However, the annotation refers to an obsolete version of the page. Later, having the target source references, the client will ask for the cached representations of the obsolete web-page. The serialization compliant with the strongly-typed schema: {{{#!xml Nativity Facade (old page) different http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#Nativity_Fa.C3.A7ade 29.01.2010 http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#Passion_Fa.C3.A7ade 29.01.2010 }}} The serialization compliant with the weakly-typed schema: {{{#!xml Nativity Facade (old page) different http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#Nativity_Fa.C3.A7ade 29.01.2010 http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#Passion_Fa.C3.A7ade 29.01.2010 }}} == Responding GET api/sources/SIDbbb (example usage for unresolvable target sources) == {{{#!xml }}} === Remarks by Menzo === For very dynamic and popular target sources the version list might become big, that could be a reason to move it to a separate call. Actually we have already GET api/sources//versions, so I would leave them out here. === Olha's comment:=== We have agreed earlier that the list of versions would include all the "siblings", include the source itself.Are there alternative ways to get all the siblings of a given source? == Responding GET api/sources/SIDbbb/cached/CIDtttt/metadata (example usage for unresolvable target sources) == {{{#!xml }}} == Request body for POST api/annotations == The version of the POST with an unknown target source, signalling the client to provide a cached representation for it: '''TODO''': Action element is removed, instead note that we have to think about a solution, probably using an envelope with annotation result and set of action requests The serialization compliant with the strongly-typed schema: {{{#!xml Comapring English and Catalan Wiki History http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#History 20.04.2012 http://ca.wikipedia.org/wiki/Temple_Expiatori_de_la_Sagrada_Fam%C3%ADlia#Hist.C3.B2tia 20.04.2013 }}} The serialization compliant with the weakly-typed schema: {{{#!xml Comapring English and Catalan Wiki History http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#History 20.04.2012 http://ca.wikipedia.org/wiki/Temple_Expiatori_de_la_Sagrada_Fam%C3%ADlia#Hist.C3.B2tia 20.04.2013 }}} === Request body for POST api/annotations: another example === The serialization of the POST body for another example (UGOT) {{{!#xml Douglas Adams - Wikipedia, the free encyclopedia Adams was born 1952-03-11 http://en.wikipedia.org/wiki/Douglas_adams#xpointer(start-point(string-range(//div[@id="mw-content-text"]/table[1]/tbody[1]/tr[3]/td[1]/text()[1],'',12))/range-to(string-range(//div[@id="mw-content-text"]/table[1]/tbody[1]/tr[3]/td[1]/text()[1],'',25))) 2013-04-26T11:23:26.000Z }}} '''TODO''': POST response