Skip to content

Commit 316c876

Browse files
committed
Add a fourth application scenario regarding model and message conversion
1 parent 70b9e25 commit 316c876

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

draft-ietf-asdf-instance-information.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,102 @@ sdfInstance:
766766
{:sdf #code-snapshot-with-actions-and-events
767767
title="Example of an SDF Snapshot Messages that reports an action and an event history."}
768768

769+
# Model and Message Conversion
770+
771+
SDF messages increase the semantic capabilities of SDF, which means that it can cover more ecosystem-specific concepts when used as a conversion input or output.
772+
This allows us to better cover description formats that use instance-related information in their data models, but poses a challenge when the distinction from model-related information is not clearly drawn.
773+
774+
{{code-wot-td-example}} shows an initial example from the Web of Things (WoT) ecosystem that uses a CoAP Protocol Binding in its property affordance `status`.
775+
Analyzing this model, we can quickly see that most of the information contained is actually model-related information that could apply to other lamps as well.
776+
This includes the schema information for the status, the security mode (or lack thereof) as well as the protocol binding information.
777+
Important exceptions are the hostname or (in this case) the IP address of the Thing, its `id` as well as its `title` that are specific to this device.
778+
779+
~~~ yaml
780+
"@context":
781+
- https://www.w3.org/2022/wot/td/v1.1
782+
- cov: http://www.example.org/coap-binding#
783+
id: urn:uuid:b38acf9d-493c-408c-90bf-868c1f5326d4
784+
title: CoAP Lamp No. 2
785+
description: A lamp example that uses CoAP.
786+
securityDefinitions:
787+
nosec_sc:
788+
scheme: nosec
789+
security:
790+
- nosec_sc
791+
properties:
792+
status:
793+
type: string
794+
readOnly: true
795+
forms:
796+
- cov:method: GET
797+
href: coap://[2001:DB8::1]/status
798+
contentType: application/cbor
799+
cov:contentFormat: 60
800+
op:
801+
- readproperty
802+
~~~
803+
{:sdf #code-wot-td-example check="json" pre="yaml2json"
804+
title="WoT TD example showcasing a mix of model and instance information."}
805+
806+
{{code-sdf-model-for-wot-example}} illustrates how an SDF model can cover the model-related information from the WoT TD example.
807+
Note that this example contains a separate `ipAddress` property that is used for this piece of context information that serves as a paramter for resolved CoAP URL.
808+
809+
~~~ sdf
810+
namespace:
811+
lamps: https://example.com/lamps
812+
defaultNamespace: lamps
813+
sdfObject:
814+
lamp:
815+
title: CoAP Lamp
816+
description: A lamp example that uses CoAP.
817+
sdfProperty:
818+
ipAddress:
819+
type: string
820+
status:
821+
type: string
822+
writable: false
823+
observable: false
824+
sdfProtocolMap:
825+
coap:
826+
sdfParameters:
827+
ipAddress: "#/sdfObject/lamp/sdfProperty/ipAddress"
828+
sdfOperations:
829+
read:
830+
method: GET
831+
href: /status
832+
contentFormat: 60
833+
~~~
834+
{:sdf #code-sdf-model-for-wot-example
835+
title="SDF model containing the model-related information from the previous WoT example."}
836+
837+
{{code-sdf-message-for-wot-example}} in turn shows an SDF message that contains only the instance-related information from the WoT TD example.
838+
Besides the rather contextual `ipAddress`, this includes also the current value of the `status` property.
839+
The `id` that was part of the WoT TD has been mapped to the `thingId` quality under `sdfInstance`.
840+
The instance-specific `title` has no real equivalent in SDF messages yet, but it could be added to `sdfInstance` in future revisions.
841+
842+
~~~ sdf
843+
info:
844+
title: Example SDF Snapshot Message for CoAP Lamp No. 2.
845+
messageId: 75532020-8f64-4daf-a241-fcb0b6dc4af3
846+
namespace:
847+
lamps: https://example.com/lamps
848+
defaultNamespace: lamps
849+
sdfInstanceOf:
850+
model: models:/sdfObject/lamp
851+
sdfInstance:
852+
thingId: urn:uuid:b38acf9d-493c-408c-90bf-868c1f5326d4
853+
"$comment": Should we put the Thing's title here?
854+
sdfProperty:
855+
ipAddress: 2001:DB8::1
856+
status: "on"
857+
~~~
858+
{:sdf #code-sdf-message-for-wot-example
859+
title="SDF message containing the instance-related information from the previous WoT example."}
860+
861+
While these examples highlight the potential of instance-related messages for a clean separation of model and instance information, they also raise a number of questions, for example about the role of namespaces for SDF conversion results and the location where the resulting SDF models may be stored to potentially make them accessible to consumers.
862+
In practice, these questions may not be as relevant when converting from SDF to (in this case) WoT or when using SDF only as an internal translation medium for bridging between two ecosystems.
863+
However, these considerations emphasize the need for a set of standardized, reusable building blocks that can also be used for model and message conversion.
864+
769865
# Discussion
770866

771867
(TODO)

0 commit comments

Comments
 (0)