Re: A reference to a WebSocket stream

Hi Markus,

> On 27 Nov 2015 at 21:18, Maxim Kolchin wrote:
>> I'm working on an API for IoT middleware, the API is going to be based
>> on Hydra.
>
> Exciting! Is there already some documentation or a demo available somewhere?

I'm still in the beginning, so it's not ready yet to be published :)

>> In this API I want to provide a link to a websocket stream
>> which publishes latest observations of a device. How such a link should
>> be represented? Are there relevant approaches outside of Hydra
>> vocabulary?
>>
>> Currently, I just extend hydra:Link, i.e.:
>>
>> {
>>     "@context": {
>>         "vocab": "http://example.com/#",
>>         "hydra": "http://www.w3.org/ns/hydra/core#",
>>     },
>>     "@id": "vocab:observations",
>>     "@type": "hydra:Link",
>>     "rdfs:range": "hydra:Resource"
>> }
>>
>> Probably "rdfs:range": "hydra:Resource" isn't appropriate statement,
>> since a websocket stream is not a resource, but a kind of "continuous
>> collection".
>
> I would argue it is a resource, it is just being accessed through a different protocol (Websocket vs. traditional HTTP)
>
>
>> Then continuous collection could be just a subclass of
>> hydra:Collection with subscribe/publish operations and subscribe
>> operation could return ssn:Observation (from [0]), i.e.:
>>
>> {
>>     "@context": {
>>        "vocab": "http://example.com/#",
>>        "hydra": "http://www.w3.org/ns/hydra/core#",
>>        {
>>            "@id": "vocab:ContinuousCollection",
>>            "@type": "hydra:Class",
>>            "rdfs:subClassOf": "hydra:Collection",
>>            "hydra:supportedOperation": [
>>                "@type": "hydra:Operation",
>>                "hydra:method": "WEBSOCKET_SUBSCRIBE",
>>                "hydra:returns": "ssn:Observation"
>>            ]
>>        }
>>     },
>>     "@id": "vocab:observations",
>>     "@type": "hydra:Link",
>>     "rdfs:range": "vocab:ContinuousCollection"
>> }
>>
>> What do you think about that, Hydranians?
>
> Why would you want to subclass hydra:Collection? I think this demands a different representation. I don't think that a collection and a stream >have too much in common. Hydra is currently quite HTTP focused but people raised similar points in the past already. Till we get to work on >that, I would propose to That you just subclass hydra:Resource. I personally would call such a class something like WebsocketSource (if you >want to be able to distinguish between sources and sinks), WebsocketStream, or also WebsocketResource instead of ContinuousCollection.

I just wanted to show two options which I'm considering. I was
considering Collection as an option, because both collection and
stream are set of members. Although they probably should be disjoint
classes, because collection should (or may) be navigateable (with the
first and last links and others) and stream is definitely not.

I'll represent it as a subclass of hydra:Resource.

Thanks,
Maxim

Received on Monday, 30 November 2015 08:37:45 UTC