metanorma / pubid-core

BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Pubid algebra: is new edition of #49

Closed mico closed 4 weeks ago

mico commented 3 months ago

related #47

is new edition of (newer edition year)

Identifier.parse("ISO 22610:2018").new_edition_of?("ISO 22610:2006") => true
ronaldtse commented 3 months ago

Agree with use case.

mico commented 3 months ago

@ronaldtse for #new_edition_of? could be provided identifier that related to another document like

Identifier.parse("ISO 22610:2018").new_edition_of?("ISO/PRF 6709:2022")

But also can be provided even identifier from different provider:

Identifier.parse("ISO 22610:2018").new_edition_of?("BS 7121-3:2017")

What should we do in these cases? Returning false would be not completely correct, because it might mean that original identifier newer edition, which is not correct because documents are not related. Raising an error, wouldn't it be too redundant?

@andrew2net any thoughts?

ronaldtse commented 3 months ago

I think it's just false because we can't really raise an error...

mico commented 3 months ago

@ronaldtse should we also compare supplements, drafts editions? Like ISO/IEC/IEEE 8802-22.2:2015/Amd.2:2017, IEEE Draft Std PC57.21/D14, December 2007?

ronaldtse commented 3 months ago

I think it's just false because we can't really raise an error...

Or maybe we throw an error that it cannot be compared?

mico commented 3 months ago

I think it's just false because we can't really raise an error...

Or maybe we throw an error that it cannot be compared?

  • different publishers can’t be compared?
  • amd and cor cannot be compared?

@ronaldtse I can just throw an error when identifiers doesn't match without edition

andrew2net commented 3 months ago

Or we can just return nil for not comparable IDs. So the caller method can decide what to do with it.

mico commented 3 months ago

Or we can just return nil for not comparable IDs. So the caller method can decide what to do with it.

@andrew2net it's quite uncommon to return anything else except true or false for #? methods...

mico commented 2 months ago

After talking with @andrew2net we decided not to compare identifiers without year or edition because it's not correct, ISO 1 might represent latest edition but we don't know what is the latest year. Also for comparison in relaton we don't need comparison for identifiers without year. So I'll update code in pull request accordingly.

andrew2net commented 2 months ago

Also for comparison in relaton we don't need comparison for identifiers without year.

@mico actually we do need comparison IDs without year in Relaton, but it's not like in this issue.