Skip to content
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

Name- and number-tree handling of Name and Num array "keys" which are null #307

Closed
petervwyatt opened this issue Jul 4, 2023 · 4 comments
Assignees
Labels
ISO approved Resolved issue approved by ISO

Comments

@petervwyatt
Copy link
Member

petervwyatt commented Jul 4, 2023

See veraPDF/veraPDF-library#1355 and pdf-association/arlington-pdf-model#90.

One of the issues in veraPDF/veraPDF-library#1355 is that the key in the name-tree is null and name tree keys are defined as "where each keyi shall be a string" and "The keys shall be sorted in lexical order". number-tree use slightly different wording for the key type ("each keyi is an integer" - "is" vs "shall") but the same wording for the sorting requirement ("The keys shall be sorted in numerical order").

So name-tree/number-tree keys cannot be null (fails "shall be a string"/"is an integer") and no allowance is made in either the lexical or numeric sorting algorithms for null keys - for example, whether they need to come first, last, or are skipped over entirely. And what would it mean if you had a null key but a non-null value??? Is that meaningful? (I note in veraPDF/veraPDF-library#1355 that both the key and value are both null).

So referring to Tables 36 and 37:

  • can name-tree and number-trees have keys that are null?

I think the answer is yes (it's relatively common as @bdoubrov points out) so we need to allow null as an explicit key type for both. And name and number trees should both use the same "shall"-style wording for consistency.

  • what are the requirements (if any) for the lexical and numeric sorting for keys that are null?

I think the answer is that keys that are null can appear anywhere but are ignored (not involved/skipped over) when considering lexical or numeric sorting. Not sure how to best phrase this - either we can say that only keys that are string/integer are sorted, or we say something about keys that are null...

  • does a null key with a non-null value mean anything special?

I think no. It's syntactically valid but stupid as the value is "inaccessible" via a name/number tree lookup - so no real difference to a key and value both being null. This is probably worth a short informative NOTE.

@petervwyatt petervwyatt added the bug Something isn't correct label Jul 4, 2023
@petervwyatt petervwyatt self-assigned this Jul 4, 2023
@petervwyatt petervwyatt added the question Further information is requested label Jul 4, 2023
@petervwyatt
Copy link
Member Author

My misunderstanding about veraPDF/veraPDF-library#1355 and pdf-association/arlington-pdf-model#90. That is not related.

But my questions are still valid - can name-/number-trees have keys (even array elements 0, 2, 4, ...) that are null in Names and Nums arrays?

@bdoubrov
Copy link

bdoubrov commented Jul 4, 2023

I'd say no, same as for dictionaries:

  • The keys in name-tree are always of string type
  • The keys in number-tree are always of integer type

@petervwyatt
Copy link
Member Author

And makes it very easy to then state "... and shall not be null".

@petervwyatt petervwyatt added the proposed solution Proposed solution is ready for review label Jul 4, 2023
@petervwyatt petervwyatt changed the title Name- and number-tree handling of keys which are null Name- and number-tree handling of Name and Num array "keys" which are null Jul 4, 2023
@petervwyatt petervwyatt added documentation Improvements or additions to documentation and removed bug Something isn't correct labels Jul 6, 2023
@petervwyatt petervwyatt removed the question Further information is requested label Oct 7, 2023
@petervwyatt
Copy link
Member Author

PDF TWG agree

@petervwyatt petervwyatt added ISO approved Resolved issue approved by ISO and removed documentation Improvements or additions to documentation proposed solution Proposed solution is ready for review labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ISO approved Resolved issue approved by ISO
Projects
None yet
Development

No branches or pull requests

2 participants