RE: Expansion Algorithm

>> 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.

That would mean that if I receive a JSON document I would have, for
instance, to convert all string back to integers to work with them.
Expanding IRIs makes sense as it is very difficult to expand them on the
fly.
Why do we provide expansion then in the first place? What use cases do you
see for it? If we are going to do this, the differences to a normalized
document are too marginal IMHO.


>> 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.

As to my understanding it means that I have something like

   { "keynotdefinedincontext": { "@iri": "ex:home" } }

and even though that key is not defined in the context, "ex:home" gets
expanded into an absolute IRI. There's no rule that all keys have to be
defined in the context.


>> 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.

Which leads to another interesting question. What happens if they are not
defined? Will they be interpreted as absolute IRIs? As relative ones (which
are then expanded into absolute ones)?


--
Markus Lanthaler
@markuslanthaler

Received on Monday, 5 December 2011 02:48:23 UTC