20240508 QFM014 Elixir Reading List April 2024.pdf
ย
Research Topics in Machine Hypermedia
1. Research Topics in Machine
Hypermedia System Design
IRTF Thing to Thing Research Group
March 15, 2016
2. Research Goals
โข Investigate design patterns for interoperable
hypertext driven machine interfaces
โข Investigate RESTful design patterns for
sensing and actuation
โข What is the role of modeling and ontology in
semantic interoperability?
3. Research Topics
โข Reference System Architecture
โข Content Format Design
โข RESTful Asynchronous Communication
โข RESTful Actuation
โข REST Protocol Abstraction
โข Model Based Hypertext Annotation
5. Content Format Design
โข What should a content-format describe?
โข Representation Formats
โข Common Interaction Model
โ Resource model e.g. CoRE Interfaces
โ Data model e.g. SenML
โ How links work, e.g. CoRE Link-Format
โ How forms work
โ How relation types are used
โ Some base relation types
6. Content Format Design
Protocols
Representation Formats
Common Interaction Model
Application Meta-Model
Application Domain Model
HTTP, CoAP, RD, Web Linking
SenML, Link-Format, HTML
Resources, Links, Forms, Collections
Link Relations, Form Relations
Resource Types, Ontology
hsml
content type
describedBy
relation type
7. Resource Model
Link Item
Link Item
Link
Link
Link (self)
(sub)
Link
Collection
Link Item
Link
Link
Link
Form
Link Item
Sub Resource Collection
Collection
Link
Link
Collection
Link
8. Representation Format Example
{
"bn": "/light/onOff/currentState/",
"e": [
{
"vb": false,
"n": ""
}
],
"l": [
{
"href": "",
"rel": ["self","item"],
"rt": ["property", "currentstate"],
"ct": ["application/senml+json"]
}
]
}
Items may be represented in SenML
Links may be represented in CoRE link-format
9. Forms
{
"anchor": "/light3/brightness/",
"rel": "invokeAction",
"type": "change",
"method": "post",
"href": "actuations",
"accept": "application/hsml+json",
}
To "invokeAction" of type "change" on the
"/light3/brightness/" resource, perform a "post"
to the resource at "/light3/brightness/actuations"
using the "application/hsml+json" content format
10. Link and Form Relations
โข Link Relations
โ "item" (an embedded item in a collection)
โ "sub" (a subresource item in a collection)
โ "form" (a form item in a collection)
โ "grp" (a group interaction link)
โข Form Relations
โ "addItem" (add an item to a collection)
11. RESTful Asynchronous Communication
โข REST interaction is a state machine between
client and server โ request and response
โข Asynchronous Communication using REST is
one or more state transition responses that
take place after a request is made
โข Two classes of interaction:
โ Between resources and applications
โ From Resource to Resource
12. Resource to Application
โข CoAP Observe is a RESTful asynchronous communication
method
โข Client application makes state changes based on server
responses
โข Server is the name and state origin of the resource
ServerClient
OBSERVE
Responses
13. Resource to Application
โข PUT or POST can be used for the client to update the state of
the server
โข Client application changes state on server asynchronously
โข Server is the name and state origin of the resource
ServerClient
PUT/POST
Responses
14. Resource to Resource
โข A client instance may be "bound" to a resource and perform
state transfer between it and another resource
โข Observe binding updates the state of the locally bound
resource based on responses from the "boundTo" resource
โข Server B is the name and state origin of the resource
Server B
OBS
Bind
Observe
ResponsesServer A
15. Resource to Resource
โข Push binding observes the state of the locally bound
resource and updates the "boundTo" resource
โข Local binding may incorporate a filter and may be forms-
capable
โข Server B is the name and state origin of the resource
Server B
Push
Bind
PUT/POST
ResponsesServer A
(obs)
16. Promise+
โข Pattern for application scripts to handle
recurring events like notifications from
resource observations
โข Extends the Promise pattern with an update
handler for recurring events
res.observe().then(onResolve, onReject, onUpdate)
(โฆdo other stuff)
onUpdate(value){
processStateUpdate(value)
17. HTTP Observe
โข Using a technique based on HTML5 Server Sent
Events (SSE)
โข Header "Transfer-Encoding:chunked" enables
open TCP connection to be used for
asynchronous messages
โข Messages could be formatted as HTTP Response
and header lines, with content-type and content-
length controls
โข Header options e.g. Observe:0 could be used to
create a CoAP-compatible observe for HTTP
18. RESTful Actuation
โข What is RESTful actuation?
โข Change of state on a resource that has some
effect in the physical world
โข Many different interpretations of this:
โ Update of a resource directly changes physical state
โ Update of a resource communicates intended state
โ Creation of a resource that describes the intended
state transition
โ Update of a setpoint resource of a controller
19. Update State Resource
โข There is always some uncertainty, e.g. the
physical process may fail or be delayed
โข Will the state returned on a subsequent read
reflect the intended state or the actual state?
โข Intended state is technically RESTful but not
useful
โข Actual state is useful but not RESTful
โข Delaying the response until intended state is
observed might workโฆ
20. Update Intended State Resource
โข This will be both RESTful and Useful
โข Allows a REST response to be generated for
the intended state and application can then
monitor observed state
โข This could work, but what about where we
want to parameterize execution with
transition times, etc? How do we know if the
action is going to succeed or fail?
21. Create a State Transition Resource
โข This is RESTful and useful, using the resource
create pattern with a form, and returning a
resource location that can be monitored for
state changes
โข Allows asynchronous notification and promise
to be used to track progress, success, failure of
running actions, also to modify or cancel
โข Multiple actions may be queued
22. Controllers
โข Thermostat is an example of a controller
โข Temperature setting is a set-point that is input
to a controller algorithm that decides whether
to operate an actuator based on the
relationship of the set-point to the measured
temperature, and perhaps other variables
โข Thermostat has measurement temperature
and set-point temperature inputs, and an
actuator state output.
23. REST Protocol Abstraction
Application Logic
Common CRUD Requests
MQTT
Common CRUD Responses
Resource Model
Resources
Resource Model
Thing Object Model
HTTP
CoA
P
Common Server
Common Client
Pluggable
Protocols
Resource Logic
WS
25. Common CRUD
(IP)
Send/Rcv
(PHY)
Send/Rcv
URI Topic, URI
(IP)
Send/Rcv
(PHY)
(IP)
Pub/Sub
(PHY)
(IP)
Trx
(PHY)
URIURI
REST REST REST
CoAP HTTP MQTT WS CCML
URI
RESTREST
โข Map abstraction to HTTP and CoAP request and responses
โข Encapsulate the abstraction in WS and MQTT payloads
26. Consistent Resource Identifiers:
Cross-Protocol Hyperlinking
http://example.com:8000/b31/env/light/onoff
coap://example.com:5683/b31/env/light/onoff
ws://example.com:80/b31/env/light/onoff
mqtt://example.com:1883/b31/env/light/onoff
Mapped to URI
Mapped to URI
Part Topic --- Part Payload
Encapsulated in Payload
27. Model Based Hypertext Annotation
PropertyEvent Action
(Capability)
Subscription
Notification
Actuation
Thing
Index
Capability
Notification
Capability
Index
has
pointsTo
28. Domain Schema and Model
โข Reusable terms with mayHave and usedBy definitions
โ โbrightnessโ is used by โlightโ but not โmotion sensorโ
โ โbrightnessโ may have โchangeโ action but not โopenโ
class: brightness,
type: capability,
description: โbrightness controlโ
usedBy: [ light ],
mayHave: [
currentBrightness, targetBrightness,
stepBrightness, moveBrightness,
change, step, move, stop,
propertyValueChange ],
params: {_
targetValue: _targetBrightness,
_stepSize: _stepBrightness,
_moveRate: _moveBrightness},}
30. Demonstrator and Reference
Implementation
โข Machine Hypermedia Toolkit is an open
source reference implementation
https://github.com/connectIOT/MachineHypermediaToolkit
โข Demonstrator resource on Github for tutorial
introduction
https://github.com/connectIOT/HypermediaDemo