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

Change @context of Thing Descriptions #2809

Closed
benfrancis opened this issue Mar 8, 2021 · 3 comments
Closed

Change @context of Thing Descriptions #2809

benfrancis opened this issue Mar 8, 2021 · 3 comments
Labels
task w3c-compliance wot-thing-description W3C WoT Thing Description specification
Milestone

Comments

@benfrancis
Copy link
Member

benfrancis commented Mar 8, 2021

Blocks: #2802

Once the Thing Descriptions exposed by the gateway are W3C compliant, we should update the @context member to include the string https://www.w3.org/2019/wot/td/v1 to reflect that.

Open questions:

  1. We still want to be able to provide https://webthings.io/schemas/ as a context in order to add semantic annotations from the WebThings capability schemas. Does this mean we'll need to add a prefix to all of those annotations? e.g.
{
  "@context": ["https://www.w3.org/2019/wot/td/v1", {"wt": "https://webthings.io/schemas/"} ],
  "@type": ["wt:Light", "wt:OnOffSwitch"],
  "id": "https://mywebthingserver.com/things/lamp",
  "title": "My Lamp",
  "description": "A web connected lamp",
  "properties": {
    "on": {
      "@type": "wt:OnOffProperty",
    },
    "brightness" : {
      "@type": "wt:BrightnessProperty",
    }
  },
  "actions": {
    "fade": {
      "@type": "wt:FadeAction"
    }
  },
  "events": {
    "overheated": {
      "@type": "wt:OverheatedEvent"
    }
  }
}

Note: This should only be done once we've made all the other changes to make Thing Descriptions W3C compliant.

See WebThingsIO/api#157 for some past discussion

@benfrancis benfrancis added this to the 2.0 milestone Mar 8, 2021
@benfrancis
Copy link
Member Author

1. Does this mean we'll need to add a prefix to all of those annotations?

I think I'm right in saying that as long as there aren't collisions in the annotation names, it would be possible to add the WebThings schema annotations without a prefix. E.g.

{
  "@context": [
    "https://www.w3.org/2019/wot/td/v1",
    "https://webthings.io/schemas/" 
  ],
  "@type": ["Light", "OnOffSwitch"],
  "id": "https://mywebthingserver.com/things/lamp",
  "title": "My Lamp",
  "description": "A web connected lamp",
  "properties": {
    "on": {
      "@type": "OnOffProperty",
    },
    "brightness" : {
      "@type": "BrightnessProperty",
    }
  },
  "actions": {
    "fade": {
      "@type": "FadeAction"
    }
  },
  "events": {
    "overheated": {
      "@type": "OverheatedEvent"
    }
  }
}

@benfrancis
Copy link
Member Author

Note: The context URL for TD 1.1 has now been specified as https://www.w3.org/2022/wot/td/v1.1, which is what we should use.

benfrancis added a commit to benfrancis/gateway that referenced this issue Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task w3c-compliance wot-thing-description W3C WoT Thing Description specification
Projects
Status: Done
Development

No branches or pull requests

1 participant