我有一个 JSON-LD 文档。
{
"@id": "VDWW1LL3MZ",
"first_name": "Vincent",
"last_name": "Willems",
"knows":["MartyP"],
"@context": {
"foaf": "http://xmlns.com/foaf/0.1/",
"first_name": "foaf:givenName",
"last_name": "foaf:familyName",
"knows": "foaf:knows",
"MartyP": {
"@id": "http://example.com/martyp",
"first_name": "Marty",
"last_name": "P"
}
}
}
现在,该文档的部分上下文是在运行时(Marty P
对象)生成的,但foaf
前缀定义是静态的,并且对每个文档重复。
如果我有 10 个前缀定义,将它们放在每个文档中会感觉很浪费。所以我想做类似的事情
generated document
:
{
"@id": "VDWW1LL3MZ",
"first_name": "Vincent",
"last_name": "Willems",
"knows":["MartyP"],
"@context": {
"@extends": "http://example.com/base_context.jsonld",
"MartyP": {
"@id": "http://example.com/martyp",
"first_name": "Marty",
"last_name": "P"
}
}
}
base_context.jsonld
:
{
"foaf": "http://xmlns.com/foaf/0.1/",
"first_name": "foaf:givenName",
"last_name": "foaf:familyName",
"knows": "foaf:knows"
}
这可能吗?