w3c / w3c/wot-scripting-api

Semantic ConsumedThing part of Scripting API

Open
#527 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

API-improvement
Dominant language
HTML
Stars
45
Forks
21
PR merge metrics
No merged PRs in 30d

Description

With the current Scripting API one can interact with a ConsumedThing by knowing the interaction name, e.g., readProperty("temp"). If the interaction name is "temperature" instead of "temp" this needs to be updated accordingly.

Hence, what the current API does not offer is to interact with a thing based on the semantics attached to it like "read the temperature" no matter how the resource is named.

A possible addition to the current API could be to add a semantic layer around ConsumedThing that allows to ask for the temperature in a way that is independent of the interaction name, e.g, readSemanticProperty("iot:Temperature")

class SemanticConsumedThing extends ConsumedThing {

  readSemanticProperty(semanticType: string, options?: WoT.InteractionOptions): Promise<WoT.InteractionOutput> {
    // look for @type": "iot:Temperature" and call it based on the interaction name as of today
  }

  ...
}

The reason why I created this issue

  • I am wondering whether a SemanticConsumedThing API should be specified or left as an extension to implementations. In node-wot we have a VERY early version
  • Does it even make sense to standardize this behaviour? The benefit I see is that we could really say we can offer scripts that work across different vendors since any vendor is free to use any interaction name as long as the interaction is properly semantically typed

Note: There are many open points/questions. I just would like to get a first feedback about the feasibility to specify this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source files or tests are named in the issue. Start by reviewing the current ConsumedThing Scripting API and the early node-wot implementation in PR #1174, then determine whether semantic interaction support belongs in the specification or as an implementation extension; done means a resolved feasibility and scope decision.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.