Conversation
- Various tests of when `@type` of `@json` is used, the JSON may be an array, and the interaction with a `@container` of `@set` and `@list`. - Change compaction output for `@json` and `@set` with a JSON array. - Add test for many other possibilities and processing algorithms. - Propose new `multiple JSON literals` error code when trying to add multiple JSON literals as values for a property.
ad04884 to
8ec7642
Compare
|
Some of these assume changes to the algorithms that will need their own PRs:
|
|
Addresses #560. |
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
| "@id": "#tjs12", | ||
| "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], | ||
| "name": "Compact JSON literal (empty array)", | ||
| "purpose": "Tests compacting property with @type @json to a JSON literal (empty array).", |
There was a problem hiding this comment.
| "purpose": "Tests compacting property with @type @json to a JSON literal (empty array).", | |
| "purpose": "Tests compacting property with @type @json to a JSON literal (array with string).", |
| "@id": "#tjs13", | ||
| "@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"], | ||
| "name": "Compact JSON literal (array with string)", | ||
| "purpose": "Tests compacting property with @type @json to a JSON literal (array with string).", |
There was a problem hiding this comment.
| "purpose": "Tests compacting property with @type @json to a JSON literal (array with string).", | |
| "purpose": "Tests compacting property with @type @json to a JSON literal (empty array).", |
| }, { | ||
| "@id": "#ter58", | ||
| "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], | ||
| "name": "Array not found for @json @set.", | ||
| "purpose": "The value for a @json @set term MUST be an array.", | ||
| "input": "expand/er57-in.jsonld", | ||
| "expectErrorCode": "invalid set or list object" |
There was a problem hiding this comment.
| }, { | |
| "@id": "#ter58", | |
| "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], | |
| "name": "Array not found for @json @set.", | |
| "purpose": "The value for a @json @set term MUST be an array.", | |
| "input": "expand/er57-in.jsonld", | |
| "expectErrorCode": "invalid set or list object" |
Duplicate id with the next one, and duplicate content with the previous one.
| "@id": "#ter57", | ||
| "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], | ||
| "name": "Array not found for @json @set.", | ||
| "purpose": "The value for a @json @set term MUST be an array.", | ||
| "input": "expand/er57-in.jsonld", | ||
| "expectErrorCode": "invalid set or list object" |
There was a problem hiding this comment.
I this test is accepted, it should have counterparts with other values for @type (ex:datatype, @id), and without any @type. I see no reason why "@type": "@json" should behave differently.
But more generally, I don't think that this test should be accepted nor that this behavior should be required. There are many other situations where parts of the context are ignored if the encountered value is not of the expected kind. For example, @type coertion is ignored if the value of the property is not a JSON scalar.
| }, { | ||
| "@id": "#ter58", | ||
| "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"], | ||
| "name": "Array not found for @json @list.", | ||
| "purpose": "The value for a @json @list term MUST be an array.", | ||
| "input": "expand/er58-in.jsonld", | ||
| "expectErrorCode": "invalid set or list object" |
There was a problem hiding this comment.
Same comment as above (for ter57): I don't think that this test should be accepted.
I concur that having a simple value converted to an RDF list is a bit counter-intuitive, but it follows the principle that, in JSON-LD, "prop": val and "prop": [val] are equivalent.
| "name": "JSON literals (strings)", | ||
| "purpose": "Tests creating property with multiple rdf:type rdf:JSON to a JSON literal (null).", |
There was a problem hiding this comment.
the 'name' is not accurate, and I don't understand the sentence under 'purpose' (using "rdf:type" to talk about the datatype is very confusing).
| "name": "JSON literals (strings)", | |
| "purpose": "Tests creating property with multiple rdf:type rdf:JSON to a JSON literal (null).", | |
| "name": "Multiple JSON literals", | |
| "purpose": "Tests creating property with multiple literal values of datatype rdf:JSON", |
| "name": "Mixed JSON literals and non-JSON", | ||
| "purpose": "Tests creating property with mixed rdf:type rdf:JSON and non-JSON.", |
There was a problem hiding this comment.
| "name": "Mixed JSON literals and non-JSON", | |
| "purpose": "Tests creating property with mixed rdf:type rdf:JSON and non-JSON.", | |
| "name": "Mixed JSON literal and non-JSON", | |
| "purpose": "Tests creating property with mixed values: literal of datatype rdf:type and non-JSON.", |
Actually, the test is mixing a literal of datatype rdf:JSON and an IRI, so the text is still a bit misleading (I would expect "non-JSON" to mean "a literal with another datatype than rdf:JSON).
| }, { | ||
| "@id": "#ter57", | ||
| "@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest" ], | ||
| "name": "Array not found for @json @list.", | ||
| "purpose": "The value for a @json @list term MUST be an array.", | ||
| "input": "toRdf/er57-in.jsonld", | ||
| "expectErrorCode": "invalid set or list object" | ||
| }, { | ||
| "@id": "#ter58", | ||
| "@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest" ], | ||
| "name": "Array not found for @json @set.", | ||
| "purpose": "The value for a @json @set term MUST be an array.", | ||
| "input": "toRdf/er58-in.jsonld", | ||
| "expectErrorCode": "invalid set or list object" |
There was a problem hiding this comment.
| }, { | |
| "@id": "#ter57", | |
| "@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest" ], | |
| "name": "Array not found for @json @list.", | |
| "purpose": "The value for a @json @list term MUST be an array.", | |
| "input": "toRdf/er57-in.jsonld", | |
| "expectErrorCode": "invalid set or list object" | |
| }, { | |
| "@id": "#ter58", | |
| "@type": ["jld:NegativeEvaluationTest", "jld:ToRDFTest" ], | |
| "name": "Array not found for @json @set.", | |
| "purpose": "The value for a @json @set term MUST be an array.", | |
| "input": "toRdf/er58-in.jsonld", | |
| "expectErrorCode": "invalid set or list object" |
For the reasons explained above (in expand-manifest.jsonld), I believe that these tests should not be accepted.
| }, { | ||
| "@id": "#tej01", | ||
| "@type": ["jld:NegativeEvaluationTest", "jld:CompactTest"], | ||
| "name": "Multiple JSON values for a JSON literal properties", |
There was a problem hiding this comment.
Goes with change elsewhere
| "name": "Multiple JSON values for a JSON literal properties", | |
| "name": "Multiple JSON values for a JSON literal property", |
|
This was discussed during the #json-ld meeting on 12 February 2025. View the transcriptw3c/json-ld-api#559<gb> Pull Request 559 Add JSON literal tests. (by davidlehn) [spec:substantive] [test:missing-coverage] |
@typeof@jsonis used, the JSON may be an array, and the interaction with a@containerof@setand@list.@jsonand@setwith a JSON array.multiple JSON literalserror code when trying to add multiple JSON literals as values for a property not declared a@set.NOTE: This is a work-in-progress that needs feedback. HTML rebuild has not yet been done.
Please put major discussion in the issue that links here as this PR may need to be replaced.