Re: Expansion Algorithm

On Dec 3, 2011, at 11:11 PM, 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.

Note clear, this would involve introducing xsd:integer and the others, where before it was pure JSON-LD, without reference to any external XSD types. That is why I suggested that the native types remain in their original form.

>> 2) {"foaf:homepage", {"@iri": "ex:home"} should cause "ex:home" to be
>> expanded, whether or not "foaf:homepage" is subject to  coercion
> 
> Agree
> 
> 
>> 3) {"@subject": "ex:home", "@type": "foaf:Document"} should cause both
>> "ex:home" and "foaf:Document" to be expanded
> 
> 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.

Yes, but the algorithm as defined doesn't describe this, at least to my reading.

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

Agreed that that is what should happen, just not what the spec says right now.

Gregg

> --
> Markus Lanthaler
> @markuslanthaler
> 
> 
> 

Received on Sunday, 4 December 2011 07:50:53 UTC