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

WOT TD round tripping for securityDefinitions #1193

Closed
Murloc6 opened this issue Jul 15, 2021 · 0 comments · Fixed by #1289
Closed

WOT TD round tripping for securityDefinitions #1193

Murloc6 opened this issue Jul 15, 2021 · 0 comments · Fixed by #1289
Assignees

Comments

@Murloc6
Copy link

Murloc6 commented Jul 15, 2021

We attacked the WOT security round-tripping problem under a new angle than #1125.

If we use this specific TD as input:

{
  "@context": {
    "td": "https://www.w3.org/2019/wot/td#",
    "security": {
      "@id": "td:hasSecurityConfiguration",
      "@type": "@id"
    },
    "securityDefinitions": {
      "@id": "td:securityDefinitions",
      "@type": "@id",
      "@container": "@index",
      "@context": {
        "scheme": {
          "@id": "rdf:type",
          "@type": "@vocab"
        }
      }
    }
  },
  "@id": "toto",
  "@type": "td:Thing",
  "security": [
    "basic_sc"
  ],
  "securityDefinitions": {
    "basic_sc": {
      "scheme": "basic"
    }
  }
}

With the current context, we obtain the following RDF triples playground.
The "basic_sc" information from the "securityDefinitions" is lost.

If we try to frame this example with the current context, we obtain the following json-ld playground.
The "basic_sc" key on "securityDefinitions" is lost.

We first thought about using the same URI for "basic_sc" in "security" and "securityDefinitions" (c.f. #1167) however this case cannot be easily framed in json-ld because the same object is used in various fields. For example, here playground, we used "@container":"@id" for securityDefinitions so that the "basic_sc" URI is used in both RDF triples (securityDefinitions and hasSecurityConfiguration). However, when framing it (c.f. playground), the securityDefinitions information are moved to the security field.

The most satisfying solution we found is to define a new relation between the security definition node and the security configuration URI. Here we propose to use the relation "td:securityDefinitionForSecurityConfiguration" between them. playground.
As you may see here, there is a new triple:

_:b0 <https://www.w3.org/2019/wot/td#securityDefinitionForSecurityConfiguration> <https://json-ld.org/playground/basic_sc> .

which links both nodes.
Once framing it back with the same context, (c.f. playground) the round-tripping works fine.

This solution requires the defintion of a new property in one of the TD vocabularies (in this example we called it "securityDefinitionForSecurityConfiguration"). However, we do not know if this property is compliant with your ontology.

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

Successfully merging a pull request may close this issue.

2 participants