嵌套级别重复键的 JSONLD 上下文
JSONLD context for duplicate keys at nested level
我将以下内容 json 与下面的上下文合并,
目前我面临两个问题
1 JSON 中不同级别的重复键或属性如何处理,以便我可以将正确的三元组相互连接?
2 @vocab 被忽略,我在 rowid 上使用了 @id,它在 json-ld playground
中添加了默认前缀
{
"@context": {
"@vocab": "http://xyz.qte.com/01#",
"xxx": "http://xyz.qte.com/01#",
"@base": "http://xyz.qte.com/01#",
"rowid": "@id",
"values": "@nest",
"relation": "@nest",
"blobs": "@nest",
"displaytypename": {
"@id": "http://www.w3.org/2000/01/rdf-schema#label",
"@type": "@id"
},
"type": "@type",
"blobid": {
"@id": "cccmi:blobid",
"@type": "@id"
}
},
"@id": "xxx:abs",
"type": "abs",
"objectversion": 15,
"displaytypename": "ABS",
"displaytypenamelang": "en",
"objectid": "123456",
"typeversion": "r34",
"values": [{
"value": 278494
}],
"rows": [{
"rowid": "123",
"displaytypename": "asdf",
"displaytypenamelang": "en",
"type": "affected_objects",
"values": [{
"value": "1234"
}]
},
{
"rowid": "345",
"displaytypename": "bla",
"displaytypenamelang": "en",
"type": "affected_objects2",
"values": [{
"value": "5678"
}],
"relation": {
"rows": [{
"rowid": "678",
"displaytypename": "baba",
"type": "affected_objects3",
"values": [{
"value": "General"
}],
"relation": {
"rows": [{
"rowid": "546",
"displaytypename": "bla",
"displaytypenamelang": "en",
"type": "affected_objects4",
"values": [{
"value": "2002-09-04"
}]
},
{
"rowid": "874",
"displaytypename": "blah",
"displaytypenamelang": "en",
"type": "affected_objects5",
"values": [{
"value": "TMBLA"
}]
},
{
"rowid": "973",
"displaytypename": "blah",
"displaytypenamelang": "en",
"type": "affected_objects6",
"values": [{
"value": "456"
}]
}
]
}
}]
}
},
{
"rowid": "987",
"displaytypename": "bllah",
"displaytypenamelang": "en",
"type": "co_issue",
"values": [{
"value": 3
}],
"relation": {
"rows": [{
"rowid": "163",
"displaytypename": "blaj",
"displaytypenamelang": "en",
"type": "affected_objects7",
"values": [{
"value": "Exists"
}],
"blobs": [{
"mime_type": "abc",
"blobid": "2344"
}]
}
]
}
}
]
}
“重复键”是指在 JSON 文档的不同级别用作 属性 键的相同术语。为此,JSON-LD 有一个 Scoped Context 的概念,因此您可以在某些 属性 的值或类型生效的地方使用上下文。通过这种方式,例如,您可以定义“值”以映射到顶层的一个 IRI,并在“值”的术语定义(或其他一些干预 属性)中,定义一个新的上下文,它重新定义“值”的映射
关于 @vocab
和 @id
,@id
被认为是文档相关术语,字符串值从文档库扩展,或者 @base
,如果定义在活动上下文中(参见 section 4.1.3 Base IRI). @vocab
is used for expanding vocabulary-relative term such as @type
and object property keys, which aren't otherwise defined as terms (see section 4.1.2 Default Vocabulary.
我将以下内容 json 与下面的上下文合并,
目前我面临两个问题
1 JSON 中不同级别的重复键或属性如何处理,以便我可以将正确的三元组相互连接?
2 @vocab 被忽略,我在 rowid 上使用了 @id,它在 json-ld playground
中添加了默认前缀 {
"@context": {
"@vocab": "http://xyz.qte.com/01#",
"xxx": "http://xyz.qte.com/01#",
"@base": "http://xyz.qte.com/01#",
"rowid": "@id",
"values": "@nest",
"relation": "@nest",
"blobs": "@nest",
"displaytypename": {
"@id": "http://www.w3.org/2000/01/rdf-schema#label",
"@type": "@id"
},
"type": "@type",
"blobid": {
"@id": "cccmi:blobid",
"@type": "@id"
}
},
"@id": "xxx:abs",
"type": "abs",
"objectversion": 15,
"displaytypename": "ABS",
"displaytypenamelang": "en",
"objectid": "123456",
"typeversion": "r34",
"values": [{
"value": 278494
}],
"rows": [{
"rowid": "123",
"displaytypename": "asdf",
"displaytypenamelang": "en",
"type": "affected_objects",
"values": [{
"value": "1234"
}]
},
{
"rowid": "345",
"displaytypename": "bla",
"displaytypenamelang": "en",
"type": "affected_objects2",
"values": [{
"value": "5678"
}],
"relation": {
"rows": [{
"rowid": "678",
"displaytypename": "baba",
"type": "affected_objects3",
"values": [{
"value": "General"
}],
"relation": {
"rows": [{
"rowid": "546",
"displaytypename": "bla",
"displaytypenamelang": "en",
"type": "affected_objects4",
"values": [{
"value": "2002-09-04"
}]
},
{
"rowid": "874",
"displaytypename": "blah",
"displaytypenamelang": "en",
"type": "affected_objects5",
"values": [{
"value": "TMBLA"
}]
},
{
"rowid": "973",
"displaytypename": "blah",
"displaytypenamelang": "en",
"type": "affected_objects6",
"values": [{
"value": "456"
}]
}
]
}
}]
}
},
{
"rowid": "987",
"displaytypename": "bllah",
"displaytypenamelang": "en",
"type": "co_issue",
"values": [{
"value": 3
}],
"relation": {
"rows": [{
"rowid": "163",
"displaytypename": "blaj",
"displaytypenamelang": "en",
"type": "affected_objects7",
"values": [{
"value": "Exists"
}],
"blobs": [{
"mime_type": "abc",
"blobid": "2344"
}]
}
]
}
}
]
}
“重复键”是指在 JSON 文档的不同级别用作 属性 键的相同术语。为此,JSON-LD 有一个 Scoped Context 的概念,因此您可以在某些 属性 的值或类型生效的地方使用上下文。通过这种方式,例如,您可以定义“值”以映射到顶层的一个 IRI,并在“值”的术语定义(或其他一些干预 属性)中,定义一个新的上下文,它重新定义“值”的映射
关于 @vocab
和 @id
,@id
被认为是文档相关术语,字符串值从文档库扩展,或者 @base
,如果定义在活动上下文中(参见 section 4.1.3 Base IRI). @vocab
is used for expanding vocabulary-relative term such as @type
and object property keys, which aren't otherwise defined as terms (see section 4.1.2 Default Vocabulary.