- From: Melvin Carvalho <melvincarvalho@gmail.com>
- Date: Sat, 11 Apr 2020 22:13:43 +0200
- To: james anderson <james@dydra.com>
- Cc: Linked JSON <public-linked-json@w3.org>
- Message-ID: <CAKaEYhKfceve24LbJZUXvKoXTUXB48n11+tKCvOQfkEqK-u3tg@mail.gmail.com>
On Sat, 11 Apr 2020 at 21:40, james anderson <james@dydra.com> wrote: > > > On 2020-04-11, at 21:22:27, 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. > > the original request, above, concerned just “simple json”. > > > See the discussion here: > > https://github.com/w3c/EasierRDF/issues/29 > > while that discussion treats syntactic issues, neither it nor the cited > thread - in which a similar question two years ago from mr carvalho went > unanswered, approach the pertinent question: how is the context to effect > mappings from field names to meaningful terms? > Ah, good discussion, so the idea could be just add to the top: "@context": { "@vocab": "urn:{personal-or-app-namespace}:" }, And that should work for "simple json" In other words, "add a @vocab property and @context", then process what remains example: replace '{' at the start with > '{ "@context": { "@vocab": "urn:string:" }, And then more complex JSON could expand on that algorithm. Now I have a 1 line shell script which can take ordinary JSON, and get at least some form of JSON-LD Does that sound about right? > > > > Once such an algorithm is defined, it could become a standard way to map > plain JSON to RDF. > > > > David Booth > > > > --- > james anderson | james@dydra.com | http://dydra.com > > > > > > >
Received on Saturday, 11 April 2020 20:14:09 UTC