Skip to content

Commit 8123f3a

Browse files
committed
schemas: Changes to sync OGC API - Common review
- The main change relates to the ability to describe meaning of enum values related to opengeospatial/ogcapi-coverages#173 (comment) using a combination of `anyOf` with `const` + `title` as described in https://stackoverflow.com/questions/64233370/in-json-schema-how-to-define-an-enum-with-description-of-each-elements-in-the-e - Changes also introduce a new `x-ogc-nilValues` keyword for identifying nil values - Other changes are gramamr fixes and minor clarifications - Changing indirect dependency to QUDT in general as opposed to QUDT units since QUDT can also used for semantic definitions (not only QUDT units) - Clarified that JSON Schema keywords can also include additional keywords in section below
1 parent 2c74936 commit 8123f3a

File tree

2 files changed

+53
-8
lines changed

2 files changed

+53
-8
lines changed

extensions/schemas/standard/annex_bibliography.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
[[OpenAPI]] OpenAPI Initiative (OAI). **OpenAPI Specification 3.0** [online, viewed 2023-10-14]. 2020. Available at http://spec.openapis.org/oas/v3.0.3
1313

14+
[[qudt]] QUDT.org. **QUDT Ontologies, derived models and vocabularies 2.1**. Edited by R. Hodgson. 2024. Available at https://www.qudt.org/
15+
1416
[[rfc6906]] Internet Engineering Task Force (IETF). RFC 6906: **The 'profile' Link Relation Type**. Edited by E. Wilde. 2013. Available at https://www.rfc-editor.org/rfc/rfc6906.html
1517

1618
[[rfc8288]] Internet Engineering Task Force (IETF). RFC 8288: **Web Linking**. Edited by M. Nottingham. 2017. Available at https://www.rfc-editor.org/rfc/rfc8288.html

extensions/schemas/standard/clause_7_schemas.adoc

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The Requirements Class "Schemas" specifies basic provisions for schemas of items
2727
^|B |The schema SHALL have the following characteristics:
2828
2929
* "$schema" is "\https://json-schema.org/draft/2020-12/schema";
30-
* "$id" is a HTTP(S) URI without query parameters that returns the schema, if requested with the header "Accept: application/schema+json"; and
30+
* "$id" is a HTTP(S) URI without query parameters that returns the schema, if requested with the header "Accept: application/schema+json"; and
3131
* "type" is "object".
3232
|===
3333
@@ -60,11 +60,11 @@ The following recommendations are intended to simplify parsing a schema and to h
6060
^|E |Properties that represent a UUID SHOULD be represented as a string with format "uuid".
6161
^|F |For string properties, "minLength", "maxLength", "enum" and/or "pattern" SHOULD be provided, where applicable.
6262
^|G |For numeric properties, "multipleOf", "minimum", "exclusiveMinimum", "maximum", "exclusiveMaximum" SHOULD be provided, where applicable.
63-
^|H |For integer properties that represent enumerated values, "enum" SHOULD be provided.
63+
^|H |For integer properties that represent enumerated values (except for codelist values), "enum" SHOULD be provided.
6464
^|I |For string or integer properties that represent codelist values, one of the profiles "codelist-inline" or "codelist-ref" (see <<rc_profile-codelists>>) SHOULD be applied.
6565
^|J |For array properties, the property SHOULD consist of items that are strings or numbers.
6666
^|K |Required properties SHOULD be included in "required".
67-
^|L |The JSON Schema keywords SHOULD be constrained to the those mentioned in this recommendation and requirement `/req/{req-class}/properties`.
67+
^|L |The JSON Schema keywords SHOULD be constrained to those mentioned in this recommendation, requirement `/req/{req-class}/properties` and requirements in the _additional keywords_ section below.
6868
|===
6969

7070
[#additional-keywords]
@@ -80,7 +80,7 @@ In order to be able to map the logical schema to a format-specific schema, exten
8080
^|A |Additional keywords SHALL start with "x-ogc-".
8181
|===
8282
83-
CAUTION: The next version of JSON Schema will likely restrict the use of additional keywords. As a result, this Standard may need to change the prefix or change the way as to how the vocabulary is extended.
83+
CAUTION: The next version of JSON Schema will likely restrict the use of additional keywords. As a result, this Standard may need to change the prefix or change how the vocabulary is extended.
8484
8585
:req: role
8686
[#{req-class}_{req}]
@@ -123,9 +123,9 @@ In geospatial data, numeric property values often represent a measurement and ha
123123
^|A |The keyword "x-ogc-unit" SHALL be used to declare the unit of measure of the property.
124124
^|B |The value of the keyword "x-ogc-unit" SHALL be a string representing the unit of measure.
125125
^|C |The value of the keyword "x-ogc-unit" SHALL be the case sensitive UCUM representation ("c/s") unless a different language / register for units is identified in keyword "x-ogc-unitLang".
126-
^|D |The value for UCUM, if explicitly declared as the language for units in keyword "x-ogc-unitLang", SHALL be "UCUM".
127-
^|E |The value for the QUDT Units Vocabulary, if declared as the language for units in keyword "x-ogc-unitLang", SHALL be "QUDT".
128-
^|F |The value of the keyword "x-ogc-unit" SHALL be the URI of the unit for values from the QUDT Units Vocabulary.
126+
^|D |The value for UCUM, if explicitly declared as the language for units in keyword "x-ogc-unitLang", SHALL be "UCUM".
127+
^|E |For specifying a unit from QUDT Units Vocabulary, "x-ogc-unitLang", SHALL be "QUDT".
128+
^|F |For specifying a unit from QUDT Units Vocabulary, the value of the keyword "x-ogc-unit" SHALL be the URI of the unit.
129129
|===
130130
131131
Communities or other OGC Standards can specify additional values for other unit languages, e.g., https://www.opengis.net/def/uom[units registered in the OGC Rainbow]. For each language it must be specified how units have to be represented in the "x-ogc-unit" value.
@@ -143,12 +143,21 @@ NOTE: For example, the value for hectopascal is `hPa` in UCUM and `\https://qudt
143143
^|B |The value of the keyword "x-ogc-definition" SHALL be a URI.
144144
|===
145145

146+
:req: nilvalues
147+
[#{req-class}_{req}]
148+
[width="90%",cols="2,7a"]
149+
|===
150+
^|*Requirement {counter:req-num}* |/req/{req-class}/{req}
151+
^|A |The keyword "x-ogc-nilValues" SHALL be used to identify the values considered nil.
152+
^|B |The value of the keyword "x-ogc-nilValues" SHALL be an array of objects, each including a mandatory "const" value and an optional "title" explanation of the meaning of that particular nil value.
153+
|===
154+
146155
=== Examples
147156
148157
The following example is the schema of a feature type representing cultural entities. The schema includes additional keywords that apply to feature data (specified in the next Clause).
149158
150159
[[example_7_1]]
151-
.Schema of a "Cultural (Points)" feature type
160+
.Schema of a "Cultural (Points)" feature type
152161
====
153162
[source,JSON]
154163
----
@@ -202,6 +211,9 @@ The following example is the schema of a feature type representing cultural enti
202211
"ZI037_REL" : {
203212
"title" : "Religious Designation",
204213
"enum" : [ -999999, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ],
214+
"x-ogc-nilValues": [
215+
{ "const": -999999, "title": "unknown" }
216+
],
205217
"type" : "integer",
206218
"x-ogc-propertySeq": 8
207219
},
@@ -264,3 +276,34 @@ The next example is the schema of a feature type representing observations of at
264276
}
265277
----
266278
====
279+
280+
The next example is the schema of a land cover collection.
281+
282+
[[example_7_3]]
283+
.Schema of a land cover collection
284+
====
285+
[source,JSON]
286+
----
287+
{
288+
"$schema" : "https://json-schema.org/draft/2020-12/schema",
289+
"$id" : "https://example.com/ogcapi/collections/landcover/schema",
290+
"title" : "Land Cover",
291+
"type" : "object",
292+
"properties" : { "LC" : {
293+
"title" : "Land Cover",
294+
"type" : "integer",
295+
"x-ogc-propertySeq" : 1,
296+
"oneOf": [
297+
{ "const": 0 },
298+
{ "const": 1, "title": "vegetation" },
299+
{ "const": 2, "title": "bare soils" },
300+
{ "const": 3, "title": "water" },
301+
{ "const": 4, "title": "clouds" }
302+
],
303+
"x-ogc-nilValues": [
304+
{ "const": 0, "title": "no data" }
305+
]
306+
}
307+
}
308+
----
309+
====

0 commit comments

Comments
 (0)