qa 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/qa/application_controller.rb +2 -0
  3. data/config/authorities/linked_data/agrovoc.json +8 -1
  4. data/config/authorities/linked_data/agrovoc_ld4l_cache.json +85 -0
  5. data/config/authorities/linked_data/geonames_ld4l_cache.json +102 -0
  6. data/lib/generators/qa/apidoc/USAGE +11 -0
  7. data/lib/generators/qa/apidoc/apidoc_generator.rb +22 -0
  8. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/apidoc.json +753 -0
  9. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/favicon-16x16.png +0 -0
  10. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/favicon-32x32.png +0 -0
  11. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/index.html +61 -0
  12. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/oauth2-redirect.html +67 -0
  13. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui-bundle.js +93 -0
  14. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui-bundle.js.map +1 -0
  15. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui-standalone-preset.js +14 -0
  16. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui-standalone-preset.js.map +1 -0
  17. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui.css +3 -0
  18. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui.css.map +1 -0
  19. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui.js +9 -0
  20. data/lib/generators/qa/apidoc/templates/public/qa/apidoc/swagger-ui.js.map +1 -0
  21. data/lib/generators/qa/install/install_generator.rb +7 -0
  22. data/lib/qa/version.rb +1 -1
  23. data/spec/controllers/linked_data_terms_controller_spec.rb +2 -2
  24. data/spec/lib/authorities/linked_data/generic_authority_spec.rb +2 -2
  25. metadata +33 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 044adb0de6665c9ba6499467e7f91687ae42d0bf
4
- data.tar.gz: 4e214ad816b495b55f3a7a9d2c9d305ac5ceef79
3
+ metadata.gz: 1777c0add155a2c5df322774013eb12db6aca56f
4
+ data.tar.gz: 7e00272eeda762b3e2ac64b4d80150264abcc75f
5
5
  SHA512:
6
- metadata.gz: 14c63d1a98211821bd3b2e935237140f4204d71572c8748e97d1fcdef5dd95c38e0fa6d6108839f242704c705fe232095b3a923ccce12d9d49c1a7bc7001eb76
7
- data.tar.gz: ebd6d89c1eb12fb9119f9f24323df221bdfe33cbaae070290dd530612869eb83b23d2efa899577a302ad3bbc6223417623a7c3862b59e808cf7fde5f828200c9
6
+ metadata.gz: 90ae7ea98759c0db24b6111f946c17f8b5dca87a9dce80084d353226cbd11ab2a063047abbe3d22fea4988720487d4784624fdcbffe02d149a6752180cd8fd29
7
+ data.tar.gz: 784739a68d9307ad8ac86624fe6f10dfcfe582684b73dde1501fa2b4a5fd35194f368321d51e1dcf4639bd52b3b18ed50313f67898f597537394a727d42a41c5
@@ -1,5 +1,7 @@
1
1
  module Qa
2
2
  class ApplicationController < ActionController::Base
3
+ skip_before_action :verify_authenticity_token, only: :options, raise: false
4
+
3
5
  # Process the OPTIONS method for all routes
4
6
  # @see route definitions in /config/routes.rb
5
7
  # @note Reference: https://fetch.spec.whatwg.org/#http-access-control-allow-headers
@@ -31,7 +31,7 @@
31
31
  "url": {
32
32
  "@context": "http://www.w3.org/ns/hydra/context.jsonld",
33
33
  "@type": "IriTemplate",
34
- "template": "http://artemide.art.uniroma2.it:8081/agrovoc/rest/v1/search/?query=*{?query}*&lang={?lang}",
34
+ "template": "http://artemide.art.uniroma2.it:8081/agrovoc/rest/v1/search/?query=*{?query}*&lang={?lang}&maxhits={?maxRecords}",
35
35
  "variableRepresentation": "BasicRepresentation",
36
36
  "mapping": [
37
37
  {
@@ -40,6 +40,13 @@
40
40
  "property": "hydra:freetextQuery",
41
41
  "required": true
42
42
  },
43
+ {
44
+ "@type": "IriTemplateMapping",
45
+ "variable": "maxRecords",
46
+ "property": "hydra:freetextQuery",
47
+ "required": false,
48
+ "default": "20"
49
+ },
43
50
  {
44
51
  "@type": "IriTemplateMapping",
45
52
  "variable": "lang",
@@ -0,0 +1,85 @@
1
+ {
2
+ "term": {
3
+ "url": {
4
+ "@context": "http://www.w3.org/ns/hydra/context.jsonld",
5
+ "@type": "IriTemplate",
6
+ "template": "http://services.ld4l.org/ld4l_services/agrovoc_lookup.jsp?uri={?term_uri}",
7
+ "variableRepresentation": "BasicRepresentation",
8
+ "mapping": [
9
+ {
10
+ "@type": "IriTemplateMapping",
11
+ "variable": "term_uri",
12
+ "property": "hydra:freetextQuery",
13
+ "required": true,
14
+ "encode": true
15
+ }
16
+ ]
17
+ },
18
+ "qa_replacement_patterns": {
19
+ "term_id": "term_uri"
20
+ },
21
+ "term_id": "URI",
22
+ "results": {
23
+ "label_predicate": "http://www.w3.org/2004/02/skos/core#prefLabel",
24
+ "altlabel_predicate": "http://www.w3.org/2004/02/skos/core#altLabel",
25
+ "broader_predicate": "http://www.w3.org/2004/02/skos/core#broader",
26
+ "narrower_predicate": "http://www.w3.org/2004/02/skos/core#narrower",
27
+ "sameas_predicate": "http://www.w3.org/2004/02/skos/core#exactMatch"
28
+ }
29
+ },
30
+ "search": {
31
+ "url": {
32
+ "@context": "http://www.w3.org/ns/hydra/context.jsonld",
33
+ "@type": "IriTemplate",
34
+ "template": "http://services.ld4l.org/ld4l_services/agrovoc_batch.jsp?query={?query}&maxRecords={?maxRecords}&entity={?subauth}&lang={?lang}",
35
+ "variableRepresentation": "BasicRepresentation",
36
+ "mapping": [
37
+ {
38
+ "@type": "IriTemplateMapping",
39
+ "variable": "query",
40
+ "property": "hydra:freetextQuery",
41
+ "required": true
42
+ },
43
+ {
44
+ "@type": "IriTemplateMapping",
45
+ "variable": "subauth",
46
+ "property": "hydra:freetextQuery",
47
+ "required": false,
48
+ "default": ""
49
+ },
50
+ {
51
+ "@type": "IriTemplateMapping",
52
+ "variable": "maxRecords",
53
+ "property": "hydra:freetextQuery",
54
+ "required": false,
55
+ "default": "20"
56
+ },
57
+ {
58
+ "@type": "IriTemplateMapping",
59
+ "variable": "lang",
60
+ "property": "hydra:freetextQuery",
61
+ "required": false,
62
+ "default": "en"
63
+ }
64
+ ]
65
+ },
66
+ "qa_replacement_patterns": {
67
+ "query": "query",
68
+ "subauth": "subauth"
69
+ },
70
+ "results": {
71
+ "id_predicate": "http://purl.org/dc/terms/identifier",
72
+ "label_predicate": "http://www.w3.org/2004/02/skos/core#prefLabel",
73
+ "sort_predicate": "http://vivoweb.org/ontology/core#rank"
74
+ },
75
+ "subauthorities": {
76
+ "person": "Person",
77
+ "organization": "Organization",
78
+ "place": "Place",
79
+ "intangible": "Intangible",
80
+ "geocoordinates": "GeoCoordinates",
81
+ "work": "Work"
82
+ }
83
+ }
84
+ }
85
+
@@ -0,0 +1,102 @@
1
+ {
2
+ "term": {
3
+ "url": {
4
+ "@context": "http://www.w3.org/ns/hydra/context.jsonld",
5
+ "@type": "IriTemplate",
6
+ "template": "http://services.ld4l.org/ld4l_services/geonames_lookup.jsp?uri={?term_uri}",
7
+ "variableRepresentation": "BasicRepresentation",
8
+ "mapping": [
9
+ {
10
+ "@type": "IriTemplateMapping",
11
+ "variable": "term_uri",
12
+ "property": "hydra:freetextQuery",
13
+ "required": true,
14
+ "encode": true
15
+ }
16
+ ]
17
+ },
18
+ "qa_replacement_patterns": {
19
+ "term_id": "term_uri"
20
+ },
21
+ "term_id": "URI",
22
+ "results": {
23
+ "label_predicate": "http://www.geonames.org/ontology#name",
24
+ "altlabel_predicate": "http://www.geonames.org/ontology#countryCode",
25
+ "broader_predicate": "http://www.geonames.org/ontology#parentFeature",
26
+ "sameas_predicate": "http://www.w3.org/2000/01/rdf-schema#seeAlso"
27
+ }
28
+ },
29
+ "search": {
30
+ "url": {
31
+ "@context": "http://www.w3.org/ns/hydra/context.jsonld",
32
+ "@type": "IriTemplate",
33
+ "template": "http://services.ld4l.org/ld4l_services/geonames_batch.jsp?query={?query}&entity={?subauth}&maxRecords={?maxRecords}&lang={?lang}",
34
+ "variableRepresentation": "BasicRepresentation",
35
+ "mapping": [
36
+ {
37
+ "@type": "IriTemplateMapping",
38
+ "variable": "query",
39
+ "property": "hydra:freetextQuery",
40
+ "required": true
41
+ },
42
+ {
43
+ "@type": "IriTemplateMapping",
44
+ "variable": "subauth",
45
+ "property": "hydra:freetextQuery",
46
+ "required": false,
47
+ "default": "all"
48
+ },
49
+ {
50
+ "@type": "IriTemplateMapping",
51
+ "variable": "maxRecords",
52
+ "property": "hydra:freetextQuery",
53
+ "required": false,
54
+ "default": "20"
55
+ },
56
+ {
57
+ "@type": "IriTemplateMapping",
58
+ "variable": "lang",
59
+ "property": "hydra:freetextQuery",
60
+ "required": false,
61
+ "default": "en"
62
+ }
63
+ ]
64
+ },
65
+ "qa_replacement_patterns": {
66
+ "query": "query",
67
+ "subauth": "subauth"
68
+ },
69
+ "language": ["en"],
70
+ "results": {
71
+ "label_predicate": "http://www.geonames.org/ontology#name",
72
+ "altlabel_predicate": "http://www.geonames.org/ontology#countryCode",
73
+ "sort_predicate": "http://vivoweb.org/ontology/core#rank",
74
+ "context": {
75
+ "Parent": "http://www.geonames.org/ontology#parentADM1",
76
+ "Parent2": "http://www.geonames.org/ontology#parentADM2",
77
+ "Parent Country": "http://www.geonames.org/ontology#parentCountry",
78
+ "Children": "http://www.geonames.org/ontology#childrenFeatures",
79
+ "Country": "http://www.geonames.org/ontology#countryCode",
80
+ "Population": "http://www.geonames.org/ontology#population",
81
+ "Latitude": "http://www.w3.org/2003/01/geo/wgs84_pos#lat",
82
+ "Longitude": "http://www.w3.org/2003/01/geo/wgs84_pos#long",
83
+ "Altitude": "http://www.w3.org/2003/01/geo/wgs84_pos#alt",
84
+ "Feature Class": "http://www.geonames.org/ontology#featureClass",
85
+ "Feature Code": "http://www.geonames.org/ontology#featureCode"
86
+ }
87
+ },
88
+ "subauthorities": {
89
+ "area": "A",
90
+ "place": "P",
91
+ "area_and_place": "AP",
92
+ "water": "H",
93
+ "park": "L",
94
+ "road": "R",
95
+ "spot": "S",
96
+ "terrain": "T",
97
+ "undersea": "U",
98
+ "vegetation": "V",
99
+ "all": "all"
100
+ }
101
+ }
102
+ }
@@ -0,0 +1,11 @@
1
+ Description:
2
+ This generator adds interactive documentation for the linked data API.
3
+
4
+ Example:
5
+ rails generate qa:apidoc
6
+
7
+ This will create:
8
+ public/qa/apidoc/*
9
+
10
+ You can access the UI at:
11
+ https://YOUR_APP_HOST/qa/apidoc/
@@ -0,0 +1,22 @@
1
+ class Qa::ApidocGenerator < Rails::Generators::Base
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ desc """
5
+ This generator makes the following changes to your application:
6
+ 1. Add swagger-docs gem and bundle install
7
+ 2. Add swagger documentation for the QA linked data API
8
+
9
+ """
10
+
11
+ def add_to_gemfile
12
+ gem 'swagger-docs'
13
+
14
+ Bundler.with_clean_env do
15
+ run "bundle install"
16
+ end
17
+ end
18
+
19
+ def copy_api_docs
20
+ directory "public/qa/apidoc", recursive: false
21
+ end
22
+ end
@@ -0,0 +1,753 @@
1
+ {
2
+ "openapi": "3.0.1",
3
+ "info": {
4
+ "title": "QA 2.1 Linked Data API",
5
+ "version": "2.1",
6
+ "license": {
7
+ "name": "Apache 2.0",
8
+ "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
9
+ }
10
+ },
11
+ "servers": [
12
+ {
13
+ "url": "http://{site_host}/{apiBase}",
14
+ "description": "QA v2.1 API Server",
15
+ "variables": {
16
+ "site_host": {
17
+ "default": "localhost:3000",
18
+ "description": ""
19
+ },
20
+ "apiBase": {
21
+ "default": "qa"
22
+ }
23
+ }
24
+ }
25
+ ],
26
+ "paths": {
27
+ "/search/linked_data/{vocab}": {
28
+ "get": {
29
+ "summary": "Send a query string to an authority and return search results. Parameters are typical examples. Actual parameters are driven by the authority's config file.",
30
+ "operationId": "GET_searchAuthority",
31
+ "tags": [
32
+ "Search Query"
33
+ ],
34
+ "parameters": [
35
+ {
36
+ "description": "Name of the authority's configuration file.",
37
+ "in": "path",
38
+ "name": "vocab",
39
+ "required": true,
40
+ "schema": {
41
+ "default": "agrovoc",
42
+ "type": "string"
43
+ }
44
+ },
45
+ {
46
+ "description": "The query string",
47
+ "in": "query",
48
+ "name": "q",
49
+ "required": true,
50
+ "schema": {
51
+ "default": "milk",
52
+ "type": "string"
53
+ }
54
+ },
55
+ {
56
+ "description": "Limit number of returned results",
57
+ "in": "query",
58
+ "name": "maxRecords",
59
+ "required": false,
60
+ "schema": {
61
+ "default": 4,
62
+ "type": "integer"
63
+ }
64
+ },
65
+ {
66
+ "description": "Limit string values to this language when multiple languages are provided.",
67
+ "in": "query",
68
+ "name": "lang",
69
+ "required": false,
70
+ "schema": {
71
+ "default": "en",
72
+ "type": "string"
73
+ }
74
+ }
75
+ ],
76
+ "responses": {
77
+ "200": {
78
+ "description": "Successfully accessed authority and received results.",
79
+ "headers": {
80
+ "Access-Control-Allow-Origin": {
81
+ "description": "CORS header will be * if cors_headers_enabled",
82
+ "schema": {
83
+ "type": "string"
84
+ }
85
+ }
86
+ },
87
+ "content": {
88
+ "application/json": {
89
+ "schema": {
90
+ "$ref": "#/components/schemas/linked_data_query_results"
91
+ }
92
+ }
93
+ }
94
+ },
95
+ "503": {
96
+ "description": "Service Unavailable",
97
+ "content": {
98
+ "text/plain": {
99
+ "schema": {
100
+ "type": "string",
101
+ "example": ""
102
+ }
103
+ }
104
+ }
105
+ },
106
+ "500": {
107
+ "description": "Internal Server Error",
108
+ "content": {
109
+ "text/plain": {
110
+ "schema": {
111
+ "type": "string",
112
+ "example": ""
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ },
119
+ "options": {
120
+ "summary": "CORS preflight request",
121
+ "operationId": "OPTIONS_searchAuthority",
122
+ "tags": [
123
+ "Search Query"
124
+ ],
125
+ "parameters": [
126
+ {
127
+ "description": "Name of the authority's configuration file.",
128
+ "in": "path",
129
+ "name": "vocab",
130
+ "required": true,
131
+ "schema": {
132
+ "default": "agrovoc",
133
+ "type": "string"
134
+ }
135
+ }
136
+ ],
137
+ "responses": {
138
+ "204": {
139
+ "description": "When CORS is enabled, perform CORS preflight for searching an authority",
140
+ "headers": {
141
+ "Access-Control-Allow-Origin": {
142
+ "description": "CORS header will be * if CORS headers are enabled",
143
+ "schema": {
144
+ "type": "string"
145
+ }
146
+ },
147
+ "Access-Control-Allow-Methods": {
148
+ "description": "Indicates which method a future CORS request to the same resource might use.",
149
+ "schema": {
150
+ "type": "string"
151
+ }
152
+ }
153
+ },
154
+ "content": {
155
+ "text/plain": {
156
+ "schema": {
157
+ "type": "string",
158
+ "example": ""
159
+ }
160
+ }
161
+ }
162
+ },
163
+ "501": {
164
+ "description": "OPTIONS action is not implement when CORS headers are not enabled",
165
+ "content": {
166
+ "text/plain": {
167
+ "schema": {
168
+ "type": "string",
169
+ "example": ""
170
+ }
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+ },
177
+ "/search/linked_data/{vocab}/{subauthority}": {
178
+ "get": {
179
+ "summary": "Send a query string to a subauthority in an authority and return search results.",
180
+ "operationId": "GET_searchSubauthority",
181
+ "tags": [
182
+ "Search Query"
183
+ ],
184
+ "parameters": [
185
+ {
186
+ "description": "Name of the authority's configuration file.",
187
+ "in": "path",
188
+ "name": "vocab",
189
+ "required": true,
190
+ "schema": {
191
+ "default": "oclc_fast",
192
+ "type": "string"
193
+ }
194
+ },
195
+ {
196
+ "description": "Name of the subauthority.",
197
+ "in": "path",
198
+ "name": "subauthority",
199
+ "required": true,
200
+ "schema": {
201
+ "default": "personal_name",
202
+ "type": "string"
203
+ }
204
+ },
205
+ {
206
+ "description": "The query string",
207
+ "in": "query",
208
+ "name": "q",
209
+ "required": true,
210
+ "schema": {
211
+ "default": "twain",
212
+ "type": "string"
213
+ }
214
+ },
215
+ {
216
+ "description": "Limit number of returned results. NOTE: Most authorities use maxRecords instead of maximumRecords for this parameter.",
217
+ "in": "query",
218
+ "name": "maximumRecords",
219
+ "required": false,
220
+ "schema": {
221
+ "default": 4,
222
+ "type": "integer"
223
+ }
224
+ },
225
+ {
226
+ "description": "Limit string values to this language when multiple languages are provided.",
227
+ "in": "query",
228
+ "name": "lang",
229
+ "required": false,
230
+ "schema": {
231
+ "default": "en",
232
+ "type": "string"
233
+ }
234
+ }
235
+ ],
236
+ "responses": {
237
+ "200": {
238
+ "description": "Successfully accessed subauthority in an authority and received results.",
239
+ "headers": {
240
+ "Access-Control-Allow-Origin": {
241
+ "description": "CORS header will be * if CORS headers are enabled",
242
+ "schema": {
243
+ "type": "string"
244
+ }
245
+ }
246
+ },
247
+ "content": {
248
+ "application/json": {
249
+ "schema": {
250
+ "$ref": "#/components/schemas/linked_data_query_results"
251
+ }
252
+ }
253
+ }
254
+ },
255
+ "503": {
256
+ "description": "Service Unavailable",
257
+ "content": {
258
+ "text/plain": {
259
+ "schema": {
260
+ "type": "string",
261
+ "example": ""
262
+ }
263
+ }
264
+ }
265
+ },
266
+ "500": {
267
+ "description": "Internal Server Error",
268
+ "content": {
269
+ "text/plain": {
270
+ "schema": {
271
+ "type": "string",
272
+ "example": ""
273
+ }
274
+ }
275
+ }
276
+ }
277
+ }
278
+ },
279
+ "options": {
280
+ "summary": "CORS preflight request",
281
+ "operationId": "OPTIONS_searchSubauthority",
282
+ "tags": [
283
+ "Search Query"
284
+ ],
285
+ "parameters": [
286
+ {
287
+ "description": "Name of the authority's configuration file.",
288
+ "in": "path",
289
+ "name": "vocab",
290
+ "required": true,
291
+ "schema": {
292
+ "default": "oclc_fast",
293
+ "type": "string"
294
+ }
295
+ },
296
+ {
297
+ "description": "Name of the subauthority.",
298
+ "in": "path",
299
+ "name": "subauthority",
300
+ "required": true,
301
+ "schema": {
302
+ "default": "personal_name",
303
+ "type": "string"
304
+ }
305
+ }
306
+ ],
307
+ "responses": {
308
+ "204": {
309
+ "description": "Perform CORS preflight for searching a subauthoroity in an authority",
310
+ "headers": {
311
+ "Access-Control-Allow-Origin": {
312
+ "description": "CORS header will be * if CORS headers are enabled",
313
+ "schema": {
314
+ "type": "string"
315
+ }
316
+ },
317
+ "Access-Control-Allow-Methods": {
318
+ "description": "Indicates which method a future CORS request to the same resource might use.",
319
+ "schema": {
320
+ "type": "string"
321
+ }
322
+ }
323
+ },
324
+ "content": {
325
+ "text/plain": {
326
+ "schema": {
327
+ "type": "string",
328
+ "example": ""
329
+ }
330
+ }
331
+ }
332
+ },
333
+ "501": {
334
+ "description": "OPTIONS action is not implement when CORS headers are not enabled",
335
+ "content": {
336
+ "text/plain": {
337
+ "schema": {
338
+ "type": "string",
339
+ "example": ""
340
+ }
341
+ }
342
+ }
343
+ }
344
+ }
345
+ }
346
+ },
347
+ "/show/linked_data/{vocab}/{id}": {
348
+ "get": {
349
+ "operationId": "GET_fetchByIDFromAuthority",
350
+ "summary": "Get a single term from an authority. Generally there are no additional parameters. See the authority's configuration file to be sure. Some authorities support `lang` which can be used to filter the language of returned strings.",
351
+ "tags": [
352
+ "Fetch Term"
353
+ ],
354
+ "parameters": [
355
+ {
356
+ "description": "Name of the authority's configuration file.",
357
+ "in": "path",
358
+ "name": "vocab",
359
+ "required": true,
360
+ "schema": {
361
+ "default": "agrovoc",
362
+ "type": "string"
363
+ }
364
+ },
365
+ {
366
+ "description": "The ID or URI for the term being retrieved.",
367
+ "in": "path",
368
+ "name": "id",
369
+ "required": true,
370
+ "schema": {
371
+ "default": "c_9513",
372
+ "type": "string"
373
+ }
374
+ }
375
+ ],
376
+ "responses": {
377
+ "200": {
378
+ "description": "Successfully accessed authority and received term.",
379
+ "headers": {
380
+ "Access-Control-Allow-Origin": {
381
+ "description": "CORS header will be * if CORS headers are enabled",
382
+ "schema": {
383
+ "type": "string"
384
+ }
385
+ }
386
+ },
387
+ "content": {
388
+ "application/json": {
389
+ "schema": {
390
+ "$ref": "#/components/schemas/linked_data_term"
391
+ }
392
+ }
393
+ }
394
+ },
395
+ "404": {
396
+ "description": "Not Found",
397
+ "content": {
398
+ "text/plain": {
399
+ "schema": {
400
+ "type": "string",
401
+ "example": ""
402
+ }
403
+ }
404
+ }
405
+ },
406
+ "503": {
407
+ "description": "Service Unavailable",
408
+ "content": {
409
+ "text/plain": {
410
+ "schema": {
411
+ "type": "string",
412
+ "example": ""
413
+ }
414
+ }
415
+ }
416
+ },
417
+ "500": {
418
+ "description": "Internal Server Error",
419
+ "content": {
420
+ "text/plain": {
421
+ "schema": {
422
+ "type": "string",
423
+ "example": ""
424
+ }
425
+ }
426
+ }
427
+ }
428
+ }
429
+ },
430
+ "options": {
431
+ "summary": "CORS preflight request",
432
+ "operationId": "OPTIONS_fetchFromAuthority",
433
+ "tags": [
434
+ "Fetch Term"
435
+ ],
436
+ "parameters": [
437
+ {
438
+ "description": "Name of the authority's configuration file.",
439
+ "in": "path",
440
+ "name": "vocab",
441
+ "required": true,
442
+ "schema": {
443
+ "default": "agrovoc",
444
+ "type": "string"
445
+ }
446
+ },
447
+ {
448
+ "description": "The ID or URI for the term being retrieved.",
449
+ "in": "path",
450
+ "name": "id",
451
+ "required": true,
452
+ "schema": {
453
+ "default": "c_9513",
454
+ "type": "string"
455
+ }
456
+ }
457
+ ],
458
+ "responses": {
459
+ "204": {
460
+ "description": "Perform CORS preflight for fetching a term from an authority",
461
+ "headers": {
462
+ "Access-Control-Allow-Origin": {
463
+ "description": "CORS header will be * if CORS headers are enabled",
464
+ "schema": {
465
+ "type": "string"
466
+ }
467
+ },
468
+ "Access-Control-Allow-Methods": {
469
+ "description": "Indicates which method a future CORS request to the same resource might use.",
470
+ "schema": {
471
+ "type": "string"
472
+ }
473
+ }
474
+ },
475
+ "content": {
476
+ "text/plain": {
477
+ "schema": {
478
+ "type": "string",
479
+ "example": ""
480
+ }
481
+ }
482
+ }
483
+ },
484
+ "501": {
485
+ "description": "OPTIONS action is not implement when CORS headers are not enabled",
486
+ "content": {
487
+ "text/plain": {
488
+ "schema": {
489
+ "type": "string",
490
+ "example": ""
491
+ }
492
+ }
493
+ }
494
+ }
495
+ }
496
+ }
497
+ },
498
+ "/show/linked_data/{vocab}/{subauthority}/{id}": {
499
+ "get": {
500
+ "operationId": "GET_fetchByIDFromSubauthority",
501
+ "summary": "Get a single term from a subauthority in an authority. Generally there are no additional parameters. See the authority's configuration file to be sure. Some authorities support `lang` which can be used to filter the language of returned strings.",
502
+ "tags": [
503
+ "Fetch Term"
504
+ ],
505
+ "parameters": [
506
+ {
507
+ "description": "Name of the authority's configuration file.",
508
+ "in": "path",
509
+ "name": "vocab",
510
+ "required": true,
511
+ "schema": {
512
+ "default": "loc",
513
+ "type": "string"
514
+ }
515
+ },
516
+ {
517
+ "description": "Name of the subauthority.",
518
+ "in": "path",
519
+ "name": "subauthority",
520
+ "required": true,
521
+ "schema": {
522
+ "default": "names",
523
+ "type": "string"
524
+ }
525
+ },
526
+ {
527
+ "description": "The ID or URI for the term being retrieved.",
528
+ "in": "path",
529
+ "name": "id",
530
+ "required": true,
531
+ "schema": {
532
+ "default": "n92016188",
533
+ "type": "string"
534
+ }
535
+ }
536
+ ],
537
+ "responses": {
538
+ "200": {
539
+ "description": "Successfully accessed subauthority in the authority and received term.",
540
+ "headers": {
541
+ "Access-Control-Allow-Origin": {
542
+ "description": "CORS header will be * if CORS headers are enabled",
543
+ "schema": {
544
+ "type": "string"
545
+ }
546
+ }
547
+ },
548
+ "content": {
549
+ "application/json": {
550
+ "schema": {
551
+ "$ref": "#/components/schemas/linked_data_term_result"
552
+ }
553
+ }
554
+ }
555
+ },
556
+ "404": {
557
+ "description": "Not Found",
558
+ "content": {
559
+ "text/plain": {
560
+ "schema": {
561
+ "type": "string",
562
+ "example": ""
563
+ }
564
+ }
565
+ }
566
+ },
567
+ "503": {
568
+ "description": "Service Unavailable",
569
+ "content": {
570
+ "text/plain": {
571
+ "schema": {
572
+ "type": "string",
573
+ "example": ""
574
+ }
575
+ }
576
+ }
577
+ },
578
+ "500": {
579
+ "description": "Internal Server Error",
580
+ "content": {
581
+ "text/plain": {
582
+ "schema": {
583
+ "type": "string",
584
+ "example": ""
585
+ }
586
+ }
587
+ }
588
+ }
589
+ }
590
+ },
591
+ "options": {
592
+ "summary": "CORS preflight request",
593
+ "operationId": "OPTIONS_fetchFromSubauthority",
594
+ "tags": [
595
+ "Fetch Term"
596
+ ],
597
+ "parameters": [
598
+ {
599
+ "description": "Name of the authority's configuration file.",
600
+ "in": "path",
601
+ "name": "vocab",
602
+ "required": true,
603
+ "schema": {
604
+ "default": "loc",
605
+ "type": "string"
606
+ }
607
+ },
608
+ {
609
+ "description": "Name of the subauthority.",
610
+ "in": "path",
611
+ "name": "subauthority",
612
+ "required": true,
613
+ "schema": {
614
+ "default": "names",
615
+ "type": "string"
616
+ }
617
+ },
618
+ {
619
+ "description": "The ID or URI for the term being retrieved.",
620
+ "in": "path",
621
+ "name": "id",
622
+ "required": true,
623
+ "schema": {
624
+ "default": "n92016188",
625
+ "type": "string"
626
+ }
627
+ }
628
+ ],
629
+ "responses": {
630
+ "204": {
631
+ "description": "Perform CORS preflight for fetching a term from a subauthority in an authority",
632
+ "headers": {
633
+ "Access-Control-Allow-Origin": {
634
+ "description": "CORS header will be * if CORS headers are enabled",
635
+ "schema": {
636
+ "type": "string"
637
+ }
638
+ },
639
+ "Access-Control-Allow-Methods": {
640
+ "description": "Indicates which method a future CORS request to the same resource might use.",
641
+ "schema": {
642
+ "type": "string"
643
+ }
644
+ }
645
+ },
646
+ "content": {
647
+ "text/plain": {
648
+ "schema": {
649
+ "type": "string",
650
+ "example": ""
651
+ }
652
+ }
653
+ }
654
+ },
655
+ "501": {
656
+ "description": "OPTIONS action is not implement when CORS headers are not enabled",
657
+ "content": {
658
+ "text/plain": {
659
+ "schema": {
660
+ "type": "string",
661
+ "example": ""
662
+ }
663
+ }
664
+ }
665
+ }
666
+ }
667
+ }
668
+ }
669
+ },
670
+ "components": {
671
+ "schemas": {
672
+ "linked_data_query_results": {
673
+ "type": "array",
674
+ "items": {
675
+ "required": [
676
+ "id",
677
+ "uri",
678
+ "label"
679
+ ],
680
+ "properties": {
681
+ "id": {
682
+ "type": "string"
683
+ },
684
+ "uri": {
685
+ "type": "string"
686
+ },
687
+ "label": {
688
+ "type": "string"
689
+ },
690
+ "context": {
691
+ "type": "object"
692
+ }
693
+ }
694
+ }
695
+ },
696
+ "linked_data_term": {
697
+ "required": [
698
+ "id",
699
+ "uri",
700
+ "label"
701
+ ],
702
+ "properties": {
703
+ "id": {
704
+ "type": "string"
705
+ },
706
+ "uri": {
707
+ "type": "string"
708
+ },
709
+ "label": {
710
+ "type": "string"
711
+ },
712
+ "altlabel": {
713
+ "type": "array",
714
+ "items": {
715
+ "type": "string"
716
+ }
717
+ },
718
+ "broader": {
719
+ "type": "array",
720
+ "items": {
721
+ "type": "string"
722
+ }
723
+ },
724
+ "narrower": {
725
+ "type": "array",
726
+ "items": {
727
+ "type": "string"
728
+ }
729
+ },
730
+ "sameas": {
731
+ "type": "array",
732
+ "items": {
733
+ "type": "string"
734
+ }
735
+ },
736
+ "predicates": {
737
+ "type": "object",
738
+ }
739
+ }
740
+ }
741
+ }
742
+ },
743
+ "tags": [
744
+ {
745
+ "name": "Search Query",
746
+ "description": "Services sending a search query to an authority to retrieve multiple results."
747
+ },
748
+ {
749
+ "name": "Fetch Term",
750
+ "description": "Services to fetch a single term from an authority."
751
+ }
752
+ ]
753
+ }