RE: @structure [ISSUE-40] and [ISSUE-44]

David I. Lehn wrote: 

> In IRC I commented that the '"@list":true' style seems non-optimal.
> To go along with @datatype I suggested '"@parsetype":"list"' or
> '"@parsetype":"@list"'.  Dave Longley suggested the "@structure"
> keyword instead.  That name seems a better choice.  This syntax allows
> more flexibility to support types like "@set" or similar without
> another '"@{type}":true' construct.  Now in issue #44 [2] we can see a
> use case of this in @contexts for framing.  I'm thinking this is the
> right direction to head.  This would make the above something like:
> 
> """
>     "foo": {"@iri": "http://uri.foo", "@datatype": "@iri",
> "@structure": "@list"}
> """

It's true that the "@list: true" approach doesn't scale nicely but I think
whenever possible we should avoid introducing new keywords. I though a bit
more about this issue and came up with another possible solution for it,
namely:

  "foo": {"@iri": "http://uri.foo", "@datatype": "@list[@iri]" }

or

  "foo": {"@iri": "http://uri.foo", "@datatype": "@list[xsd:date]" }


IMO this syntax would be intuitively understood by developers, it scales
nicely (@set[...]) and wouldn't complicate processing too much. Of course
the same syntax can also be used for @type to support arrays of objects. And
even if we merge @type and @datatype it would still work as @type would
require an array of objects while @datatype would require an array of
literals (whether they are JSON strings, numbers, or booleans doesn't
matter).



> Would it be better to use arbitrary IRI types instead of "@list"
> style?  Ie, '"@structure":"jsonld:list"' or something? Maybe @list and
> @set would be aliases for IRIs.

I think we agreed quite some time ago to not create a JSON-LD vocabulary..



--
Markus Lanthaler
@markuslanthaler

Received on Sunday, 4 December 2011 08:07:31 UTC