-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
As I understand this PR makes pubid-core ignore edition numbers because ISO IDs don't have editions. |
This PR ignore edition numbers when comparing identifiers using But as I understand different publishers might have different approach to edition number, so we can implement separate implementation (or extension) of |
README.adoc
Outdated
|
||
pubid_second = Identifier.parse("ISO 1:1998") | ||
pubid_first.new_edition_of?(pubid_second) | ||
=> false |
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 should add a reversed check:
pubid_second.new_edition_of?(pubid_first)
=> true
lib/pubid/core/identifier/base.rb
Outdated
|
||
return true if other.year.nil? | ||
|
||
year < other.year |
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.
You need to also check the case where if they have edition numbers, some may not have year but have edition.
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.
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)
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.
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.
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