W3C home > Mailing lists > Public > public-linked-json@w3.org > December 2011

Re: Expansion Algorithm

From: Dave Longley <dlongley@digitalbazaar.com>
Date: Sun, 04 Dec 2011 12:33:46 -0500
Message-ID: <4EDBAEFA.1020600@digitalbazaar.com>
To: public-linked-json@w3.org
On 12/04/2011 02:11 AM, Markus Lanthaler wrote:
>>>> Object expansion should expand every value, not just those that have
>>>> keys that are subject to datatype or list coercion. Some examples:
>>> What exactly do you mean by "should expand every value"?
>> As stated, the algorithm recurses through arrays to objects or strings,
>> for objects, expands values of keys, only if the key is the target of a
>> @datatype coercion in the context. Thus, if "foo" =>  "bar", and "foo"
>> was declared with an IRI datatype, it would expand "bar" into an IRI.
> OK, now I've understood what you meant. Thanks
>
>
>> But, looking at the algorithm again, I think my examples are mostly
>> covered. The remaining issues have to do with values that are not
>> arrays or objects. Also, it should be clear that the determination of
>> key coercion caries through to @list, @iri, @datatype and array
>> processing.
>>
>> 1) Does {"foaf:age": 54} cause 54 to be expanded to {"@literal": "54",
>> "@datatype": "xsd:string}. IMO, I think that non-string types such as
>> boolean, integer and numeric are not subject to expansion, in spite of
>> any coercion.
> .. but it should be expanded when normalizing a document.

-1. I think expanded JSON-LD documents should have a fairly regular 
form; where object values are either strings, literals, or IRIs. It is 
the responsibility of a @context to provide the specific @datatype for a 
number, otherwise it is unclear what that type is when a JSON-LD 
document is in expanded form. Furthermore, this approach may complicate 
round-tripping, may require more people to use normalization than would 
otherwise not need it, and will complicate the normalization algorithm. 
It feels inconsistent with the purpose of expansion in my view, which is 
to provide all of the information you need about each object when there 
is no context present.

>> 2) {"foaf:homepage", {"@iri": "ex:home"} should cause "ex:home" to be
>> expanded, whether or not "foaf:homepage" is subject to  coercion
> Agree

I guess the point of this one is if a @coerce rule exists but the 
document didn't follow the rule? If my understanding is correct here, I 
agree.

>> 3) {"@subject": "ex:home", "@type": "foaf:Document"} should cause both
>> "ex:home" and "foaf:Document" to be expanded
> Agree

Provided that "ex" and "foaf" are defined prefixes, I agree.

>> 4) {"foo": ["ex:bar", "ex:baz"]} should cause all or none of  ex:bar
>> and ex:baz to be expanded, depending on coercion rules for "foo". This
>> isn't clear now, as when doing array expansion, there's no discussion
>> of a "closest" key.
> If "foo" is coerced to @iri then all the array item should be expanded,
> otherwise none.

I agree with Markus.

>> 5) {"foo": {"@list": ["ex:bar", "ex:baz"]}, same argument as for 4).
> Same here, just if "foo" is coerced to @iri.

I agree with Markus.

-- 
Dave Longley
CTO
Digital Bazaar, Inc.
Received on Sunday, 4 December 2011 17:34:11 UTC

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