【发布时间】:2017-10-19 07:13:25
【问题描述】:
我定义了一个带有多个上下文的 jsonld 文件。每个上下文定义一个具有相同名称的术语。当对 jsonld 文件进行压缩时,所有具有相同名称的字段都在同一个命名空间中。
比如下面的文件
{
"@context": [
{
"name1": "http://example.org/name1/",
"id" : {
"@id" : "name:id",
"@type" : "xsd:string"
}
},
{
"name2": "http://example.org/name2/",
"identifier": {
"@id": "name2"
},
"id" : {
"@id" : "name2:id",
"@type" : "xsd:string"
}
}],
"@id": "http://example.org/1",
"id" : "id/1",
"identifier": {
"id" : "identifier/1"
}
}
我在压缩后得到这个结果
{
"@id" : "http://example.org/1",
"http://example.org/name2/" : {
"http://example.org/name2/id" : {
"@type" : "xsd:string",
"@value" : "identifier/1"
}
},
"http://example.org/name2/id" : {
"@type" : "xsd:string",
"@value" : "id/1"
}
}
但我会期待这个
{
"@id" : "http://example.org/1",
"http://example.org/name2/" : {
"http://example.org/name2/id" : {
"@type" : "xsd:string",
"@value" : "identifier/1"
}
},
"http://example.org/name1/id" : { <== here name1
"@type" : "xsd:string",
"@value" : "id/1"
}
}
【问题讨论】:
标签: json-ld