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

Make root object's @id the default base URI #610

Closed
vcharpenay opened this issue Mar 7, 2018 · 2 comments
Closed

Make root object's @id the default base URI #610

vcharpenay opened this issue Mar 7, 2018 · 2 comments
Assignees
Labels
api spec-design syntax wont fix Issue discussed and closed as Won't Fix

Comments

@vcharpenay
Copy link

vcharpenay commented Mar 7, 2018

Here is a JSON-LD document that looks more or less like a Thing Description, a spec being developed at the W3C for the Web of Things. A Thing Description basically provides meta-data for 'Things' (here, a sensor) and links to their properties (e.g. a temperature value).

Properties must be uniquely identified, e.g. for access control on the sensor device. Ideally, the temperature property in this example would be identified by example://mysensor/wot, i.e. relatively to the @id of the sensor. I believe there is no way to achieve this with the current JSON-LD 1.1 spec.

{
  "@context": { "iot": "iotschema.org/" },
  "@id": "example://mysensor",
  "@type": "iot:Sensor",
  "properties": [
    {
      "@id": "temp",
      "@type": "iot:Temperature",
      "href": "coap://192.168.2.5/temp/val"
    }
  ]
}

This issue relates to some extent to #488, where it has been proposed to allow @vocab: @base in the context. I could imagine a similar solution here, by defining @base: @id (or @vocab: @id) to make the root object's @id the default base URI.

@vcharpenay
Copy link
Author

vcharpenay commented Mar 7, 2018

In this example, it might also be worth mentioning that coap://192.168.2.5/temp/val cannot exactly be used as an identifier for the property. First, the two entities are semantically different: example://mysensor/wot is the temperature itself, while coap://192.168.2.5/temp/val is a measurement of the temperature value at a given point in time. But more importantly, the same temperature could be accessed via different resources (e.g. for CoAP, MQTT, HTTP or WebSocket, each with its own URI) while aspects like access control should be configured at the property level and not for individual Web resources.

@gkellogg gkellogg added this to the JSON-LD 1.1 milestone Mar 12, 2018
@gkellogg gkellogg self-assigned this Mar 12, 2018
@gkellogg gkellogg added wont fix Issue discussed and closed as Won't Fix spec-design api syntax labels Mar 12, 2018
@gkellogg
Copy link
Member

This was discussed on the 2018-03-12 call. Adding another mechanism on @base or @vocab to tie them to @id is quite outside the current scope of the spec, and also incompatible with other RDF serialization formats, such as Turtle. As @iherman notes, sometimes blank nodes are necessary, and solve such use cases.

In this case, I think that @base might work, and define your Thing Description with that base, you can then have other @id values relative to that document base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api spec-design syntax wont fix Issue discussed and closed as Won't Fix
Projects
None yet
Development

No branches or pull requests

2 participants