Skip to content

Commit

Permalink
[API Part2] Added SWE encoding sections
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrobin committed Jun 13, 2024
1 parent 5ead961 commit 27f184a
Show file tree
Hide file tree
Showing 11 changed files with 708 additions and 244 deletions.
4 changes: 4 additions & 0 deletions api/part2/standard/23-002r0.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@
:json-schema-root: ../openapi/schemas/json
:json-datastream-schema: link:{json-schema-root}/dataStream.json[dataStream.json]
:json-datastream-collection-schema: link:{json-schema-root}/dataStreamCollection.json[dataStreamCollection.json]
:json-observationschema-schema-json: link:{json-schema-root}/observationSchemaJson.json[observationSchemaJson.json]
:json-observationschema-schema-swe: link:{json-schema-root}/observationSchemaSwe.json[observationSchemaSwe.json]
:json-observation-schema: link:{json-schema-root}/observation.json[observation.json]
:json-observation-collection-schema: link:{json-schema-root}/observationCollection.json[observationCollection.json]
:json-controlstream-schema: link:{json-schema-root}/controlStream.json[controlStream.json]
:json-controlstream-collection-schema: link:{json-schema-root}/controlStreamCollection.json[controlStreamCollection.json]
:json-commandschema-schema-json: link:{json-schema-root}/commandSchemaJson.json[commandSchemaJson.json]
:json-commandschema-schema-swe: link:{json-schema-root}/commandSchemaSwe.json[commandSchemaSwe.json]
:json-command-schema: link:{json-schema-root}/command.json[command.json]
:json-command-collection-schema: link:{json-schema-root}/commandCollection.json[commandCollection.json]
:json-commandstatus-schema: link:{json-schema-root}/commandStatus.json[commandStatus.json]
Expand Down
579 changes: 366 additions & 213 deletions api/part2/standard/23-002r0.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ The media type used to advertise support for this encoding is `{json-mediatype}`
[%metadata]
identifier:: /req/json/mediatype-read
The server SHALL support the media type `{json-mediatype}` in the HTTP `Accept` header and respond with a JSON document corresponding to the requested resource type.
part:: The server SHALL accept resource retrieval (read) requests with media type `{json-mediatype}` for all resource types whose representation is specified in this requirements class.
part:: The response to such request SHALL be encoded as specified in the clause corresponding to the resource type.
====

[requirement,model=ogc]
Expand All @@ -29,12 +31,14 @@ identifier:: /req/json/mediatype-write
conditions:: The server implements <<clause-resource-crd,style=basic%>>.
The server SHALL support the media type `{json-mediatype}` in the HTTP `Content-Type` header and parse the JSON body according to the resource type.
part:: The server SHALL accept resource insertion (write) requests with media type `{json-mediatype}` for all resource types whose representation is specified in this requirements class.
part:: The resource representation provided in the request SHALL be encoded as specified in the clause corresponding to the resource type.
====


[[clause-json-datastream]]
==== Datastream Encoding Rules
==== DataStream Representation

[requirement,model=ogc]
====
Expand All @@ -59,15 +63,43 @@ include::../openapi/examples/datastreams/datastream-simple.json[]



==== Datastream Schema Encoding Rules
[[clause-json-obsschema]]
==== Observation Schema Representation

When using the plain `application/json` media type for retrieving observations, the following schema syntax is used:
When using the `{json-mediatype}` media type for observations, two separate schemas are provided to further describe the content of the observation `result` and `parameters` properties (the `parameters` schema is optional). Both schemas are provided as SWE Common data component tree in JSON format.

[requirement,model=ogc]
====
[%metadata]
identifier:: /req/json/obsschema-schema
part:: The `Observation Schema` resource for media type `{json-mediatype}` SHALL be valid against the JSON schema {json-observationschema-schema-json}.
====

[[example_json_obsschema]]
.Example Observation Schemas for the JSON format
=================
This is an example schema for scalar observations:
[source%autofit,json]
----
include::../openapi/examples/schemas/observationSchema-scalar-json.json[]
----
This is an example schema for vector observations:
[source%autofit,json]
----
include::../openapi/examples/schemas/observationSchema-vector-json.json[]
----
=================

NOTE: All other observation properties are the same for all datastreams and thus described in the static schema provided in <<clause-json-observation>>.



[[clause-json-observation]]
==== Observation Encoding Rules
==== Observation Representation

[requirement,model=ogc]
====
Expand All @@ -79,6 +111,20 @@ part:: A JSON document containing a single `Observation` resource SHALL be valid
part:: A JSON document containing a collection of `Observation` resources SHALL be valid against the JSON schema {json-observation-collection-schema}.
====

[requirement,model=ogc]
====
[%metadata]
identifier:: /req/json/observation-constraints
statement:: The following constraints apply to `Observation` resources:
part:: The value of the `phenomenonTime` and `resultTime` properties SHALL be expressed in the UTC time scale, with an optional time offset.
part:: The value of the `result` property SHALL be encoded according to the `resultSchema` of the parent `DataStream`.
part:: The value of the `parameters` property SHALL be encoded according to the `parametersSchema` of the parent `DataStream`.
====

[[example_json_obs]]
.Observations in JSON format
=================
Expand All @@ -100,7 +146,7 @@ include::../openapi/examples/observations/obs-location.json[]


[[clause-json-controlstream]]
==== Control Stream Encoding Rules
==== ControlStream Representation

[requirement,model=ogc]
====
Expand All @@ -125,8 +171,36 @@ include::../openapi/examples/controlstreams/controlStream-ptz.json[]



[[clause-json-commandschema]]
==== Command Schema Representation

When using the `application/json` media type for commands, two separate schemas are provided to further describe the content of the `parameters` and `result` properties (the `result` schema is optional). Both schemas are provided as SWE Common data component tree in JSON format.

[requirement,model=ogc]
====
[%metadata]
identifier:: /req/json/commandschema-schema
part:: The `Command Schema` resource for media type `{json-mediatype}` SHALL be valid against the JSON schema {json-commandschema-schema-json}.
====

[[example_json_commandschema]]
.Example Command Schemas for the JSON format
=================
This is an example schema for PTZ commands:
[source%autofit,json]
----
include::../openapi/examples/schemas/commandSchema-ptz-json.json[]
----
=================

NOTE: All other command properties are the same for all control streams and thus described in the static schema provided in <<clause-json-command>>.



[[clause-json-command]]
==== Command Encoding Rules
==== Command Representation

[requirement,model=ogc]
====
Expand All @@ -138,6 +212,20 @@ part:: A JSON document containing a single `Command` resource SHALL be valid aga
part:: A JSON document containing a collection of `Command` resources SHALL be valid against the JSON schema {json-command-collection-schema}.
====

[requirement,model=ogc]
====
[%metadata]
identifier:: /req/json/command-constraints
statement:: The following constraints apply to `Command` resources:
part:: The value of the `issueTime` and `executionTime` properties SHALL be expressed in the UTC time scale, with an optional time offset.
part:: The value of the `result` property SHALL be encoded according to the `resultSchema` of the parent `ControlStream`.
part:: The value of the `parameters` property SHALL be encoded according to the `parametersSchema` of the parent `ControlStream`.
====

[[example_json_command]]
.Command in JSON format
=================
Expand All @@ -152,7 +240,7 @@ include::../openapi/examples/commands/command-ptz.json[]


[[clause-json-commandstatus]]
==== Command Status Encoding Rules
==== Command Status Representation

[requirement,model=ogc]
====
Expand Down Expand Up @@ -183,7 +271,7 @@ include::../openapi/examples/commandStatus/command-status-completed.json[]


[[clause-json-commandresult]]
==== Command Result Encoding Rules
==== Command Result Representation

[requirement,model=ogc]
====
Expand All @@ -198,7 +286,7 @@ part:: A JSON document containing a collection of `CommandResult` resources SHAL
[[example_json_command_result]]
.Command Result in JSON format
=================
These are example command status reports, encoded in JSON format:
These are example command results, encoded in JSON format:
[source%autofit,json]
----
Expand All @@ -218,7 +306,7 @@ include::../openapi/examples/commandResult/command-result-datastream.json[]


[[clause-json-systemevent]]
==== System Event Encoding Rules
==== System Event Representation

[requirement,model=ogc]
====
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,92 @@
:swe-json-mediatype: application/swe+json


[[clause-encoding-swejson]]
=== Requirements Class "SWE Common JSON Encoding"
include::../requirements/encoding/swecommon/requirements_class_swecommon_json.adoc[]
include::../requirements/encoding/swejson/requirements_class_swejson.adoc[]


==== Overview

This requirements class defines JSON encodings of `Observation` and `Command` resources based on <<SWECommon-JSON>>.
This requirements class defines JSON encodings for `Observation` and `Command` resources based on <<OGC-SWECOMMON,SWE Common 3.0>>.


==== Media Type

The media type to use to advertise support for this encoding is `application/swe+json`.
NOTE: Implementations should use *`application/vnd.ogc.swe+json`* as a preliminary media type until the <<OGC-SWECOMMON,SWE Common 3.0>> Standard is stable to avoid confusing future implementations accessing JSON documents from draft versions of the Standard. The media type `{swe-json-mediatype}` will be registered for SensorML-JSON, if and once this Standard is approved by the OGC Members. This note will be removed before publishing this Standard.

The media type used when using the SWE Common JSON encoding is *`{swe-json-mediatype}`*.

[requirement,model=ogc]
====
[%metadata]
identifier:: /req/swecommon-json/mediatype-read
part:: The server SHALL accept resource retrieval (read) requests with media type `{swe-json-mediatype}` for all resource types whose representation is specified in this requirements class.
part:: The response to such request SHALL be encoded as specified in the clause corresponding to the resource type.
====

[requirement,model=ogc]
====
[%metadata]
identifier:: /req/swecommon-json/mediatype-write
conditions:: The server implements <<clause-resource-crd,style=basic%>>.
part:: The server SHALL accept resource insertion (write) requests with media type `{swe-json-mediatype}` for all resource types whose representation is specified in this requirements class.
part:: The resource representation provided in the request SHALL be encoded as specified in the clause corresponding to the resource type.
====


[[clause-swejson-obsschema]]
==== Observation Schema Representation

The observation schema for the `{swe-json-mediatype}` media type is a SWE Common data component tree provided in JSON format.

[requirement,model=ogc]
====
[%metadata]
identifier:: /req/swecommon-json/obsschema-schema
part:: The `Observation Schema` resource for media type `{swe-json-mediatype}` SHALL be valid against the JSON schema {json-observationschema-schema-swe}.
====


[[clause-swejson-observation]]
==== Observation Representation

[requirement,model=ogc]
====
[%metadata]
identifier:: /req/swecommon-json/observation-encoding
part:: `Observation` resources SHALL be encoded according to the schema provided by the parent `DataStream`, using the encoding rules defined in https://docs.ogc.org/DRAFTS/24-014.html#encoding_rules_json[Clause 10.2: Requirements Class: JSON Encoding Rules] of <<OGC-SWECOMMON,SWE Common 3.0>>.
====


[[clause-swejson-comdschema]]
==== Command Schema Representation

The command schema for the `{swe-json-mediatype}` media type is a SWE Common data component tree provided in JSON format.

[requirement,model=ogc]
====
[%metadata]
identifier:: /req/swecommon-json/cmdschema-schema
part:: The `Command Schema` resource for media type `{swe-json-mediatype}` SHALL be valid against the JSON schema {json-commandschema-schema-swe}.
====


[[clause-swejson-command]]
==== Command Representation

[requirement,model=ogc]
====
[%metadata]
identifier:: /req/swecommon-json/command-encoding
part:: `Command` resources SHALL be encoded according to the schema provided by the parent `ControlStream`, using the encoding rules defined in https://docs.ogc.org/DRAFTS/24-014.html#encoding_rules_json[Clause 10.2: Requirements Class: JSON Encoding Rules] of <<OGC-SWECOMMON,SWE Common 3.0>>.
====
Loading

0 comments on commit 27f184a

Please sign in to comment.