Re: Triple conversion to JSON-LD

I updated issue 53: https://github.com/json-ld/json-ld.org/issues/53 with the IRC conversation and references to this email. Let's move the conversation there.

Gregg

On Mar 22, 2012, at 9:39 AM, Dave Longley wrote:

> On 03/21/2012 09:05 PM, Gregg Kellogg wrote:
>> 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.
>> 
>> 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].
> 
> I agree.
> 
>> 
>> We could then describe change JsonLdTripleCallback to just TripleCallback with a method that takes a Triple as a single parameter.
>> 
>> 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 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.
>> 
>> Thoughts?
> 
> I think that we should add a fromTriples method and rename the _triples_ 
> method to toTriples to better mirror it. We should also consider using 
> some kind of iterable interface as an input to the fromTriples method 
> instead of a list, or allow both.
> 
> I also think that the normalization algorithm's output should just be an 
> ordered list of triples. People that want to use the output to serialize 
> and sign data can choose their serialization method, but we may want to 
> recommend one to encourage interoperability with handling graph signatures.
> 
> I'm currently working on a much simpler to implement normalization 
> algorithm, but there are no guarantees that it will work just yet. As 
> always with this problem, it's unlikely that it will work, but fingers 
> are crossed.
> 
>> 
>> Gregg
>> 
>> [1] http://json-ld.org/spec/latest/json-ld-api/#normalization-algorithm
>> [2] http://www.w3.org/TR/2011/WD-rdf-interfaces-20110510/#triples
> 
> 
> -- 
> Dave Longley
> CTO
> Digital Bazaar, Inc.
> 
> 

Received on Thursday, 22 March 2012 18:05:02 UTC