metanorma / pubid-core

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

Pubid algebra #47

Open mico opened 3 months ago

mico commented 3 months ago

Somewhat related to this topic, i want to have a “pubid algebra” implemented, covering these relationships:

mico commented 3 months ago

@ronaldtse for more clarity could you add some examples for dated version, includes, sibling?

mico commented 2 months ago

I'll add some examples here, @ronaldtse please check if it's correct:

is new edition of (newer edition year)

Identifier.parse("ISO 22610:2018").new_edition_of?("ISO 22610:2006") => true

is supplement to / is base of, eg. amendment, corrigenda…

Identifier.parse("ISO 10360-1:2000").base_to?("ISO 10360-1:2000/Cor 1:2002") => true

Identifier.parse("ISO 10360-1:2000/Cor 1:2002").supplement_to?("ISO 10360-1:2000") => true

Identifier.parse("ISO 10360-1:2000/Cor 1:2002").corrigenda_to?("ISO 10360-1:2000") => true

Identifier.parse("ISO 10360-1:2000/Cor 1:2002").ammendment_to?("ISO 10360-1:2000") => false

Identifier.parse("ISO 13688:2013/Amd 1:2021").ammendment_to?("ISO 13688:2013") => true
mico commented 2 months ago

is dated version of (like superclass)

Identifier.parse("ISO 10360-1:2000").dated_version_of?("ISO 10360-1") => true
mico commented 2 months ago

includes (eg is part of)


Identifier.parse("IEEE Std 605-2008 (Revision of IEEE Std 605-1998 / Incorporates IEEE Std 605a-2010)").includes?("IEEE Std 605a-2010") => true

Identifier.parse("IEEE Std 1003.5b-1996 (Includes IEEE Std 1003.5-1992)").includes?("IEEE Std 1003.5-1992") => true

Identifier.parse("IEC 62760:2016+AMD1:2019 CSV").includes?("IEC 62760:2016") => true

Identifier.parse("IEC 62760:2016+AMD1:2019 CSV").includes?("IEC 62760:2016/AMD1:2019") => true



Didn't find cases for `pubid-iso` and `pubid-nist`, but I believe there are. @ronaldtse @andrew2net @opoudjis could you help?
mico commented 2 months ago

is sibling (different parts of the same collection)

Identifier.parse("ISO 10993-4").is_sibling?("ISO 10993-12") => true

# I'm not sure about this one
Identifier.parse("IEEE 1904.1").is_sibling?("IEEE 1904.4") => true

@ronaldtse @andrew2net @opoudjis other cases?

mico commented 2 months ago

is draft of, is draft, is published

Identifier.pase("IEEE Draft Std P1635/D4").draft_of?("IEEE Draft Std P1635") => true
Identifier.pase("IEEE Draft Std P1635/D4").is_draft? => true
Identifier.pase("IEEE Draft Std P1635/D4").is_published? => false
Identifier.pase("IEEE Draft Std P1635").is_published? => true

other cases?

ronaldtse commented 2 months ago
Identifier.pase("IEEE Draft Std P1635").is_published? => true

This should be false?

ronaldtse commented 2 months ago
Identifier.parse("ISO 13688:2013/Amd 1:2021").ammendment_to?("ISO 13688:2013") => true

"amendment" not "ammendment".

ronaldtse commented 2 months ago
# Successor
Identifier.parse("ISO/IEC 27002:2013/Cor 2:2015").is_successor_of?("ISO/IEC 27002:2013/Cor 1:2014")
andrew2net commented 2 months ago

We have some logic in Relaton that should be moved to pubid.