Should character-escaping be applied when generating JSON-LD IRIs?
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 139
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
Observation
When a key includes characters that must be escaped in an IRI, it is currently unspecified what a JSON-LD processor should do.
The JSON-LD Playground currently exhibits different behaviours for such cases, depending on the character that is involved
When a greater than sign ('>') occurs inside a key, JSON-LD Playground generates a malformed triple:
{"@context": {"@version": 1.1, "@vocab": "https://example.com/"}, "a>b": "c"}
Result:
_:b0 <https://example.com/a>b> "c" .
Notice that this triple cannot be loaded in triple stores that check for IRI syntax.
When a space (' ') occurs inside a key, JSON-LD Playground generates no triple:
{"@context": {"@version": 1.1, "@vocab": "https://example.com/"}, "a b": "c"}
Notice that the current behaviour is difficult to predict: JSON-LD Playground already implements two different behaviours; other JSON-LD processors may do other things as well.
Expected
I expect that the JSON-LD standard prescribes what a JSON-LD processor must do when it encounters a character that must be escaped according to the IRI grammar. I see 5 options here:
- It is up to the JSON-LD processor to choose what it does in such cases. The behaviour is undefined in the standard.
- A JSON-LD processor must not apply character escaping, must generate any incorrect triples that result from this, and must either silently succeed or emit a warning.
- A JSON-LD processor must not apply character escaping, must not generate any incorrect triples that result from this, and must silently succeed or emit a warning.
- A JSON-LD processor must not apply character escaping, must not generate any incorrect triples that result from this, and must emit an error and fail.
- A JSON-LD processor must apply character escaping, and can only generate correct triples as a result of this.
Notice that JSON-LD Playground currently implements options (2) and (3), for seemingly arbitrary reasons. JSON-LD Playground also (trivially) implements option 1.
My personal ranking of these options, from most to least desired: 5 > 4 > 3 > 2 > 1
Notice that all options are an improvement over the current situation, where the intended behaviour is unknown.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the JSON-LD 1.1 specification alongside the JSON-LD Playground examples for keys containing greater-than signs and spaces. Determine which normative processing rule applies and document the required behavior, including whether processors must escape, reject, warn, or omit invalid IRIs.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100