-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from FadySalama/main
migrate issues of 09.2021 plugfest to md files
- Loading branch information
Showing
11 changed files
with
713 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
# Geolocation | ||
Related issue: https://github.com/w3c/wot-testing/issues/167 | ||
|
||
## Participants: | ||
## Participants | ||
|
||
* McCool - Intel | ||
|
||
## Description | ||
Issue description | ||
|
||
* Ontology for embedding geolocation data in TDs and in Thing | ||
* Example TDs and services | ||
* Geolocation filters in SPARQL | ||
* See Intel TDs and Project | ||
|
||
## Discussion | ||
Comments from issue | ||
|
||
* Need way to distinguish fetching data from a TD itself vs. from an interaction the TD describes | ||
* Problem may also be more general and apply to other kinds of data, e.g. temperature | ||
* May also be other kinds of data that is static vs dynamic, and described by separate thing | ||
* Need to think about JSON pointer syntax related to TD fragment identifier (IANA registered, assuming) | ||
|
||
## Related Documents and Links | ||
|
||
* [WoT Discovery Geolocation](https://github.com/w3c/wot-discovery/blob/main/proposals/geolocation.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
# Hypermedia protocol proposal 3 | ||
|
||
## Description | ||
|
||
Sorry for posting this late, but I couldn't join the last two days of the PF and I didn't have time to create a proper project description. | ||
|
||
In this plug-fest, I played a little bit with the third proposal of the Hypermedia protocol for actions. I created a [repository](https://github.com/relu91/wot-hypermedia-test) with a bunch of testing scripts that I used to evaluate the idea. | ||
|
||
Here I'm reporting the consumer side because I think it helps to understand the advantages of this new approach. | ||
|
||
### Greenfield | ||
|
||
For new WoT aware ExposedThings the consumer can just assume that action may return an ActionDescription and use it to interact further with the action instance. Notice how no id tracking is need, the code flow is really similar to what the consumer already does for a normal WebThing: | ||
|
||
```js | ||
WoTHelpers.fetch("http://localhost:8080/testingactions").then( async td => { | ||
const thing = await WoT.consume(td); | ||
|
||
if (!td.actions.longRunning || td.actions.longRunning.output.model.href !== "http://localhost:8888/model.tm.json") { | ||
console.log("Long Running action is synchronous"); | ||
await thing.invokeAction("longRunning"); | ||
return; | ||
} | ||
|
||
console.log("Long Running action is asynchronous"); | ||
|
||
const actionInstance = await (await thing.invokeAction("longRunning")).value(); | ||
console.log("Action invoked",actionInstance.id); | ||
|
||
// from here on I can use the action as if it is a webthing | ||
const actionThingHandler = await WoT.consume(actionInstance); | ||
console.log("Monitoring", actionInstance.id); | ||
|
||
const interval = setInterval(async () => { | ||
try { | ||
const status = await (await actionThingHandler.readProperty("status")).value(); | ||
console.log("Status", status); | ||
|
||
if (status.status === "completed" || status.status === "cancelled") { | ||
console.log("Action has stopped:", status.status); | ||
clearInterval(interval); | ||
} | ||
|
||
if(Math.random() < 0.1){ | ||
// cancel with action with 10% probability | ||
console.log("Cancelling action"); | ||
await actionThingHandler.invokeAction("cancel"); | ||
} | ||
|
||
} catch (error) { | ||
console.log("Can't read", error); | ||
} | ||
|
||
}, 1000); | ||
|
||
}).catch(e => { | ||
console.log(e); | ||
}); | ||
``` | ||
|
||
### Brownfield | ||
|
||
For brownfield ExposedThings (i.e., devices that already have their own API and we cannot return an Action Description from an API call). The consumer has to do additional operations to obtain the final ActionDescription but I think it is reasonably easy to then interact with the action instance. | ||
Here's the script: | ||
|
||
```js | ||
const pointer = require('jsonpointer'); | ||
|
||
WoTHelpers.fetch("http://localhost:8080/testingactions").then(async td => { | ||
const thing = await WoT.consume(td); | ||
|
||
if (!td.actions.longRunning || td.actions.longRunning.output.model.href !== "http://localhost:3000/model-brown.tm.json") { | ||
console.log("Long Running action is synchronous"); | ||
await thing.invokeAction("longRunning"); | ||
return; | ||
} | ||
|
||
console.log("Long Running action is asynchronous"); | ||
|
||
if(!td.actions.longRunning.output.model.mappings) { | ||
console.log("Long Running action has not mappings -> is a green field device skipping"); | ||
console.log("See example: consumer.js"); | ||
return; | ||
} | ||
|
||
|
||
const actionInstance = await (await thing.invokeAction("longRunning")).value(); | ||
console.log("Action invoked", actionInstance.id); | ||
|
||
//Create a "Action Description" from actionInstance and tm | ||
const tm = await WoTHelpers.fetch(td.actions.longRunning.output.model.href); | ||
let tmString = JSON.stringify(tm); | ||
|
||
const mappings = td.actions.longRunning.output.model.mappings; | ||
for (const p in td.actions.longRunning.output.model.mappings) { | ||
const variable = mappings[p]; | ||
const value = pointer.get(actionInstance, p); | ||
const exp = new RegExp(`{{${variable}}}`, 'g'); | ||
|
||
tmString = tmString.replace(exp, value); | ||
|
||
} | ||
|
||
const actionDescriptor = JSON.parse(tmString); | ||
// action description contains the TD that can be used to interact with the action | ||
const actionThingHandler = await WoT.consume(actionDescriptor); | ||
|
||
const interval = setInterval(async () => { | ||
try { | ||
const status = await (await actionThingHandler.readProperty("status")).value(); | ||
console.log("Status", status); | ||
|
||
if (status.status === "completed" || status.status === "cancelled") { | ||
console.log("Action has stopped:", status.status); | ||
clearInterval(interval); | ||
} | ||
|
||
if (Math.random() < 0.1) { | ||
// cancel with action with 10% probability | ||
console.log("Cancelling action"); | ||
await actionThingHandler.invokeAction("cancel"); | ||
} | ||
|
||
} catch (error) { | ||
console.log("Can't read", error); | ||
} | ||
|
||
}, 1000); | ||
|
||
}).catch(e => { | ||
console.log(e); | ||
}); | ||
``` | ||
|
||
I want to underline that all of this already works with `node-wot` as it is, no API changes are needed. | ||
|
||
## Participants | ||
|
||
* Cristiano Aguzzi (@relu91) |
38 changes: 38 additions & 0 deletions
38
events/2021.09.Online/RESULTS/Node-Red integration (SPARQL query)/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Node-RED integration (SPARQL query) | ||
|
||
## Description | ||
|
||
* Directory-based discovery (using SPARQL) and auto-population | ||
|
||
## Participants | ||
|
||
* Kunihiko Toumura (@k-toumura) | ||
|
||
## Activities | ||
|
||
* [x] Check availability of Things and Directories | ||
* [x] Create UI for querying Directory from Node-RED | ||
* [x] Test auto-population feature using participating Things | ||
|
||
Current implementation uses following simple SPARQL query: | ||
```sparql | ||
PREFIX td: <https://www.w3.org/2019/wot/td#> | ||
PREFIX dc: <http://purl.org/dc/terms/> | ||
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
SELECT DISTINCT ?id ?title ?desc | ||
WHERE { | ||
?id rdf:type td:Thing; | ||
dc:title ?title; | ||
dc:description ?desc. | ||
FILTER(contains(?desc, "${query}")). | ||
} | ||
LIMIT 100 | ||
``` | ||
(`${query}` = input from Node-RED search UI) | ||
|
||
## Related Documents and Links | ||
* [Draft result](https://github.com/k-toumura/document-for-wot/blob/master/2021-10-01-nodered-directory-ktoumura.pdf) | ||
|
||
* The slides used in Openday (Oct 11) can be found below: | ||
* [PowerPoint](https://github.com/w3c/wot/blob/main/PRESENTATIONS/2021-10-online-f2f/2021-10-11-WoT-F2F-Openday1-ktoumura.pptx) | ||
* [PDF](https://github.com/w3c/wot/blob/main/PRESENTATIONS/2021-10-online-f2f/2021-10-11-WoT-F2F-Openday1-ktoumura.pdf) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
# Summary of Results from 2021.09 WoT Plugfest | ||
|
||
## Projects | ||
|
||
* [Node-RED integration (SPARQL query)](./Node-Red%20integration%20(SPARQL%20query)/README.md) | ||
* [Geolocation](Geolocation) | ||
* [Siemens / Logilab TDD](Siemens-LogiLab-TDD) | ||
* [SDF Conversion](SDF-Conversion) | ||
* [Shadow Proxy - Fujitsu](ShadowProxy) | ||
* [Hypermedia protocol proposal 3](Hypermedia) | ||
* [WoT Device Emulator](WoT-Device-Emulator) | ||
* [UPM / WoT Hive directory](UPM-WoTHive-Directory) | ||
* [TM Composition](TM-Composition) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# SDF Conversion | ||
|
||
## Description | ||
Add SDF models from the [oneDM playground](https://github.com/one-data-model/playground) to the plugfest directory which have been converted to TMs using my [sdf-wot-converter](https://github.com/JKRhb/sdf-wot-converter-py). For reducing redundancy, the models were added as a submodule pointing to a [separate repository](https://github.com/JKRhb/onedm-playground-wot-tm) | ||
|
||
## Participants | ||
|
||
* Jan Romann (@JKRhb) | ||
* Michael McCool (@mmcool) | ||
|
||
## Discussion | ||
|
||
* would be useful to have a link back to the source data (a general issue when one thing is generated from another) and also to name the corresponding sdf model | ||
* not clear how exactly to map sdfObjects to TM modularity; currently flattening | ||
* accelerometer is a possible candidate for a geolocator; can it be annotated with the proposed geolocation ontology? | ||
* some issues as well with vector values being provided component by component. Are these measured at the same time, or different time? Are they registered, and if so, should there be an action to trigger a "reading"? | ||
* schemas that can group elements of a vector (or label them) would be useful | ||
|
||
## Related Documents and Links | ||
|
||
* [Related PR](https://github.com/w3c/wot-testing/pull/177) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Shadow Proxy - Fujitsu | ||
|
||
## Description | ||
|
||
Shadow Proxy - Fujitsu | ||
|
||
## Participants | ||
|
||
* Ryuichi Matsukura (@mryuichi) | ||
|
||
## Related Documents and Links | ||
|
||
* [Related PR](https://github.com/w3c/wot-testing/pull/181) | ||
|
||
* The presentation slides: | ||
* [PDF](https://github.com/mryuichi/documents/blob/master/Fujitsu-plugfest-TPAC2021.pdf) | ||
* [PPT](https://github.com/mryuichi/documents/blob/master/Fujitsu-plugfest-TPAC2021.pptx) |
Oops, something went wrong.