- From: Gregg Kellogg <gregg@kellogg-assoc.com>
- Date: Wed, 21 Mar 2012 21:05:30 -0400
- To: Linked JSON <public-linked-json@w3.org>
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]. We probably want to import something based on this definition, changing some terms along the way. For example: interface Triple { readonly attribute Node subject; readonly attribute Node property; readonly attribute Node object; } [NoInterfaceObject] interface Node { readonly attribute DOMString nominalValue; readonly attribute DOMString interfaceName; }; interface IRI : Node { readonly attribute DOMString nominalValue; // The IRI identifier } interface BlankNode : Node { readonly attribute DOMString nominalValue; // The node label } interface Literal : Node { readonly attribute DOMString nominalValue; // The literal value readonly attribute DOMString? language; // optional language readonly attribute IRI? datatype; // optional literal datatype } 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? 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
Received on Thursday, 22 March 2012 01:06:29 UTC