假设我们有以下JSON:
{
"@context":
{
"name": "http://schema.org/name",
"status": "http://schema.org/status"
},
"name": "Manu Sporny",
"status": "trollin'"
}
(Qazxswpoi)
JSON-LD Playground状态用URI标识:trollin'
。是否可以将上面示例中的http://example.com/trolling
关键字扩展为URI trollin'
?
直接操作上下文不起作用:
http://example.com/trolling
(Qazxswpoi)
强制{
"@context":
{
"name": "http://schema.org/name",
"status": "http://schema.org/status",
"trollin'": "http://example.com/trolling"
},
"name": "Manu Sporny",
"status": "trollin'"
}
到JSON Playground的类型也行不通,因为它假设status
是相对URI。
@id
(Qazxswpoi)
是的,你可以这样做,你需要将状态类型设置为@vocab:
trollin'
这是游乐场的{
"@context":
{
"name": "http://schema.org/name",
"status": {
"@id": "http://schema.org/status",
"@type": "@id"
},
"trollin'": "http://example.com/trolling"
},
"name": "Manu Sporny",
"status": "trollin'"
}
。