Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine Groups API #2939

Closed
benfrancis opened this issue Jul 7, 2022 · 1 comment
Closed

Refine Groups API #2939

benfrancis opened this issue Jul 7, 2022 · 1 comment
Labels
Milestone

Comments

@benfrancis
Copy link
Member

benfrancis commented Jul 7, 2022

The current groups implementation adds a proprietary group_id member to Thing Descriptions to denote the group a Thing belongs to.

I'd like to change this to be more standards compliant, and there are a couple of ways I can think of for doing that:

Links

Since this feature was implemented, the draft W3C WoT Thing Description 1.1 specification now defines some best practices for links within Thing Descriptions, which includes a link relation type called collection. This collection link relation is recommended for linking to "collections of Things", which seems like exactly what we're doing here.

It isn't clear from the specification what kind of resource a collection link should point to - whether it should a Thing, a Directory, or whether it can be any resource which describes a collection of Things. I'm going to ask for advice on that.

Edit: See w3c/wot-thing-description#1567

Vendor Prefix

If the link approach seems too cumbersome, another approach would be to vendor-prefix this metadata and make it WebThings-specific. This would be the easiest solution but would not be useable by third party Web of Things consumers. See #2832

@benfrancis
Copy link
Member Author

Whilst it's tempting to use the standardised collection link relation to denote that a Thing belongs to a group, it's still not clear how that's supposed to be used. The "group" is not really a "Thing" in that it doesn't have its own affordances.

My current thinking is therefore to go with the second option and include this WebThings-specific metadata using a vendor prefix, via a TD context extension.

Groups are currently identified in the gateway using an UUID. One possibility is that we turn this UUID into a URN. URNs are used as IDs in the WoT Directory specification and are looking to be the recommended ID format in the WoT Profile specification as well.

If we vendor prefix other existing and upcoming proprietary WebThings Thing Description members as well, then it might look something like:

{
  "@context": [
    "https://www.w3.org/2022/wot/td/v1.1",
    { "wt": "https://webthings.io/schemas" }
  ]
  "@type": "wt:Light",
  "id": "https://foo.webthings.io/things/thing1",
  "wt:groupId": "urn:uuid:4ee6bdc0-d50e-4362-a88d-73b42c73c03b",
  "wt:buildingId": "urn:uuid:129856ec-1ea8-460c-a30a-e34c1bca2fad",
  "wt:floorLevel": "G",
  "wt:floorplanX": 15.6,
  "wt:floorplanY": 16.2
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant