Expansion Algorithm

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.

Array expansion needs to consider that there might be a @list coercion. However, as a corner case, lists within lists probably shouldn't be expanded, since it is unambiguous that they represent a list. This is an unlikely corner case, and we could go either way. Basically, I implement the following:

* (as currently stated) process each item in the array recursively using this algorithm
* If the associated key has a @list coercion rule, wrap the array in an an object with a '@list' key referencing the expanded array.

Object expansion should expand every value, not just those that have keys that are subject to datatype or list coercion. Some examples:

	{"@iri": "foaf:Person"} -- needs to expand to a full IRI
	{"@list": ["a"]} -- needs to expand list contents
	{"@literal": "1", "@datatype": "xsd:string"} -- needs to expand the datatype IRI
	@subject, @type, @iri -- need to have values expanded, even though they're not coerced themselves

Also, native types such as Integer, Boolean and Double/Decimal should probably be expanded to an explicit literal form. We need to provide a reference to the normalized form lexical form for each of these datatypes as well.

There's also the question of resolving relative IRIs: mostly, they should be resolved against @base, but @type should be resolved against @vocab.

I can make the spec changes, but I want to be sure that this is generally accepted.

Gregg

Received on Tuesday, 29 November 2011 03:42:27 UTC