summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/annotation-model/definitions/annotations.json
blob: df1f73613ab1b574089568b0e02fc2db1808ad72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "annotations.json",
  "title": "Definitions: Annotations.",
  "description": "Schemas in #/definitions detect or validate keys/objects (direct children) uniquely used to describe Annotations (Section 3.1 and 3.3.5).",
  "definitions": {

    "contextValueFound": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Definition: Valid @context string",
      "description": "True when the string has value http://www.w3.org/ns/anno.jsonld (Section 3.1)",
      "type": "string",
      "enum": [ "http://www.w3.org/ns/anno.jsonld" ]
    },

    "contextValueInArrayFound": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Definition: Valid @context string found in array",
      "description": "True when the array contains a string item having value http://www.w3.org/ns/anno.jsonld (Section 3.1)",
      "type": "array",
      "not":
      { "items":
        { "not":
          { "$ref": "#/definitions/contextValueFound" }
        }
      }
    },

    "annotationTypeValueRecognized": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Definition: Valid annotation type value string",
      "description": "True when the string has value 'Annotation' (Section 3.1)",
      "type": "string",
      "enum": [ "Annotation" ]
    },

    "annotationTypeValueInArrayRecognized": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Definition: Valid annotation type array",
      "description": "True when the array contains a string item having value 'Annotation' (Section 3.1)",
      "type": "array",
      "not":
      { "items":
        { "not":
          { "$ref": "#/definitions/annotationTypeValueRecognized" }
        }
      }
    },

    "annotationTypeValueFound":
    {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Implementation: Annotation type",
      "description": "True when the Annotation has type key and 'Annotation' is a value of type (Section 3.1)",
      "type": "object",
      "required": [ "type" ],
      "properties": {
        "type": {
          "oneOf": [
          { "$ref": "annotations.json#/definitions/annotationTypeValueRecognized" },
          { "$ref": "annotations.json#/definitions/annotationTypeValueInArrayRecognized" }
          ]
        }
      }
    },

    "motivationList":
    {   "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Definitions: list of motivation and purposes",
      "description": "List of motivations and purposes as defined in the model (Section 3.3.5).",
      "type": "string",
      "enum": ["assessing", "bookmarking", "classifying", "commenting", "describing", "editing", "highlighting", "identifying", "linking", "moderating", "questioning", "replying", "tagging" ]
    },

    "motivationRecognizedIfPresent":
    {   "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Validation: motivation value",
      "description": "True when the annotation has 0 or more motivation property values (Section 3.3.5)",
      "type": "object",
      "properties": {"motivation":
        { "oneOf": [
          { "$ref": "#/definitions/motivationList" },
          { "type": "array",
            "minItems": 1,
            "items": { "$ref": "#/definitions/motivationList" } }
        ]
        }
      }
    },

    "motivationSingularIfPresent":
    {   "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Validation: singular motivation value",
      "description": "True when the annotation has 0 or exactly one motivation property value (Section 3.3.5)",
      "type": "object",
      "properties": {"motivation":
        { "oneOf": [
          { "$ref": "#/definitions/motivationList" },
          { "type": "array",
            "minItems": 1,
            "maxItems": 1,
            "items": { "$ref": "#/definitions/motivationList" } }
        ]
        }
      }
    },

    "motivationPropertyFound":
    {   "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Collate: via motivation with qualifying annotation class",
      "description": "Supports implementation check of via (if/when) used on Annotation (Sections 3.3.5)",
      "oneOf": [
      {"$ref": "#/definitions/annotationTypeValueFound"}
      ],
      "allOf": [
      {"required": ["motivation"]},
      {"$ref": "#/definitions/motivationRecognizedIfPresent"}
      ]
    },

    "singleMotivationPropertyFound":
    {   "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Collate: via motivation with qualifying annotation class",
      "description": "Supports implementation check of via (if/when) used on Annotation (Sections 3.3.5)",
      "oneOf": [
      {"$ref": "#/definitions/annotationTypeValueFound"}
      ],
      "allOf": [
      {"required": ["motivation"]},
      {"$ref": "#/definitions/motivationSingularIfPresent"}
      ]
    },

    "stylesheetValueDefinition":
    {
      "title": "Definition: stylesheet value",
      "description": "True when Annotation has no stylesheet, references an external stylesheet, or has embedded stylesheet of type CssStylesheet (Section 4.4)",
      "type": "object",
      "properties":
      {
        "stylesheet":
        {
          "oneOf":
            [
            { "$ref": "id.json#/definitions/arraySingleStringUri"},
            { "type": "object",
              "properties":
              {
                "type": { "type": "string",
                  "enum": [ "CssStylesheet" ]},
                  "id": { "$ref": "id.json#/definitions/stringUri" },
                  "value": { "type": "string" }
              },
              "not": { "required": [ "id", "value"] },
              "oneOf": [
              { "required": [ "id"] },
              { "required": [ "value"] }
              ]
            }
            ]
        }
      }
    },

    "stylesheetDetected":
    {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Check for implementation of Annotation stylesheet",
      "description": "True when the Annotation has a valid stylesheet property (Section 4.4)",
      "allOf": [
      {"required": ["stylesheet"]},
      {"$ref": "#/definitions/stylesheetValueDefinition"}
      ]
    },

    "bodyValueValidIfPresent":
    {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Validation: bodyValue",
      "description": "True when the Annotation has no bodyValue key or has a bodyValue key with valid value (Section 3.2.5)",
      "type": "object",
      "properties":
      {
        "bodyValue":
        {
          "oneOf":
            [
            { "type": "string" },
            { "type": "array",
              "minItems": 1,
              "maxItems": 1,
              "items": { "type": "string" }
            }
            ]
        }
      }
    },

    "bodyValueFound":
    {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "title": " Implementation: bodyValue",
      "description": "True when the Annotation has a valid bodyValue (Section 3.2.5)",
      "allOf":
        [
        { "$ref": "#/definitions/bodyValueValidIfPresent" },
        { "required": [ "bodyValue" ] }
        ]
    }

  }
}