Open PaulCapestany opened 10 years ago
There are a couple of ways to do this:
You can create a single JSON document containing both A.json and B.json in an Array, flatten it, then compact using your new context. You may also want to frame the output using the Framing algorithm.
Secondly, you can simply turn both input documents into RDF, then go back from RDF to JSON-LD and compact/frame. They both end up doing much the same thing, although flattening may end up with duplicate values.
JSON-LD doesn't provide any specific mechanisms for document merging otherwise, but the flattening algorithm may do more of what you'd like.
One of the use-cases I'd like to see fully fleshed out in an example is the following:
How do you take data about one entity from 2 different sources (e.g. A.json which we'll say comes from "Acebook" and B.json which we'll say comes from "Bwitter"), define an @context for them, compact them, and then "merge" into one final doc (e.g. maybe something along the lines of F.json?)?
I think it'd help to clarify the process, and how best to model data in order to achieve these results using JSONLD.