RE: A reference to a WebSocket stream

Hi Maxim,

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?


> 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.


Hope this helps,
Markus
 

> [0]: http://purl.oclc.org/NET/ssnx/ssn#


--
Markus Lanthaler
@markuslanthaler

Received on Saturday, 28 November 2015 18:02:38 UTC