JSON-LD将一个对象框架化为多个引用

问题描述

在我的示例中,我有一个带有两个标签的实体。每个标签都有对语言对象的引用:

[
  {
    "@id": "http://example.com/entity","http://example.com/label": [
      {
        "@id": "http://example.com/label1"
      },{
        "@id": "http://example.com/label2"
      }
    ]
  },{
    "@id": "http://example.com/label1","http://example.com/value": "Label 1","http://example.com/language": {
      "@id": "http://example.com/language"
    }
  },{
    "@id": "http://example.com/label2","http://example.com/value": "Label 2",{
    "@id": "http://example.com/language","http://example.com/value": "English"
  }
]

当我用以下框架对其进行解析时:

{
  "@context": {
    "@base": "http://example.com/","@vocab": "http://example.com/"
  },"@graph": {
    "label": {}
  }
}

我仅在其中一个标签中获得“英语”值。第二个只有语言ID:

{
  "@context": {
    "@base": "http://example.com/","@id": "entity","label": [
    {
      "@id": "label1","language": {
        "@id": "language","value": "English"
      },"value": "Label 1"
    },{
      "@id": "label2","language": {
        "@id": "language"
      },"value": "Label 2"
    }
  ]
}

是否可以在两个标签中都使用“英语”值?

我的示例在json-ld playground上可用。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)