wiki:DASISH/XSD and XML

Contents

  1. XSD Schema
    1. Preamble
  2. Scenario XML's validated vs the given schema
      1. GET api/principals/00000000-0000-0000-0000-000000000112
      2. GET api/principals/00000000-0000-0000-0000-0000000000112/current
      3. GET api/principals/info?email=twagoo@mpi.nl
    1. Retrieving annotations
      1. Responding GET api/annotations?link=Sagrada
      2. Responding GET api/annotations/00000000-0000-0000-0000-000000000021
      3. GET api/annotations/00000000-0000-0000-0000-000000000021/targets
      4. GET api/annotations/00000000-0000-0000-0000-000000000021/permissions
      5. GET api/targets/00000000-0000-0000-0000-000000000032
      6. GET api/targets/00000000-0000-0000-0000-000000000032/versions
      7. GET api/cached/00000000-0000-0000-0000-000000000051/metadata
      8. Responding GET api/annotations/00000000-0000-0000-0000-00000000002c (example usage for unresolvable targets, step 1)
      9. Responding GET api/targets/00000000-0000-0000-0000-00000000003c (unresolvable target sources , step 2; the same as for resolvable, just the link is broken or obsolete)
      10. Responding GET api/targets/00000000-0000-0000-0000-00000000003c/versions (unresolvable target sources, step 3)
      11. Responding GET api/cached/00000000-0000-0000-0000-000000000052/metadata (unresolvable target sources, step 5)
    2. Making a new annotation
      1. Request body for POST api/annotations
      2. Response body (envelope) for POST api/annotations
    3. Editing an annotation
      1. PUT api/annotations/1d02f393-da25-4246-934c-876222a2d7fb
      2. PUT api/annotations/1d02f393-da25-4246-934c-876222a2d7fb/body
      3. PUT api/annotations/1d02f393-da25-4246-934c-876222a2d7fb/permissions
      4. PUT api/annotations/1d02f393-da25-4246-934c-876222a2d7fb/permissions/00000000-0000-0000-0000-000000000114
    4. Managing Notebooks (obsolete section)
      1. GET api/notebooks
      2. GET api/notebooks/NIDxyxy
      3. GET api/notebooks/NIDxyxy/annotations/
  3. Issues with the schema
    1. Cached Representation BLOB

XSD Schema

Preamble

There are 5 sorts of resources in DASISH: CachedRepresentation, Target, Principal, Annotation, Notebook. Each of them has the corresponding xsd-type in the schema. There is no an xsd-schema with the name Cached representation because a cached representation is a "pure" resource like an image or a text file that does not contain any meta-information about itself. The metadata of a cached presentation are defined via an instance of CachedRepresentationInfo type.

Each of these 5 types has an obligatory attribute "URI" which contains DASISH identifier pointing to the location of the resource on the DASISH server.

Resource-info types TargetInfo, AnnotationInfo, NotebookInfo contain reference to the corresponding resource plus the most important information about the resource. There are corresponding list-of-resource-info types: TargetInfos, 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 declare elements-references and avoid mixing them with elements-resources.

The schema is located at DASISH-schema.

Scenario XML's validated vs the given schema

See DASISH/Scenario

GET api/principals/00000000-0000-0000-0000-000000000112

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<principal xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
URI="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" 
xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <displayName>Peter</displayName>
    <eMail>Peter.Withers@mpi.nl</eMail>
</principal

GET api/principals/00000000-0000-0000-0000-0000000000112/current

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<currentPrincipalInfo xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
ref="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" 
xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <currentPrincipal>false</currentPrincipal>
</currentPrincipalInfo>

GET api/principals/info?email=twagoo@mpi.nl

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<principal xmlns="http://www.dasish.eu/ns/addit" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 URI="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000111" 
xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <displayName>Twan</displayName>
    <eMail>Twan.Goosen@mpi.nl</eMail>
</principal>

Retrieving annotations

Responding GET api/annotations?link=Sagrada

all annotations which annotating links containing "Sagrada"

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<annotationInfoList xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <annotationInfo ref="https://lux17.mpi.nl/ds/webannotator/api/annotations/00000000-0000-0000-0000-000000000021" ownerRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000111">
        <headline>Sagrada Famiglia</headline>
        <lastModified>2013-08-12T09:25:00.383Z</lastModified>
        <targets>
            <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000031</ref>
            <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000032</ref>
        </targets>
    </annotationInfo>
    <annotationInfo ref="https://lux17.mpi.nl/ds/webannotator/api/annotations/d658a511-f1c9-4203-8531-2351b0875c6e" ownerRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000113">
        <headline>Sagrada Família - Wikipedia, the free encyclopedia</headline>
        <lastModified>2014-04-01T14:06:04.328613Z</lastModified>
        <targets>
            <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/fa4bbfff-bca7-47cc-ab48-bb68fe943758</ref>
        </targets>
    </annotationInfo>
    <annotationInfo ref="https://lux17.mpi.nl/ds/webannotator/api/annotations/26d7254c-7cb6-4a12-b33b-47ba1769f165" ownerRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000113">
        <headline>de author van het idee</headline>
        <lastModified>2014-04-01T15:06:32.587747Z</lastModified>
        <targets>
            <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/d9651f71-42a6-455c-9609-ea856ac227e3</ref>
        </targets>
    </annotationInfo>
    <annotationInfo ref="https://lux17.mpi.nl/ds/webannotator/api/annotations/ceeb6a75-927f-4ffb-a7b9-af11a45beb78" ownerRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000113">
        <headline>Sagrada Família - Wikipedia</headline>
        <lastModified>2014-04-01T13:45:49.029405Z</lastModified>
        <targets>
            <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/9d645fa5-026d-49a7-885d-235a5ae8520d</ref>
        </targets>
    </annotationInfo>
</annotationInfoList>

Responding GET api/annotations/00000000-0000-0000-0000-000000000021

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<annotation xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
URI="https://lux17.mpi.nl/ds/webannotator/api/annotations/00000000-0000-0000-0000-000000000021" 
ownerRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000111" 
xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <headline>Sagrada Famiglia</headline>
    <lastModified>2013-08-12T09:25:00.383Z</lastModified>
    <body>
        <textBody>
            <mimeType>text/html</mimeType>
            <body>&lt;html&gt;&lt;body&gt;some html 1&lt;/body&gt;&lt;/html&gt;</body>
        </textBody>
    </body>
    <targets>
        <targetInfo ref="https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000031">
            <link>http://nl.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia#de_Opdracht</link>
            <version>version 1.0</version>
        </targetInfo>
        <targetInfo ref="https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000032">
            <link>http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD#Vroege_werk</link>
            <version>version 1.1</version>
        </targetInfo>
    </targets>
    <permissions public="write">
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" level="write"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000113" level="read"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000221" level="read"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/5c659602-b390-47fa-a762-0a5c1a0be52f" level="read"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/c620294a-dbdd-4198-aded-619026ee0513" level="read"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/f323d18d-3f86-4625-b47c-35844cedd59c" level="read"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/e1788887-50b4-40c2-94a9-98a662d3ef7d" level="read"/>
    </permissions>
</annotation>

GET api/annotations/00000000-0000-0000-0000-000000000021/targets

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<targetList xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000031</ref>
    <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000032</ref>
</targetList>

GET api/annotations/00000000-0000-0000-0000-000000000021/permissions

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<permissionList xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
public="write" 
xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" level="write"/>
    <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000113" level="read"/>
    <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000221" level="read"/>
    <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/5c659602-b390-47fa-a762-0a5c1a0be52f" level="read"/>
    <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/c620294a-dbdd-4198-aded-619026ee0513" level="read"/>
    <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/f323d18d-3f86-4625-b47c-35844cedd59c" level="read"/>
    <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/e1788887-50b4-40c2-94a9-98a662d3ef7d" level="read"/>
</permissionList>

GET api/targets/00000000-0000-0000-0000-000000000032

An unresolvable target obeys the same schema. A target becomes unresolvable if e.g. its link becomes obsolete or broken.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<target xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" URI="https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000032" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <lastModified>2014-03-13T09:52:51.004723Z</lastModified>
    <link>http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD#Vroege_werk</link>
    <version>version 1.1</version>
    <siblingTargets>
        <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000032</ref>
    </siblingTargets>
    <cachedRepresentatinons>
        <cached ref="https://lux17.mpi.nl/ds/webannotator/api/cached/00000000-0000-0000-0000-000000000052">
            <fragmentString>Vroeger Werk</fragmentString>
        </cached>
    </cachedRepresentatinons>
</target>

GET api/targets/00000000-0000-0000-0000-000000000032/versions

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<referenceList xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000032</ref>
    <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-00000000003c</ref>
</referenceList>

GET api/cached/00000000-0000-0000-0000-000000000051/metadata

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cashedRepresentationInfo xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" URI="https://lux17.mpi.nl/ds/webannotator/api/cached/00000000-0000-0000-0000-000000000051" 
xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <mimeType>image/png</mimeType>
    <tool>some tool 1</tool>
    <type>image</type>
</cashedRepresentationInfo>

Responding GET api/annotations/00000000-0000-0000-0000-00000000002c (example usage for unresolvable targets, step 1)

The respond for an annotation with unresolved targets and the respond for an annotation with resolved targets (see above) are both instances of the same schema element. However, one of the targets of the first annotations annotation refers e.g. to an obsolete version of the page. Next, having the target eferences, the client will ask for the source versions saved in the DB. The last step: having the info about the version under consideration, the client asks for cached representations of the version.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<annotation xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
URI="https://lux17.mpi.nl/ds/webannotator/api/annotations/00000000-0000-0000-0000-00000000002c" 
ownerRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000111"
 xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <headline>Sagrada Famiglia</headline>
    <lastModified>2013-08-12T09:25:00.383Z</lastModified>
    <body>
        <textBody>
            <mimeType>text/html</mimeType>
            <body>&lt;html&gt;&lt;body&gt;some html 1&lt;/body&gt;&lt;/html&gt;</body>
        </textBody>
    </body>
    <targets>
        <targetInfo ref="https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-00000000003c">
            <link>http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD#Vroege_werk_old</link>
            <version>version 1.1</version>
        </targetInfo>
    </targets>
    <permissions public="read">
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" level="write"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000113" level="read"/>
    </permissions>
</annotation>

Responding GET api/targets/00000000-0000-0000-0000-00000000003c (unresolvable target sources , step 2; the same as for resolvable, just the link is broken or obsolete)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<target xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
URI="https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000032" 
xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <lastModified>2012-03-13T09:52:51.004723Z</lastModified>
    <link>http://nl.wikipedia.org/wiki/Antoni_Gaud%C3%AD#Vroege_werk_old</link>
    <version>version 1.1</version>
    <siblingTargets>
        <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-00000000003c</ref>
        <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000032</ref>
    </siblingTargets>
    <cachedRepresentatinons>
        <cached ref="https://lux17.mpi.nl/ds/webannotator/api/cached/00000000-0000-0000-0000-000000000052">
            <fragmentString>Vroeger Werk</fragmentString>
        </cached>
    </cachedRepresentatinons>
</target>

Responding GET api/targets/00000000-0000-0000-0000-00000000003c/versions (unresolvable target sources, step 3)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<referenceList xmlns="http://www.dasish.eu/ns/addit" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-000000000032</ref>
    <ref>https://lux17.mpi.nl/ds/webannotator/api/targets/00000000-0000-0000-0000-00000000003c</ref>
</referenceList>

Responding GET api/cached/00000000-0000-0000-0000-000000000052/metadata (unresolvable target sources, step 5)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cashedRepresentationInfo xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" URI="https://lux17.mpi.nl/ds/webannotator/api/cached/00000000-0000-0000-0000-000000000052" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <mimeType>image/png</mimeType>
    <tool>some tool 2</tool>
    <type>image</type>
</cashedRepresentationInfo>

Making a new annotation

Request body for POST api/annotations

The new annotation URI, the owner reference will be replaced by the server. The new annotation URI is service URI + the UUID generated by the server. The owner reference is the service URI + logged-in user UUID.

The targets's URI will be replaced if the target is new (has not been presented in the dtatabase yet).

<?xml version="1.0" encoding="UTF-8"?>
<annotation xmlns="http://www.dasish.eu/ns/addit"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xhtml="http://www.w3.org/1999/xhtml/"
    xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd" 
    URI="xxx" 
    ownerRef="yyy">
    <headline>X-Pointer test annotation 6667</headline>
    <lastModified>2013-09-29T19:52:28.969+02:00</lastModified>
    <body>
        <xmlBody>
            <mimeType>application/xml+xhtml</mimeType>
            <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">X pointer experiment tmpTarget </xhtml:span>
        </xmlBody>
    </body>
    <targets>
        <targetInfo ref="tmpTarget">
            <link>https://developer.mozilla.org/en-US/docs/Building_an_Extension#xpointer(start-point(string-range(//h2[@id="Create_a_Chrome_Manifest"]/text()[1],'',0))/range-to(string-range(//h2[@id="Create_a_Chrome_Manifest"]/text()[1],'',24)))</link>
            <version>1.0</version>
        </targetInfo>      
    </targets>
    <permissions public="read">
        <permission level = "write" principalRef="http://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112"/>
        <permission level = "write" principalRef="http://lux17.mpi.nl/ds/webannotator/api/princiapls/00000000-0000-0000-0000-000000000111"/>
    </permissions>
</annotation>

Response body (envelope) for POST api/annotations

The temporary URIs/references are replaced with permanent references. However, no cahced representation is found for the target. Therefore, in the action part of the envelope there is an action CREATE_CACHED_REPRESENTATION for the object which is the target for the web-page.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<responseBody xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <annotation URI="http://lux17.mpi.nl/ds/webannotator/api/annotations/1d02f393-da25-4246-934c-876222a2d7fb" ownerRef="http://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000113">
        <headline>X-Pointer test annotation 6667</headline>
        <lastModified>2014-04-09T12:46:51.754226Z</lastModified>
        <body>
            <xmlBody>
                <mimeType>application/xml+xhtml</mimeType>
                <xhtml:span xmlns:xhtml="http://www.w3.org/1999/xhtml/" style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">X pointer experiment 1db0dbe6-ac89-4a4f-ac4c-c8ff764db232 </xhtml:span>
            </xmlBody>
        </body>
        <targets>
            <targetInfo ref="http://lux17.mpi.nl/ds/webannotator/api/targets/1db0dbe6-ac89-4a4f-ac4c-c8ff764db232">
                <link>https://developer.mozilla.org/en-US/docs/Building_an_Extension#xpointer(start-point(string-range(//h2[@id=&quot;Create_a_Chrome_Manifest&quot;]/text()[1],'',0))/range-to(string-range(//h2[@id=&quot;Create_a_Chrome_Manifest&quot;]/text()[1],'',24)))</link>
                <version>1.0</version>
            </targetInfo>
        </targets>
        <permissions public="read">
            <permission principalRef="http://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" level="write"/>
            <permission principalRef="http://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000111" level="write"/>
        </permissions>
    </annotation>
    <actionList>
        <action>
            <object>http://lux17.mpi.nl/ds/webannotator/api/targets/1db0dbe6-ac89-4a4f-ac4c-c8ff764db232</object>
            <message>CREATE_CACHED_REPRESENTATION</message>
        </action>
    </actionList>
</responseBody>

The client sends metadata cached representation in the POST body, and a cached representation itself. An example of serialized metadata for a cached representation has been considered above, so we do not give it here.

Editing an annotation

PUT api/annotations/1d02f393-da25-4246-934c-876222a2d7fb

Request body : an updated annotation

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<annotation xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
URI="https://lux17.mpi.nl/ds/webannotator/api/annotations/1d02f393-da25-4246-934c-876222a2d7fb" 
ownerRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000113" 
xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <headline>update X-Pointer test annotation 6667</headline>
    <lastModified>2014-04-09T12:46:51.754226Z</lastModified>
    <body>
        <xmlBody>
            <mimeType>application/xml+xhtml</mimeType>
            <xhtml:span xmlns:xhtml="http://www.w3.org/1999/xhtml/" style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">update X pointer experiment 1db0dbe6-ac89-4a4f-ac4c-c8ff764db232 </xhtml:span>
        </xmlBody>
    </body>
    <targets>
        <targetInfo ref="https://lux17.mpi.nl/ds/webannotator/api/targets/1db0dbe6-ac89-4a4f-ac4c-c8ff764db232">
            <link>https://developer.mozilla.org/en-US/docs/Building_an_Extension#xpointer(start-point(string-range(//h2[@id=&quot;Create_a_Chrome_Manifest&quot;]/text()[1],'',0))/range-to(string-range(//h2[@id=&quot;Create_a_Chrome_Manifest&quot;]/text()[1],'',24)))</link>
            <version>1.0</version>
        </targetInfo>
    </targets>
    <permissions public="none">
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" level="read"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000111" level="read"/>
    </permissions>
</annotation>

Enveloped respond containing new (updated) annotation and a list of actions:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<responseBody xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <annotation URI="https://lux17.mpi.nl/ds/webannotator/api/annotations/1d02f393-da25-4246-934c-876222a2d7fb" ownerRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000113">
        <headline>update X-Pointer test annotation 6667</headline>
        <lastModified>2014-04-09T12:58:32.793453Z</lastModified>
        <body>
            <xmlBody>
                <mimeType>application/xml+xhtml</mimeType>
                <xhtml:span xmlns:xhtml="http://www.w3.org/1999/xhtml/" style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">update X pointer experiment 1db0dbe6-ac89-4a4f-ac4c-c8ff764db232 </xhtml:span>
            </xmlBody>
        </body>
        <targets>
            <targetInfo ref="https://lux17.mpi.nl/ds/webannotator/api/targets/1db0dbe6-ac89-4a4f-ac4c-c8ff764db232">
                <link>https://developer.mozilla.org/en-US/docs/Building_an_Extension#xpointer(start-point(string-range(//h2[@id=&quot;Create_a_Chrome_Manifest&quot;]/text()[1],'',0))/range-to(string-range(//h2[@id=&quot;Create_a_Chrome_Manifest&quot;]/text()[1],'',24)))</link>
                <version>1.0</version>
            </targetInfo>
        </targets>
        <permissions public="none">
            <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" level="read"/>
            <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000111" level="read"/>
        </permissions>
    </annotation>
    <actionList>
        <action>
            <object>https://lux17.mpi.nl/ds/webannotator/api/targets/1db0dbe6-ac89-4a4f-ac4c-c8ff764db232</object>
            <message>CREATE_CACHED_REPRESENTATION</message>
        </action>
    </actionList>
</responseBody>

PUT api/annotations/1d02f393-da25-4246-934c-876222a2d7fb/body

Request body:

<?xml version="1.0" encoding="UTF-8"?>
<annotationBody xmlns="http://www.dasish.eu/ns/addit"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xhtml="http://www.w3.org/1999/xhtml/" 
    xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
        <xmlBody>
            <mimeType>application/xml+xhtml</mimeType>
            <xhtml:span style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">2 UPDATE X pointer experiment UPDATE body </xhtml:span>
      </xmlBody>

Response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<responseBody xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <annotation URI="https://lux17.mpi.nl/ds/webannotator/api/annotations/1d02f393-da25-4246-934c-876222a2d7fb" ownerRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000113">
        <headline>update X-Pointer test annotation 6667</headline>
        <lastModified>2014-04-09T13:01:21.900643Z</lastModified>
        <body>
            <xmlBody>
                <mimeType>application/xml+xhtml</mimeType>
                <xhtml:span xmlns:xhtml="http://www.w3.org/1999/xhtml/" style="background-color:rgb(0,0,153);color:rgb(255,255,255);border: thick solid rgb(0, 0, 153);">2 UPDATE X pointer experiment UPDATE body </xhtml:span>
            </xmlBody>
        </body>
        <targets>
            <targetInfo ref="https://lux17.mpi.nl/ds/webannotator/api/targets/1db0dbe6-ac89-4a4f-ac4c-c8ff764db232">
                <link>https://developer.mozilla.org/en-US/docs/Building_an_Extension#xpointer(start-point(string-range(//h2[@id=&quot;Create_a_Chrome_Manifest&quot;]/text()[1],'',0))/range-to(string-range(//h2[@id=&quot;Create_a_Chrome_Manifest&quot;]/text()[1],'',24)))</link>
                <version>1.0</version>
            </targetInfo>
        </targets>
        <permissions public="none">
            <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" level="read"/>
            <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000111" level="read"/>
        </permissions>
    </annotation>
    <actionList>
        <action>
            <object>https://lux17.mpi.nl/ds/webannotator/api/targets/1db0dbe6-ac89-4a4f-ac4c-c8ff764db232</object>
            <message>CREATE_CACHED_REPRESENTATION</message>
        </action>
    </actionList>
</responseBody>

PUT api/annotations/1d02f393-da25-4246-934c-876222a2d7fb/permissions

Supplementary updating the list of permissions in the annotation: if the principal is not listed in the permission of the annotation, it is added to the list of permissions, otherwise her/his access level is updated in the existing list.

Request body:

<?xml version="1.0" encoding="UTF-8"?>
<permissionList xmlns="http://www.dasish.eu/ns/addit"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.dasish.eu/ns/addit ttps://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd"
    public="none">
    <permission level="write" principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112"/>
    <permission level="read" principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000114"/>
</permissionList>

Respond

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<responseBody xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <permissions public="none">
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000111" level="read"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" level="write"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000114" level="read"/>
    </permissions>
    <actionList/>
</responseBody>

Now, assume that principal 00000000-0000-0000-0000-000000000114 is not known to the DASISH data base then respond bey would be:

Respond

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<responseBody xmlns="http://www.dasish.eu/ns/addit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">
    <permissions public="none">
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000111" level="read"/>
        <permission principalRef="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000112" level="write"/>
    </permissions>
    <actionList>
        <action message="PROVIDE_USER_INFO" object="https://lux17.mpi.nl/ds/webannotator/api/principals/00000000-0000-0000-0000-000000000114"/>
    </actionList>
    </responseBody>

PUT api/annotations/1d02f393-da25-4246-934c-876222a2d7fb/permissions/00000000-0000-0000-0000-000000000114

<?xml version="1.0" encoding="UTF-8"?>
<access xmlns="http://www.dasish.eu/ns/addit"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.dasish.eu/ns/addit http://www.dasish.eu/ns/addit https://svn.clarin.eu/DASISH/t5.6/schema/trunk/annotator-schema/src/main/resources/DASISH-schema.xsd">write</access>

Response: string "1 rows are updated/added".

Managing Notebooks (obsolete section)

GET api/notebooks

<?xml version="1.0" encoding="UTF-8"?>
<notebooks xmlns="http://www.dasish.eu/ns/addit"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.dasish.eu/ns/addit http://dasish.eu/DASISH-schema.xsd">
    <notebook ref="http://dasish.eu/notebooks/NIDxyxy">
        <title>Gaudi</title>
    </notebook>
    <notebook ref="http://dasish.eu/notebooks/NIDxefef">
        <title>Douglas Adams</title>
    </notebook>
</notebooks>

GET api/notebooks/NIDxyxy

<?xml version="1.0" encoding="UTF-8"?>
<notebook xmlns="http://www.dasish.eu/ns/addit"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.dasish.eu/ns/addit
 http://dasish.eu/DASISH-schema.xsd" 
 ref="http://dasish.eu/notebooks/NIDxyxy">
    <title>Gaudi</title>
</notebook>

GET api/notebooks/NIDxyxy/annotations/

Respond is a list of annotation info, is similar to the respond on

GET api/annotations?link="http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"&access=read.

Issues with the schema

As regards all future schema updates, please make sure to remember to update all available scenario xml documents on trac.clarin.eu accordingly, and preferably, with as little delay as possible. It might also be a good idea to validate all of these documents against the revised schema with a reliable XML parser like e.g. the Xerces-J XML parser. Also, if you like, you can check by validating some of our current "real-life" mock xml documents that we have been using for client development (DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks).

Cached Representation BLOB

For the back-end (and the database!): the cached representation for now is stored in the database as a BLOB. See: http://dba.stackexchange.com/questions/803/blobs-or-references-in-postgresql/815#815.

Last modified 10 years ago Last modified on 04/09/14 13:50:49