W3C home > Mailing lists > Public > public-wot-ig@w3.org > January 2016

6. WoT Thing should move to a Band Architecture (Conclusion)

From: David Janes <davidjanes@davidjanes.com>
Date: Wed, 27 Jan 2016 09:03:29 -0500
Message-ID: <CACp1KyPLZrY2-ax2pHcj+e1Zjr-9mFOxR2bJGAHmk9+hyRiakg@mail.gmail.com>
To: "t2trg@irtf.org" <t2TRG@irtf.org>, public-wot-ig@w3.org
Formatted Version:

The Band architecture

The WoT Thing should move to a Band architecture, specifically:

   - istate - to model the "input state", the actual state of a Thing
   - ostate - to model the "output state", for sending commands /
   transitioning the State
   - meta - to store all the metadata
   - model - to store the Model, which defines what the values in "istate"
   and "ostate" mean

It's possible that there are more bands that could be added, for example
"reachability" (though I would lightly argue this belongs in the metadata).
it removes / adds / changes

What we've proposed massively cleans up the Thing definition.

For reference again

interface Thing: EventTarget {
    readonly attribute DOMString id;
    readonly attribute DOMString type;
    readonly attribute DOMString name;
    readonly attribute boolean reachable;
    attribute EventHandler onreachabilitychange;
    Promise<any> callAction(DOMString actionName, any parameter);
    Promise<any> setProperty(DOMString propertyName, any newValue)a;
    Promise<any> getProperty(DOMString propertyName);
    void addListener(DOMString eventName, ThingEventListener listener);
    void removeListener(DOMString eventName, ThingEventListener listener);
    void removeAllListeners(DOMString eventName);

Basically we end up really needing is:

* id: the immutable ID
* band() (to retrieve a particular band)
* on() - or addListener if you prefer
* removeListener()
* removeAllListeners()

And a Band interface that looks like this

* set()
* get()

And possibly also:

* first()
* list()
* on()

There would be also something to invoke an Action, which as argued earlier,
I believe should return a new Thing.
it looks like

Note there's other ways this could be coded, but they're basically all
isomorphic to this:

## change the name
    .set("schema:name", "David's WeMo");

## get the name
    .get("schema:name")     ## could be a string, list or null
    .first("schema:name")   ## guarantees one thing
    .list("schema:name")    ## guarantees a list

## wait for metadata changes
    .on("meta", function(...))

## wait for something specifically to change in metadata
    .on("schema:name", function(...))

## reachability change (assuming we make reachability its
## own band - IOTDB includes it as metadata
    .on("reachability", function(...))

## directly manipulate a term: not that great, because we don't
## necessarily assume "on" or "powered" or "o" or whatever
## means that the thing is on
    .set("powered", true)

## __semantically___ manipulate a term: way better!
## note that "iot-purpose:on" needs to be looked up in the meta band
    .set("iot-purpose:on", true)

## get a current value __semantically__

it adds

This also makes creating APIs trivial, it simplifies the code base, it
makes it easier for data to be moved around.

Here's an example of Transports built around this infrastructure. All the
data needed to work with the Things is in here, and the code to do so is
almost trivial.

   - coap://
   - mqtt://
Received on Wednesday, 27 January 2016 14:04:20 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 27 January 2016 14:04:20 UTC