在 JSONLD 序列化形式之间转换

Convert between JSONLD serialization forms

我有以下形式的 JSONLD 数据(大约 5 GiB):

[{
    "@id": "_:node1derd3aqnx968310",
    "http://www.example.org/uri-for/preferredName": [{
        "@value": "Doe, John"
      }
    ]
  }, {
    "@id": "http://www.example.org/myres012345",
    "@type": ["http://www.example.org/uri-for/person"],
    "https://schema.org/additionalName": [{
        "@id": "_:node1derd3aqnx968310"
      }
    ]
  }
]

而我想要的是:

[{
    "@id": "http://www.example.org/myres012345",
    "@type": ["http://www.example.org/uri-for/person"],
    "https://schema.org/additionalName": [{
        "http://www.example.org/uri-for/preferredName": [{
            "@value": "Doe, John"
          }
        ]
      }
    ]
  }
]

这些不同的序列化形式是怎么称呼的?如何在第二个示例中将第一个(平面)JSONLD 转换为分层 JSONLD?有人可以推荐 Java 图书馆或类似的东西吗?

伙计们,这对你有帮助!

我想你是在要求 JSON-LD Framing. Like in this example

Framing is used to shape the data in a JSON-LD document, using an example frame document which is used to both match the flattened data and show an example of how the resulting data should be shaped. Matching is performed by using properties present in in the frame to find objects in the data that share common values. Matching can be done either using all properties present in the frame, or any property in the frame. By chaining together objects using matched property values, objects can be embedded within one another.

使用上面的示例 link 来尝试一下示例并了解框架文档的工作原理。