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

Support for multiple @context (aka support for Linked Data) #157

Open
Martinocom opened this issue Jan 6, 2021 · 4 comments
Open

Support for multiple @context (aka support for Linked Data) #157

Martinocom opened this issue Jan 6, 2021 · 4 comments

Comments

@Martinocom
Copy link

The status

The W3C standard for the Thing Description, as of the status on 06/01/2021, describe that it is possible to use multiple context value, passing an array of values.

"@context": [
  "https://www.w3.org/2019/wot/td/v1", {
    "v": "http://www.example.org/versioningTerms#",
    "saref": "https://w3id.org/saref#",
    "om": "http://www.ontology-of-units-of-measure.org/resource/om-2/"
   }
]

Specification can be found in 5.3.1.1 - Thing .
An example of this can be found here and here.

The problems

  1. Specification of the WebThing API is different from the official recommendation of W3C, but is very simple to read and understand: please keep it simple!

  2. This project (like others linked in the official source) has a hard-coded @context to "https://iot.mozilla.org/schemas" that is also no more maintained and prompt to switch into the "https://webthings.io/schemas/". The site says:

Note: This document is no longer maintained and has been replaced by a new specification at webthings.io/schemas.

  1. As a student of University of Bologna I'm doing a small research about WoT and Linked Data. Giving me the possibility to utilize more @context in the Thing Description opens a standardized way to describe ALL the data I have inside a Thing, but this is not possible due this limitation. I cannot indicate more @context and I'm forced to do all referenced to the hard-coded "https://iot.mozilla.org/schemas" that allows me to use only that one hard-coded (not supported) ontology.

To point out better, the Example 28 is NOT compatible with WebThings API, since implements more than one @context.

Without this ability, I'm not able to proceed in my project: I need to contextualize my data in ontologies like SAREF, IoT-Lite, IoT-S and even the less significant ones like ontology-of-units-of-measure or DBpedia to give more opportunities to get ALL the possible data of the system. Why? With that many knowledge it's possible to understand the system, where the things are, and try to create actions that was not originally planned, but can be achieved mixing behaviors of different things.

I don't know if it's planned or not, but I really need this feature.
If not, I'm planning to "wrap" the requested Thing Description into a bigger one with all the ontologies I need to use, and then indicate for the WebThing library the "minimized" version of it.

mrstegeman referenced this issue in mrstegeman/webthing-java Jan 7, 2021
References #58
@mrstegeman mrstegeman transferred this issue from WebThingsIO/webthing-java Jan 7, 2021
@mrstegeman
Copy link
Contributor

(Moved from webthing-java repo)

@Martinocom I've fixed your second point via WebThingsIO/webthing-java@14ea1c7

@benfrancis
Copy link
Member

@Martinocom Is the issue that you need to expose multiple contexts in the Thing Description, or that you need to consume multiple contexts from the Thing Description? I'm assuming it's the former given you originally filed this issue on the Java web thing library. Consuming multiple contexts using the WebThings Gateway's web thing adapter probably doesn't emit an error, but isn't explicitly supported yet.

This is one of the many differences between the Mozilla and W3C specifications that I intend to fix in a future version, potentially later this year, but I'm afraid it's going to take a long time to make these changes across all the WebThings libraries and gateway.

@mrstegeman In the meantime is there an easy way for Marcin to override the @context of a thing using the Java web thing library so that Marcin can add this feature for specific devices?

@mrstegeman
Copy link
Contributor

@mrstegeman In the meantime is there an easy way for Marcin to override the @context of a thing using the Java web thing library so that Marcin can add this feature for specific devices?

No, it's hard-coded to use our schema URL.

@Martinocom
Copy link
Author

If can be useful for someone, I made some researches about current libraries and what they can achieve. I still think that WebThings has the bigger potential (also 'cos I wanted to use some Kotlin to develop my apps), but for my purposes, as said, I cannot have one hardcoded URL for schema. Alternatives that I found are:

  • WebThings: this library 👍 , but lack of support for multiple @context
  • Arena Web Hub: lack of support for multiple @context
  • ThingWeb: only NodeJS but does not change the @context value; not sure about support, but still better than nothing
  • SmartThings: not suitable for creating Web Things
  • jpasqua-WebThing or webthing-arduino: only arduino ones (no virtual devices)

I switched currently on ThingWeb and I'm figuring out how use a raw REST API for it.

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

No branches or pull requests

3 participants