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

Compare identifier using #new_edition_of? #50

Merged
merged 3 commits into from
Oct 29, 2024
Merged

Compare identifier using #new_edition_of? #50

merged 3 commits into from
Oct 29, 2024

Conversation

mico
Copy link
Contributor

@mico mico commented Sep 9, 2024

closes #49

In this implementation I only consider year to compare editions, numbers are ignored.
Need clarification on edition numbers here metanorma/pubid-iso#274

@andrew2net
Copy link

As I understand this PR makes pubid-core ignore edition numbers because ISO IDs don't have editions.
I want to draw attention to fact that some standards have edition numbers in their IDs. For example IHO standards look like IHO S-100 1.0.0 where 1.0.0 is an edition number.
Shouldn't we implement ISO specific behavior in pubid-iso?

@mico
Copy link
Contributor Author

mico commented Sep 10, 2024

As I understand this PR makes pubid-core ignore edition numbers because ISO IDs don't have editions. I want to draw attention to fact that some standards have edition numbers in their IDs. For example IHO standards look like IHO S-100 1.0.0 where 1.0.0 is an edition number. Shouldn't we implement ISO specific behavior in pubid-iso?

This PR ignore edition numbers when comparing identifiers using #new_edition_of? it doesn't affect anything else.
The reason — I still don't understand how we should compare edition numbers.
ISO have edition numbers, it was mentioned in metanorma/pubid-iso#274

But as I understand different publishers might have different approach to edition number, so we can implement separate implementation (or extension) of #new_edition_of? for each specific pubid-* gem where edition numbers need to be considered for comparison.

README.adoc Outdated

pubid_second = Identifier.parse("ISO 1:1998")
pubid_first.new_edition_of?(pubid_second)
=> false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should add a reversed check:

pubid_second.new_edition_of?(pubid_first)
=> true


return true if other.year.nil?

year < other.year
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to also check the case where if they have edition numbers, some may not have year but have edition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to also check the case where if they have edition numbers, some may not have year but have edition.

@ronaldtse I have question here about that: metanorma/pubid-iso#274
What if we have identifier year 1999, edition number 2 and another identifier year 2000 and edition number 1, is it possible? Does edition number depends on year or they are independed? Is it the same for all publishers? (ISO, IEEE, NIST, ITU, etc)

Copy link
Contributor

@ronaldtse ronaldtse Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible, what that means is that the new edition 1 is a different document altogether from the old document.

This happens when a standard document (eg 10001:2000 edition 3) is re-numbered to another number (eg 11001:2001 edition 4), then a new document adopts the old number (eg 10001:2002 edition 1).

So this means these two documents are "incomparable". As @andrew2net mentioned, we need to distinguish cases where the documents cannot be compared. Either use NIL or throw an error.

@mico mico requested a review from ronaldtse October 9, 2024 12:46
@mico mico merged commit 41066ed into main Oct 29, 2024
51 of 65 checks passed
@mico mico deleted the new-edition-of branch October 29, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pubid algebra: is new edition of
3 participants