metanorma / pubid-iso

Implementation of ISO pubid
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

URNs for Amendments incorrect due to an additional `:iso` element #192

Closed opoudjis closed 1 year ago

opoudjis commented 1 year ago
base = Pubid::Iso::Identifier.parse("ISO 17301-1:2016")
base.edition = 1
id = Pubid::Iso::Identifier.create(:number=>"1", :type=>:amd, :publisher=>"ISO", :year=>"2017", :iteration=>"3", :stage=>"10.20", :base=>base)

id.urn == "urn:iso:std:iso:17301:-1:ed-1:stage-10.20:amd:iso:2017:v1"

That is incorrect, it should be urn:iso:std:iso:17301:-1:ed-1:stage-10.20:amd:2017:v1

The same behaviour is happening with corrigenda.

opoudjis commented 1 year ago

In addition, language and iteration numbers are missing from Amendment URNs:

base = Pubid::Iso::Identifier.parse("ISO 17301-1:2016")
base.edition = 1
id = Pubid::Iso::Identifier.create(:number=>"1", :type=>:amd, :publisher=>"ISO", :year=>"2017", :iteration=>"3", language=>"en", :stage=>"10.20", :base=>base)

id.urn == "urn:iso:std:iso:17301:-1:ed-1:stage-10.20:amd:iso:2017:v1"

I expect to see urn:iso:std:iso:17301:-1:ed-1:stage-10.20:amd:iso:2017:v1.3:en

ronaldtse commented 1 year ago

What the title says is a bug, but these are intended (and correct):

  1. RFC 5141 states that a default language code should not be provided. If the constructor is not passed a language code, the URN should not have a language code.
  2. You are confusing the iteration number vs the edition number. RFC 5141 states that the iteration number is optional for normal documents, and there is no provision for the iteration number for Additions, Supplements and Amendments.

The only fix here is: