Subject: [Jsonpath] The "union" term

From: Daniel P <[email-masked]>
Date: Mon, 8 Mar 2021 15:58:22 -0500

> From: Greg Dennis <[email-masked]>

> I'm not sure what the term "union" is intended to represent.
>
> [Applying] this word either from mathematical [or] from data structures points of view
> doesn't seem to apply here.
>
> A math sense would imply a set theory operation, but we're not working with set unions,
> which are the distinct combination of all elements within two or more sets.
>
> A data structures sense would mean that were attempting to store two mutually
> exclusive
> pieces of data in the same memory space, and interpreting the bits in that memory as
> needed when appropriate.  This isn't right either.

I think "union" makes sense if the operation produces a list with no
path duplicates. I note that JSONPath for Node.js characterizes its
unions as "real unions" with "no duplicates rather than concatenated
results." But I don't think "union" makes sense if it produces
concatenated results. Other than that, "union" has historical
significance, being used in the original paper.

Personally, I'd prefer the JMESPath term "MultiSelect List", but
noting that in JMSEPath that term doesn't describe exactly the same
thing.

Daniel

---

From: Carsten Bormann <[email-masked]>
Date: Mon, 8 Mar 2021 22:11:43 +0100

>> I'm not sure what the term "union" is intended to represent.

The feature we are discussing mirrors the “union” feature (“|”) of XPath.
I think this is the only reason why it is called that way at the moment.

The union operator is meaningful in XPath as it creates a set union of two node sets.

I’m still not sure that this is the outcome, but if we are going away from a “nodeset” approach to discrete collections of data items (positions in the tree), merging two collections is still a meaningful operation, but offers many ways of duplicate handling and ordering the results.
I don’t have a strong opinion on these ways, just hoping the end result won’t be too bizarre.
How we call the merge operation should depend on what it actually does; union as a placeholder is fine at the moment as we all know that this is a placeholder only.

Grüße, Carsten