rest - Using the HAL vocab with JSON-LD -
i wondering, there way use hal concepts json-ld?
i have 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 not sure how define href
has @type
of @id
, , on...
is there way define hal vocab based on rdf(s) , import somehow in @context of jsonld documents, or should else?
(i trying describe hyperlinks various properties, link relation, http method, accepted media type, language, iri template, input fields, etc... @id
type not enough me describe links.)
as tomasz suggested, should consider using hydra more or less want. example you've included in questions, using 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" } }
as there's no need "self" link (@id
specifies explicitly), i've added link, ex:link
. link relation consequently http://example.com/myvocab#link
, "href" /another-resource
. if need describe link/property in more details, can creating document defines in same manner other things described (as tomasz explained):
{ "@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": .... } ] }
regarding comment
btw. more or less familiar hydra vocab, don't idea map resources real classes , objects on server side language , automatically transform operation parameters objects. maybe possible use hydra vocab in way, don't have time experiment that.
hydra vocabulary. decide how use it. think talking hydrabundle above. that's 1 way use it. proof of concept show possible. please don't confused that.
i invite join hydra w3c community group. can discuss in more detail on our mailing list.
disclaimer: i'm creator of hydra , chair of hydra w3c community group.
Comments
Post a Comment