W3C home > Mailing lists > Public > public-linked-json@w3.org > March 2012

RE: Triple conversion to JSON-LD

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Thu, 22 Mar 2012 18:22:23 +0800
To: "'Linked JSON'" <public-linked-json@w3.org>
Message-ID: <004d01cd0815$aef29000$0cd7b000$@lanthaler@gmx.net>
> The API doc describes, in fairly loose terms, how to convert triples
> into JSON-LD as part of the Normalization algorithm [1]. It's loose,
> because it describes the result of normalization as being N-Triples,
> but that leaves a lot of hand-waving about turning those into an
> internal representation.

My preference would still be that the output of the normalization algorithm
is just an ordered set of triples - independent of any serialization format.
Of course, concrete serialization formats would then need to transform those
triples to a document, in our case, a JSON-LD document.

> I could then describe normalization in terms of returning an ordered
> array of Triples which can simply make use of the from Triples
> algorithm. Depending on how the Normalization doc is described, we
> either need to document transforming N-Triples into such an ordered
> array of Triples, or have it's results use the same interface
> definitions.

I would argue for using the same interface. A JSON-LD implementation
shouldn't have to deal with N-Triples at all. An implementer shouldn't even
need to know that such a thing exists.

> The _triples_ IDL definition makes use of JsonLdTripleCallback, which
> just describes a _triple_ method taking several parameters. IMO, what
> we really need is something like the Triple interface from the somewhat
> abandoned RDF Interfaces document [2]. We probably want to import
> something based on this definition, changing some terms along the way.

Honestly I don't really like the interface as it is quite bloated without
doing much. Just transforming the parameters of our _triple_ method and
turning that into an interface would be much simple IMO. That being said, I
see the advantages of basing it on that interface and would be fine with

> This also allows us to describe a new API method fromTriples, which
> takes an ordered array of Triples and returns an object.
> interface JsonLdProcessor {
>   ...
>   object fromTriples(Triple<> input);
> }

I think would need to return a string to preserve the order.

Markus Lanthaler
Received on Thursday, 22 March 2012 10:23:04 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:33 UTC