Regarding test tpi07, I can't figure out how the @index handling should result in the expected test output.
Expansion algorithm step 13.8.3.7.2 seems like relevant code:
If container mapping includes
@index,index keyis not@index,itemdoes not have an entry@indexandexpanded indexis not@none, initializeindex property valuesto the concatenation ofexpanded indexwith any existing values ofindex keyinitem. Add the key-value pair (expanded index-index property values) toitem. Ifitemis a value object, it MUST NOT contain any extra properties; aninvalid value object errorhas been detected and processing is aborted.
I'm not sure why it checks index key in item and not the expansion of index key. but even that isn't enough, as 13.8.3.7.2 will still set the 'http://example.com/regular' key to:
[
"http://example.com/regular",
{
"@value": "foo"
}
]The first value needs expansion, and the key being set here needs to change to 'http://example.com/prop' so it overrides the existing values.
I can get the test to pass by rewriting 13.8.3.7.2 to do something like this:
If container mapping includes
@index,index keyis not@index,itemdoes not have an entry@indexandexpanded indexis not@none: Initializeexpanded index keyto the result of using the IRI Expansion algorithm, passingactive context,index, andtruefor vocab. Initializeindex property valuesto an array containing a map{'@value': index}. Append any existing values ofexpanded index keyinitemtoindex property values. Add the key-value pair (expanded index key-index property values) to item. Ifitemis a value object, it MUST NOT contain any extra properties; aninvalid value object errorhas been detected and processing is aborted.
But I'm not sure what affect that might have on other tests/code paths.
w3c/json-ld-api#290