Skip to content

Commit d854ce6

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 d854ce6

File tree

2 files changed

+54
-8
lines changed

2 files changed

+54
-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: 52 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,12 @@ 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.
68+
=======
6869
|===
6970

7071
[#additional-keywords]
@@ -80,7 +81,7 @@ In order to be able to map the logical schema to a format-specific schema, exten
8081
^|A |Additional keywords SHALL start with "x-ogc-".
8182
|===
8283
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.
84+
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.
8485
8586
:req: role
8687
[#{req-class}_{req}]
@@ -123,9 +124,9 @@ In geospatial data, numeric property values often represent a measurement and ha
123124
^|A |The keyword "x-ogc-unit" SHALL be used to declare the unit of measure of the property.
124125
^|B |The value of the keyword "x-ogc-unit" SHALL be a string representing the unit of measure.
125126
^|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.
127+
^|D |The value for UCUM, if explicitly declared as the language for units in keyword "x-ogc-unitLang", SHALL be "UCUM".
128+
^|E |For specifying a unit from QUDT Units Vocabulary, "x-ogc-unitLang", SHALL be "QUDT".
129+
^|F |For specifying a unit from QUDT Units Vocabulary, the value of the keyword "x-ogc-unit" SHALL be the URI of the unit.
129130
|===
130131
131132
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 +144,21 @@ NOTE: For example, the value for hectopascal is `hPa` in UCUM and `\https://qudt
143144
^|B |The value of the keyword "x-ogc-definition" SHALL be a URI.
144145
|===
145146

147+
:req: nilvalues
148+
[#{req-class}_{req}]
149+
[width="90%",cols="2,7a"]
150+
|===
151+
^|*Requirement {counter:req-num}* |/req/{req-class}/{req}
152+
^|A |The keyword "x-ogc-nilValues" SHALL be used to identify the values considered nil.
153+
^|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.
154+
|===
155+
146156
=== Examples
147157
148158
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).
149159
150160
[[example_7_1]]
151-
.Schema of a "Cultural (Points)" feature type
161+
.Schema of a "Cultural (Points)" feature type
152162
====
153163
[source,JSON]
154164
----
@@ -202,6 +212,9 @@ The following example is the schema of a feature type representing cultural enti
202212
"ZI037_REL" : {
203213
"title" : "Religious Designation",
204214
"enum" : [ -999999, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ],
215+
"x-ogc-nilValues": [
216+
{ "const": -999999, "title": "unknown" }
217+
],
205218
"type" : "integer",
206219
"x-ogc-propertySeq": 8
207220
},
@@ -264,3 +277,34 @@ The next example is the schema of a feature type representing observations of at
264277
}
265278
----
266279
====
280+
281+
The next example is the schema of a land cover collection.
282+
283+
[[example_7_3]]
284+
.Schema of a land cover collection
285+
====
286+
[source,JSON]
287+
----
288+
{
289+
"$schema" : "https://json-schema.org/draft/2020-12/schema",
290+
"$id" : "https://example.com/ogcapi/collections/landcover/schema",
291+
"title" : "Land Cover",
292+
"type" : "object",
293+
"properties" : { "LC" : {
294+
"title" : "Land Cover",
295+
"type" : "integer",
296+
"x-ogc-propertySeq" : 1,
297+
"oneOf": [
298+
{ "const": 0 },
299+
{ "const": 1, "title": "vegetation" },
300+
{ "const": 2, "title": "bare soils" },
301+
{ "const": 3, "title": "water" },
302+
{ "const": 4, "title": "clouds" }
303+
],
304+
"x-ogc-nilValues": [
305+
{ "const": 0, "title": "no data" }
306+
]
307+
}
308+
}
309+
----
310+
====

0 commit comments

Comments
 (0)