Using HAL vocals with JSON-LD

I was wondering if there is a way to use HAL concepts with JSON-LD?

I have a current jsonld document:

{
    "@context": {
        "hal": "http://stateless.co/hal#",
        "schema": "http://schema.org",
        "_links": {
            "@id": "hal:link",
            "@container": "@index"
        }
    },
    "@type": ["schema:Person", "hal:Resource"],
    "name": "Jon Snow",
    "_links": {
        "self": {
            "href": "/users/123"
        }
    }
}

but i'm not sure how to determine what hrefhas @typeof @idetc ...

Is there a way to define a HAL vocab based on RDF (S) and import it somehow into the @context of my jsonld documents or do I need to do something else?
(I am trying to describe hyperlinks with various properties, such as link relation, HTTP method, accepted media type, language, IRI pattern, input fields, etc. Therefore, the type @idis not enough for me to describe links.)

+4
source share
2

Tomasz, Hydra, , . , , , Hydra JSON-LD:

{
    "@context": {
        "schema": "http://schema.org",
        "ex": "http://example.com/myvocab#"
    },
    "@id": "/users/123",
    "@type": [ "schema:Person", "hydra:Resource" ],
    "name": "Jon Snow",
    "ex:link": { "@id": "/another-resource" }        
}

"self" (@id ), , ex:link. , http://example.com/myvocab#link, "href" /another-resource. /, , , , ( ):

{
    "@context": {
        "ex": "http://example.com/myvocab#",
        "hydra": "http://www.w3.org/ns/hydra#"
    },
    "@id": "ex:link",
    "@type": "hydra:Link",
    "hydra:title": "My new link relation",
    "hydra:supportedOperation": [
       {
         "@type": "hydra:Operation",
         "hydra:method": "POST",
         "hydra:expects": ....
       }
    ]       
}

Btw. Hydra vocab, . , , .

- . , . , HydraBundle . . , , . , , .

Hydra W3C. .

: Hydra Hydra W3C.

+8

, Hydra. ?

Hypermedia. ,

{
  "@context": {
    "schema": "http://schema.org",
    "parent": { 
       "@id": "/vocab#parent"
       "@type": "@id"
    }
  },
  "@id": "/users/123",
  "@type": "schema:Person",
  "name": "Jon Snow",
  "parent": "/users/Ned_Stark" 
}

, - . ,

{
  "@context": "http://www.w3.org/ns/hydra/context.jsonld",
  "@id": "/vocab#parent",
  "@type": "hydra:Link"
}

( HTTP, , ..) . .

+2

Source: https://habr.com/ru/post/1546077/


All Articles