-
Notifications
You must be signed in to change notification settings - Fork 0
Rough draft #1
base: main
Are you sure you want to change the base?
Rough draft #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Early days yet, and my understanding of context is poor.
<> s = <> | ||
(x^y)s = (x s)^(y s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much better, but we are no nearer understanding selectors from this. Can we assert that a selected sequence is a subsequence (not necessarily contiguous) of the original?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but each value in the selected sequence is a descendant (or equal to) of a value in the original sequence.
If `m` and `n` are JSON objects with no keys in common, then `m ∪ n` is the JSON object containing | ||
all the mappings of `m` and `n` (but no others). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anything to say about common keys? The overuse of the term 'mapping' is potentially confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was trying to define a partial ∪
operation as that's all we need in the remainder of the spec (I think). If we had to handle common keys, we'd need something like Z's function override. How about the following?
If `m` and `n` are JSON objects with no keys in common, then `m ∪ n` is the JSON object containing | |
all the mappings of `m` and `n` (but no others). | |
If `m` and `n` are JSON objects with no keys in common, then `m ∪ n` is the JSON object containing | |
all the pairs of keys and values from `m` and `n` (but no others). |
`$` is effectively a no-op. If `t` is a JSONPath (without a leading `$`), then: | ||
``` | ||
<v>$t = <v>t | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of thing is $
? Is it a selector, a JsonPath or something else? What does it mean for a JSONPath to have a "leading $
", and why does it matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are at least two schools of thought. I have tended to think of $
as a special selector which takes the input value and produces a sequence consisting of just that value. Others think of $
as a kind of delimiter which says "start at the root of the input value". The latter is more consistent with the use of $
in filter notation (which we'll come to later).
The original JSONPath article required all JSONPaths to start with $
, but some implementations make this optional, just to confuse matters.
... details! ... | ||
``` | ||
|
||
If `a` is not an array and `sl` is a slice expression, then: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a
here is a value, I take it. Or an object. Hmm, I'm getting really confused here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a
is probably the worst name for this case. It's any value which isn't an array. It could be an object or a scalar.
Note to reviewers: this is a very rough draft. Comments are welcome, but many terms need to be defined etc.