Re: A library that converts regular JSON to JSON-LD

On Sat, 11 Apr 2020 at 21:23, David Booth <david@dbooth.org> wrote:

> On 4/11/20 11:54 AM, Melvin Carvalho wrote:
> > Is there are library that converts simple json (think just a flat object
> > of key value pairs)
> >
> > Into JSON-LD -- any value form will do, if some hacking of the context
> > is needed, that would be fine
> >
> > If no library, is there an algorithm?
> >
> > And if no algorithm, could we make one?
>
> I have not seen one yet, but it's good idea.  In particular, the
> algorithm needs to recursively traverse the JSON tree and keep track of
> nesting to generate an @context that will keep nested properties of the
> same name distinct.  See the discussion here:
> https://github.com/w3c/EasierRDF/issues/29
>
> Once such an algorithm is defined, it could become a standard way to map
> plain JSON to RDF.
>

Hi David.  Thanks for the excellent point and pointer.

Does the algorithm specifically need to traverse the tree to distinguish
foo from baz/foo

I can see why you may want to in JSONPath for example, but given that JSON
predicates are "just names", would you specifically need that prefix in a
name, or is it a nice to have?

Meaning we could have a simple algorithm that preserves the json and json
keys, or a more complex example that preserves the path.  Or did I miss
something e.g. to do with the bnodes?


>
> David Booth
>
>

Received on Sunday, 12 April 2020 10:13:30 UTC