是否有一種工具爲JSON-LD的REST式服務生成框架,並使用hydra定義操作。比如下面的例子,假設我有一個Java類Person,那麼構建一個反向工程JSON-LD來生成一個完整的spring mvc代碼的工具是一個很好的想法。JSON-LD文檔+ Hydra Core生成Java代碼
{
"@context": [
"http://www.w3.org/ns/hydra/core",
{
"@vocab": "https://schema.org/",
"image": { "@type": "@id" },
"friends": { "@type": "@id" }
}
],
"@id": "https://api.example.com/player/1234567890/friends",
"operation": {
"@type": "BefriendAction",
"method": "POST",
"expects": {
"@id": "http://schema.org/Person",
"supportedProperty": [
{ "property": "name", "range": "Text" },
{ "property": "alternateName", "range": "Text" },
{ "property": "image", "range": "URL" }
]
}
}
}
參考json摘自http://sookocheff.com/posts/2014-03-11-on-choosing-a-hypermedia-format/ – rohit 2015-01-21 05:17:16