-
Notifications
You must be signed in to change notification settings - Fork 23
Revisit empty string as term #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Do we have a use case for this? The language case was solved with |
Coming from turtle, the usage, that then allows predicates like However... I wonder if this is something that comes naturally to a JSON user and whether it is, in fact, more twisting her mind rather than be helpful... which may backfire conveying the idea of JSON-LD being overly complex:-( (Honestly: I have never thought of using an empty string as a key in JavaScript or Python. I did not even realize this was possible...) |
I think we'd want some input from Markus (@lanthaler) on this one -- as he'd have to deal with it in his PHP implementation. I don't know if we'd be updating our PHP implementation any time soon ... nor do I know how widely it is used. I suppose if this change is accepted we might find out! 😄 |
How important is it to match the Turtle stylistically in JSON-LD? Seems the risk (support in PHP < 7.1, confusingness, etc) may not worth the reward? |
I don't understand what value this would add. On the other hand, I expect that such a feature would add a considerable amount of confusion. JSON-LD has
Note how |
The motivation for allowing empty strings as keys in JSON-LD would simply be for completeness; IIRC, it was not allowed in 1.0 because of issues in PHP, otherwise, why create an exception. JSON, itself, defines objects have having string keys referencing JSON values, with no restriction that the string be non-empty.
That said, there's really not a compelling use case for allowing this now, and I'm 👍 for closing this issue as |
👍 to close won't fix as there's no use case we're actually solving here, and the confusion of mapping empty string to some value would be never-ending.
|
👍 to won't fix |
1 similar comment
👍 to won't fix |
Just to document my thoughts in case this is ever revisited, here are two esoteric use cases: Obfuscated JSON-LD: Term Compression: {
"@context": ...,
"things": [
{
"@id": "urn:ex:1",
"a-rather-long-term-name": { ... }
},
... a million more items ...
]
} One could construct a context to "compress" this data: {
"a": "a-rather-long-term-name",
...
} A compact phase would result in: ...
"things": [
{
"@id": "urn:ex:1",
"a": { ... }
},
... a million more items ...
] And later you could re-compact with some other context to recreate whatever structure and term names you need. I'm unsure if this is actually useful. Maybe it could be with huge datasets to save memory or space, I'm unsure? Probably better to just use an alternate JSON serialization and/or regular compression tools. But if it was useful, then having the empty term |
WG resolved to close this issue won't fix, as there is no use case (beyond minified or obfuscated context declarations) and allowing it will generate confusion rather than add value. |
JSON-LD has a restriction that terms must not be the empty string
From JSON-LD Syntax 6.1:
IIRC, this was added due to an issue in an earlier version of PHP, and I suspect it is no longer an issue. Furthermore, the use of empty prefixes is common in other RDF syntaxes, so allowing it here for 1.1 documents would be reasonable, if tooling supports it.
As evidence, consider this stackoverflow question.
Also, note that while the syntax document makes such a normative statement, the API algorithms don't call this out as an error condition.
Original issue Revisit empty string as term #584
The text was updated successfully, but these errors were encountered: