- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想知道,有没有办法在 JSON-LD 中使用 HAL 概念?
我有当前的 jsonld 文档:
{
"@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"
}
}
}
href
有一个
@type
的
@id
, 等等...
@id
类型对我来说不足以描述链接。)
最佳答案
正如 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" }
}
@id
已经明确指定),我添加了另一个链接,
ex:link
.因此它的链接关系是
http://example.com/myvocab#link
它的“href”是
/another-resource
.如果您需要更详细地描述该链接/属性,您可以通过创建一个文档来实现,该文档以与其他内容完全相同的方式定义它(正如 Tomasz 也已经解释过的):
{
"@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. I am more or less familiar with the Hydra vocab, but I don't like the idea to map the resources to real classes and objects on a server side language and automatically transform the operation parameters into those objects. Maybe it is possible to use the Hydra vocab in another way, but I don't have the time to experiment with that.
关于rest - 将 HAL 词汇与 JSON-LD 结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24421234/
我正在尝试创建尽可能小的 ELF。我创建了一个这样的测试文件(NASM 语法): SECTION .text dd 0xdeadbeef 使用此链接描述文件: SECTIONS { .text
GNU LD 链接器命令语言是否有条件语句? 背景:我正在为 arm cortex m0+ 开发固件,该固件由引导加载程序和应用程序组成。两者都在单独的项目中进行编译和刷新,但我使用了一个框架,其中包
我很确定 ld 有一个手册页链接器脚本语法,但我找不到它。 最佳答案 如果您更喜欢比 info 更方便的东西, 这是一个可浏览的 HTML 版本:ld.info: Scripts .但它可能不是完全最
谁能解决这个练习,这样我就能明白我错在哪里,因为有太多的 LOL 变量。 生成一个 C 代码,将其放在以下表达式之前 printf ("% ld% ld% ld \ n", lol, & lol, *
在他关于理解 Linux Kernel Initcall Mechanism 的文章中, Trevor 创建了一个用户空间程序来模拟调用 linux 驱动程序的 init_module() 的机制。
/usr/bin/ld: cannot find -ldlib /usr/bin/ld: cannot find -lcblas /usr/bin/ld: cannot find -llapack 在
我想以 json-ld 格式创建一组人,但我需要保留一些键而不是使用数组,所以我首先尝试了这个: { "@context" : { "@base" : "http://www.exampl
所以我试图围绕 JSON-LD 进行思考,我看到的所有示例主要包括嵌入“链接数据”。但我想提供对链接数据的引用(主要是因为嵌入所有数据可能会产生 10MB 的有效负载)。所以我想知道我这样做是否正确。
我在这里复制了 json-ld standard 中的示例的一部分: { "@context": { "foaf": "http://xmlns.com/foaf/0.1/", "
考虑这样一个程序: #include void foo() __attribute__((__weak__)); int main() { printf("%p\n", (void *)fo
我正在尝试使用一个名为 GLV 的小部件库对于我正在开发的应用程序。我正在运行 Linux Mint 17。我安装了所有库并成功构建了 GLV 库,但是当我尝试运行已构建的示例之一时,出现了此共享库错
在将未编辑的 JSON 数据转换为 JSON-LD 时,使用前缀和数据值为对象构造 IRI 时遇到问题。我运行的示例代码是: { "@context" : { "prefix" : "
假设我有一个 JSON 对象,它在嵌套对象中包含一些属性。 { "title": "My Blog Post", "meta": { "publishedAt": "2
我是 JSON-LD 和 LOD 的新手,所以请原谅我使用的术语。我正致力于在 JSON-LD 中创建数据模型,以描述基于欧洲数据模型 (http://pro.europeana.eu/edm-doc
我有一个玩具 x86 汇编程序,我正在用 as 编写和编译它和 ld : .text .global _start _start: movq $1, %rax movq
我正在尝试创建 Google 的结构化数据,但不知道我在做什么。我将其设置为一个组织,然后将 SD 标记工具用于我的所有产品。我将每个 JSON-LD 产品直接从标记工具而不是嵌套放入它自己的脚本标签
我正在尝试创建 Google 的结构化数据,但不知道我在做什么。我将其设置为一个组织,然后将 SD 标记工具用于我的所有产品。我将每个 JSON-LD 产品直接从标记工具而不是嵌套放入它自己的脚本标签
我正在尝试使用 vcpkg 和 ndk r20 为 android arm 构建 tesseract我必须编辑 CMakeLists.txt 并添加 glob.c 和 glob.h,因为它们不在 nd
长话短说: 有没有办法让我(没有 root 访问权限)使链接器(由 gcc 调用)不知道 /etc/ld.so.conf 中包含的目录的内容 在通过 ldconfig 缓存之后? 详细说明: 我正在尝
我想将/opt/vertica/lib64 添加到系统库路径中,所以我执行以下步骤: (1) 将/opt/vertica/lib64加入/etc/ld.so.conf,运行ldconfig, (2)
我是一名优秀的程序员,十分优秀!