relaton / relaton-iso

RelatonIso: ISO Standards metadata using the BibliographicItem model
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

Normalize ISO references using pubid-iso gem #109

Closed ronaldtse closed 2 years ago

ronaldtse commented 2 years ago

In https://github.com/metanorma/iso-6709/issues/7, the identifier ISO 6709:2008/Cor. 1:2009 was used but was not accepted by Relaton ISO.

This is because the now correct identifier does not have the full stop after Cor. However, this is an old style reference, and is accepted by the pubid-iso gem.

We should use integrate Relaton-ISO with the pubid-iso gem to normalize the input, and output PubID-ISO identifiers (as objects, not strings).

andrew2net commented 2 years ago

duplicated https://github.com/relaton/relaton-iso/issues/108

ronaldtse commented 2 years ago

Indeed the original issue is gone but integration with pubid-iso is to be done (some more work may be necessary). Let's keep this one for integrating pubid-iso.

andrew2net commented 2 years ago

@ronaldtse this is the pubid-iso's or pubid-core's issue

relaton fetch 'ISO 6709:2008/Cor. 1:2009'
/Users/andrej/.rvm/gems/ruby-3.0.0/gems/pubid-core-0.2.2/lib/pubid/core/identifier.rb:93:in `rescue in parse': Failed to match sequence (stage:'Fpr'? 'WD/'? (type:GUIDE_PREFIX SPACE)? (stage:STAGE SPACE)? ORIGINATOR (SPACE / '/') (TC_DOCUMENT_BODY / STD_DOCUMENT_BODY / DIR_DOCUMENT_BODY (' + ' joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?)) at line 1 char 5. (Pubid::Core::Errors::ParseError)
cause: Failed to match sequence (stage:'Fpr'? 'WD/'? (type:GUIDE_PREFIX SPACE)? (stage:STAGE SPACE)? ORIGINATOR (SPACE / '/') (TC_DOCUMENT_BODY / STD_DOCUMENT_BODY / DIR_DOCUMENT_BODY (' + ' joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?)) at line 1 char 5.
`- Expected one of [TC_DOCUMENT_BODY, STD_DOCUMENT_BODY, DIR_DOCUMENT_BODY (' + ' joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?] at line 1 char 5.
   |- Failed to match sequence ((tctype:TCTYPE '/'?){0, } SPACE tcnumber:DIGITS ('/' ((sctype:SCTYPE SPACE scnumber:DIGITS '/')? wgtype:WGTYPE SPACE wgnumber:DIGITS / sctype:SCTYPE (SPACE / '/' wgtype:WGTYPE SPACE) scnumber:DIGITS))? SPACE 'N' SPACE? number:DIGITS) at line 1 char 5.
   |  `- Expected " ", but got "6" at line 1 char 5.
   |- Failed to match sequence ((TYPE / stage:STAGE)? SPACE? ((stage:STAGE / TYPE) SPACE)? number:DIGITS ('|' joint_document:('IDF' SPACE DIGITS))? PART? ITERATION? (SPACE? ':' YEAR)? (AMENDMENT CORRIGENDUM? / CORRIGENDUM)? EDITION? LANGUAGE?) at line 1 char 14.
   |  `- Extra input after last repetition at line 1 char 14.
   |     `- Failed to match sequence ('(' language:(([a-z]{1, } ','? / ('E' / 'F' / 'A' / 'R') '/'?){0, }) ')') at line 1 char 14.
   |        `- Expected "(", but got "/" at line 1 char 14.
   `- Failed to match sequence (DIR_DOCUMENT_BODY (' + ' joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?) at line 1 char 14.
      `- Extra input after last repetition at line 1 char 14.
         `- Failed to match sequence (' + ' joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY)) at line 1 char 14.
            `- Expected " + ", but got "/Co" at line 1 char 14.
ronaldtse commented 2 years ago

@ronaldtse this is the pubid-iso's or pubid-core's issue

relaton fetch 'ISO 6709:2008/Cor. 1:2009'
/Users/andrej/.rvm/gems/ruby-3.0.0/gems/pubid-core-0.2.2/lib/pubid/core/identifier.rb:93:in `rescue in parse': Failed to match sequence (stage:'Fpr'? 'WD/'? (type:GUIDE_PREFIX SPACE)? (stage:STAGE SPACE)? ORIGINATOR (SPACE / '/') (TC_DOCUMENT_BODY / STD_DOCUMENT_BODY / DIR_DOCUMENT_BODY (' + ' joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?)) at line 1 char 5. (Pubid::Core::Errors::ParseError)
cause: Failed to match sequence (stage:'Fpr'? 'WD/'? (type:GUIDE_PREFIX SPACE)? (stage:STAGE SPACE)? ORIGINATOR (SPACE / '/') (TC_DOCUMENT_BODY / STD_DOCUMENT_BODY / DIR_DOCUMENT_BODY (' + ' joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?)) at line 1 char 5.
`- Expected one of [TC_DOCUMENT_BODY, STD_DOCUMENT_BODY, DIR_DOCUMENT_BODY (' + ' joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?] at line 1 char 5.
   |- Failed to match sequence ((tctype:TCTYPE '/'?){0, } SPACE tcnumber:DIGITS ('/' ((sctype:SCTYPE SPACE scnumber:DIGITS '/')? wgtype:WGTYPE SPACE wgnumber:DIGITS / sctype:SCTYPE (SPACE / '/' wgtype:WGTYPE SPACE) scnumber:DIGITS))? SPACE 'N' SPACE? number:DIGITS) at line 1 char 5.
   |  `- Expected " ", but got "6" at line 1 char 5.
   |- Failed to match sequence ((TYPE / stage:STAGE)? SPACE? ((stage:STAGE / TYPE) SPACE)? number:DIGITS ('|' joint_document:('IDF' SPACE DIGITS))? PART? ITERATION? (SPACE? ':' YEAR)? (AMENDMENT CORRIGENDUM? / CORRIGENDUM)? EDITION? LANGUAGE?) at line 1 char 14.
   |  `- Extra input after last repetition at line 1 char 14.
   |     `- Failed to match sequence ('(' language:(([a-z]{1, } ','? / ('E' / 'F' / 'A' / 'R') '/'?){0, }) ')') at line 1 char 14.
   |        `- Expected "(", but got "/" at line 1 char 14.
   `- Failed to match sequence (DIR_DOCUMENT_BODY (' + ' joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY))?) at line 1 char 14.
      `- Extra input after last repetition at line 1 char 14.
         `- Failed to match sequence (' + ' joint_document:(ORIGINATOR SPACE DIR_DOCUMENT_BODY)) at line 1 char 14.
            `- Expected " + ", but got "/Co" at line 1 char 14.

@andrew2net can you file this in pubid-iso? I will file the issue this time but let's keep concerns separate.

ronaldtse commented 2 years ago

@andrew2net this is fixed in https://github.com/metanorma/pubid-iso/pull/65 .