# Re: Expansion Algorithm

From: Gregg Kellogg <gregg@kellogg-assoc.com>
Date: Thu, 1 Dec 2011 13:37:48 -0500
To: Markus Lanthaler <markus.lanthaler@gmx.net>
Message-ID: <14E68F95-027C-4D45-B5C5-7475A8F44ECF@greggkellogg.net>
```On Dec 1, 2011, at 4:29 AM, Markus Lanthaler wrote:

>> I've been implementing the Value Expansion algorithm, and I think that
>> the procedure is somewhat incomplete.
>>
>> Basically, the algorithm considers three cases, Arrays, Objects and
>> everything else.
>>
>> [...]
>>
>> 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.

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.

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

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

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.

5) {"foo": {"@list": ["ex:bar", "ex:baz"]}, same argument as for 4).

Gregg

>> There's also the question of resolving relative IRIs: mostly, they
>> should be resolved against @base, but @type should be resolved against
>> @vocab.
>
> We should discuss whether we really would like to keep @base and @vocab
>
>
>
> --
> Markus Lanthaler
> @markuslanthaler
>
>
>
```
Received on Thursday, 1 December 2011 18:38:43 UTC

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