Re: Correct use of Hydra

Hi Marcel,

You can find a comprehensive example here:
https://github.com/HTTP-APIs/hydra-flock-vocab/blob/master/hydra_flock.jsonld

Hope it can help with your doubts.
Cheers,

Lorenzo Moriondo, from mobile
https://it.linkedin.com/in/lorenzomoriondo

On Feb 6, 2018 7:44 AM, "Reppenhagen, Marcel" <
marcel.reppenhagen@campus.tu-berlin.de> wrote:

> Dear Community,
>
>
> I am looking to use Hydra purely for semantically describing a device's
> functionality in a JSON-LD document.  Right now there is no intention for
> an API client to consume this file but this file is rather a semantic
> documentation/description of some API endpoints a (IoT) device might offer.
>
> I have tried to approach this task by using schema.org actions:
>
>
> {
>   "@context": {
>     "schema": "http://www.schema.org/",
>     "someOntology": "http://www.someOntology.org/"
>   },
>   "@id": "http://localhost:3000",
>   "@type": "someOntology:TemperatureDevice",
>   "schema:potentialAction": [
>     {
>       "@type": [ "schema:Action", "someOntology:changeTemperatureAction"
> ],
>       "schema:target": {
>         "@type": "schema:EntryPoint",
>         "schema:urlTemplate": "http://www.localost:3000/temperature",
>         "schema:httpMethod": "POST",
>         "schema:encodingType": "application/json"
>       },
>       "temperature-input": "required"
>     }
>   ]
> }​
>
> I have tried to write the same logic using Hydra but I am having problems
> because the documentation is not very precise and there are no real good
> examples. Everytime I write something using Hydra I am very unsure if it is
> correct. I came up with this attempt:
>
> {
>   "@context": {
>     "schema": "http://www.schema.org/",
>     "someOntology": "http://www.someOntology.org/",
>     "hydra": "https://www.w3.org/ns/hydra/core#"
>   },
>   "@id": "http://localhost:3000",
>   "@type": "someOntology:TemperatureDevice",
>   "hydra:operation": [
>     {
>       "@type": [ "hydra:Operation", "someOntology:changeTemperatureAction"
> ],
>       "hydra:method": "POST",
>       "hydra:expects": [
>         {
>           "@type":"hydra:SupportedProperty",
>           "hydra:property": "temperature",
>           "required": "true"
>         }
>       ]
>     }
>   ]
> }
>
> How can I specify the target URL? I thought about adding the "@id" field
> but imagine having a GET, PUT and DELETE all to the same URI. That doesnt
> work with the "@id" property.
> I have read through a lot of the issues on GitHub but I cant seem to get
> smarter from them and see the correct way of doing what I have in mind.
>
> When I started thinking about my data model I wanted to represent an
> action/api endpoint like it is done in the "SIREN" data format where an
> action looks like this:
>
>  "actions": [
>     {
>       "name": "add-item",
>       "title": "Add Item",
>       "method": "POST",
>       "href": "http://api.x.io/orders/42/items",
>       "type": "application/x-www-form-urlencoded",
>       "fields": [
>         { "name": "orderNumber", "type": "hidden", "value": "42" },
>         { "name": "productCode", "type": "text" },
>         { "name": "quantity", "type": "number" }
>       ]
>     }
>   ]
>
> What would be the equivalent of this using semantic web technologies such
> as Hydra (or the schema.org actions) ?
> Is Hydra even a good match for what I am trying to archieve?
>
> Any help would be greatly appreciated!!!
> Thank you very much in advance!
>
> Best regards
> Marcel Reppenhagen
>
>
>
>

Received on Tuesday, 13 February 2018 23:25:48 UTC