relaton-bib 2.0.0.pre.alpha.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.rubocop.yml +1 -1
  4. data/CLAUDE.md +96 -0
  5. data/Gemfile +1 -0
  6. data/README.adoc +14 -2
  7. data/grammars/basicdoc.rng +75 -45
  8. data/grammars/biblio-standoc.rng +37 -56
  9. data/grammars/biblio.rng +68 -36
  10. data/grammars/versions.json +25 -25
  11. data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +663 -0
  12. data/lib/relaton/bib/converter/asciibib.rb +13 -0
  13. data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +245 -0
  14. data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +341 -0
  15. data/lib/relaton/bib/converter/bibtex.rb +23 -0
  16. data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +383 -0
  17. data/lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb +71 -0
  18. data/lib/relaton/bib/{renderer/rfc.rb → converter/bibxml/to_rfcxml.rb} +100 -92
  19. data/lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb +52 -0
  20. data/lib/relaton/bib/converter/bibxml.rb +51 -0
  21. data/lib/relaton/bib/hash_parser_v1.rb +121 -78
  22. data/lib/relaton/bib/item_data.rb +83 -22
  23. data/lib/relaton/bib/model/abstract.rb +16 -0
  24. data/lib/relaton/bib/model/date.rb +6 -4
  25. data/lib/relaton/bib/model/depiction.rb +2 -0
  26. data/lib/relaton/bib/model/ext.rb +0 -3
  27. data/lib/relaton/bib/model/formattedref.rb +43 -0
  28. data/lib/relaton/bib/model/ics.rb +9 -0
  29. data/lib/relaton/bib/model/item.rb +12 -4
  30. data/lib/relaton/bib/model/item_base.rb +17 -9
  31. data/lib/relaton/bib/model/keyword.rb +3 -3
  32. data/lib/relaton/bib/model/logo.rb +2 -0
  33. data/lib/relaton/bib/model/organization_type.rb +1 -1
  34. data/lib/relaton/bib/model/relation.rb +2 -2
  35. data/lib/relaton/bib/model/series.rb +5 -3
  36. data/lib/relaton/bib/model/subdivision.rb +2 -0
  37. data/lib/relaton/bib/model/title.rb +38 -0
  38. data/lib/relaton/bib/model/type/string_date.rb +48 -0
  39. data/lib/relaton/bib/model/validity.rb +3 -3
  40. data/lib/relaton/bib/namespace_helper.rb +21 -0
  41. data/lib/relaton/bib/version.rb +1 -1
  42. data/lib/relaton/bib.rb +5 -82
  43. data/relaton-bib.gemspec +5 -2
  44. metadata +63 -29
  45. data/lib/relaton/bib/model/editorial_group.rb +0 -14
  46. data/lib/relaton/bib/model/technical_committee.rb +0 -14
  47. data/lib/relaton/bib/model/workgroup.rb +0 -20
  48. data/lib/relaton/bib/parser/rfc_address.rb +0 -60
  49. data/lib/relaton/bib/parser/rfc_contacts.rb +0 -35
  50. data/lib/relaton/bib/parser/rfc_docidentifier.rb +0 -70
  51. data/lib/relaton/bib/parser/rfc_organization.rb +0 -31
  52. data/lib/relaton/bib/parser/rfc_person.rb +0 -42
  53. data/lib/relaton/bib/parser/rfc_reference.rb +0 -143
  54. data/lib/relaton/bib/parser/rfc_referencegroup.rb +0 -45
  55. data/lib/relaton/bib/parser/rfc_shared.rb +0 -23
  56. data/lib/relaton/bib/renderer/bibtex_builder.rb +0 -348
  57. data/lib/relaton/bibtex_parser.rb +0 -243
  58. data/lib/relaton/bibxml_parser.rb +0 -419
  59. data/lib/relaton/deep_dup.rb +0 -30
  60. data/lib/relaton/hit.rb +0 -52
  61. data/lib/relaton/hit_collection.rb +0 -105
  62. data/lib/relaton/workers_pool.rb +0 -43
  63. data/lib/relaton/xml_parser.rb +0 -716
data/grammars/biblio.rng CHANGED
@@ -1,23 +1,25 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <!--
3
- instantiations of this grammar may replace leaf strings
4
- with more elaborated types; e.g. title (text) replaced with
5
- title-main, title-intro, title-part; type replaced with
6
- enum.
7
-
8
- some renaming at leaf nodes is permissible
9
-
10
- obligations can change both from optional to mandatory,
11
- and from mandatory to optional; optional elements may
12
- be omitted; freely positioned alternatives may be replaced
13
- with strict ordering
14
-
15
- DO NOT introduce a namespace here. We do not want a distinct namespace
16
- for these elements, and a distinct namespace for any grammar inheriting
17
- these elements; we just want one namespace for any child grammars
18
- of this.
19
- -->
20
2
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
+ <!--
4
+ ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix
5
+
6
+ Instantiations of this grammar may replace leaf strings
7
+ with more elaborated types; e.g. title (text) replaced with
8
+ title-main, title-intro, title-part; type replaced with
9
+ enum.
10
+
11
+ Some renaming at leaf nodes is permissible
12
+
13
+ Obligations can change both from optional to mandatory,
14
+ and from mandatory to optional; optional elements may
15
+ be omitted; freely positioned alternatives may be replaced
16
+ with strict ordering
17
+
18
+ DO NOT introduce a namespace here. We do not want a distinct namespace
19
+ for these elements, and a distinct namespace for any grammar inheriting
20
+ these elements; we just want one namespace for any child grammars
21
+ of this.
22
+ -->
21
23
  <!--
22
24
  https://www.myintervals.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
23
25
  iso8601date = xsd:string { pattern = "([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?" }
@@ -240,6 +242,8 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
240
242
  </choice>
241
243
  </define>
242
244
  <define name="roledescription">
245
+ <a:documentation>A more detailed description of the role of the contributor
246
+ Some descriptions are reserved words; in particular, the editorial committee of a standard has the role description "committee"</a:documentation>
243
247
  <element name="description">
244
248
  <ref name="LocalizedMarkedUpString"/>
245
249
  </element>
@@ -441,7 +445,10 @@ real names (if the person is named with a pseudonym or user name); previous lega
441
445
  </oneOrMore>
442
446
  <zeroOrMore>
443
447
  <ref name="subdivision">
444
- <a:documentation>The subdivision of the organization directly involved with the production of the bibliographic item</a:documentation>
448
+ <a:documentation>The subdivision of the organization directly involved with the production of the bibliographic item.
449
+ Multiple subdivisions can be specified for an organization, with no implication of hierarchical
450
+ relation between them
451
+ Editorial and advisory groups are represented as consecutive subdivisions of the SDO</a:documentation>
445
452
  </ref>
446
453
  </zeroOrMore>
447
454
  <optional>
@@ -459,11 +466,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
459
466
  <a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
460
467
  </ref>
461
468
  </optional>
462
- <optional>
469
+ <zeroOrMore>
463
470
  <ref name="logo">
464
471
  <a:documentation>A logo for the organization</a:documentation>
465
472
  </ref>
466
- </optional>
473
+ </zeroOrMore>
467
474
  </define>
468
475
  <define name="orgname">
469
476
  <element name="name">
@@ -483,6 +490,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
483
490
  <a:documentation>The type of subdivision</a:documentation>
484
491
  </attribute>
485
492
  </optional>
493
+ <optional>
494
+ <attribute name="subtype">
495
+ <a:documentation>The subtype of subdivision; e.g. different types of technical committee</a:documentation>
496
+ </attribute>
497
+ </optional>
486
498
  <ref name="OrganizationType">
487
499
  <a:documentation>The subdivision, modelled recursively as an organization</a:documentation>
488
500
  </ref>
@@ -490,6 +502,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
490
502
  </define>
491
503
  <define name="logo">
492
504
  <element name="logo">
505
+ <optional>
506
+ <attribute name="type">
507
+ <a:documentation>The type of logo</a:documentation>
508
+ </attribute>
509
+ </optional>
493
510
  <ref name="image-no-id"/>
494
511
  </element>
495
512
  </define>
@@ -501,6 +518,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
501
518
  <a:documentation>Description of what is being depicted</a:documentation>
502
519
  </attribute>
503
520
  </optional>
521
+ <optional>
522
+ <attribute name="type">
523
+ <a:documentation>Description of what kind of depiction this</a:documentation>
524
+ </attribute>
525
+ </optional>
504
526
  <zeroOrMore>
505
527
  <ref name="image-no-id">
506
528
  <a:documentation>A visual depiction of the bibliographic item</a:documentation>
@@ -678,7 +700,7 @@ Examples include GRID, LEI, CrossRef, and Ringgold</a:documentation>
678
700
  <define name="CitationType">
679
701
  <attribute name="bibitemid">
680
702
  <a:documentation>Bibliographic item that the citation applies to, referenced as the anchor of a bibliographic description</a:documentation>
681
- <data type="IDREF"/>
703
+ <ref name="IdRefType"/>
682
704
  </attribute>
683
705
  <choice>
684
706
  <zeroOrMore>
@@ -857,7 +879,7 @@ depending on whether the items exist as independent documents, or are parts of a
857
879
  </zeroOrMore>
858
880
  </element>
859
881
  </define>
860
- <define name="BibItemType" combine="choice">
882
+ <define name="BibItemType">
861
883
  <a:documentation>Type of bibliographic item.
862
884
  The value list complies with the types provided in ISO 690:2021.
863
885
  NOTE: These values represent a strict superset to BibTeX
@@ -1120,11 +1142,11 @@ NOTE: This should preferably be encoded as a URI or short identifier, rather th
1120
1142
  <a:documentation>Information about how long the current description of the bibliographic item is valid for</a:documentation>
1121
1143
  </ref>
1122
1144
  </optional>
1123
- <optional>
1145
+ <zeroOrMore>
1124
1146
  <ref name="depiction">
1125
1147
  <a:documentation>Depiction of the bibliographic item, typically an image</a:documentation>
1126
1148
  </ref>
1127
- </optional>
1149
+ </zeroOrMore>
1128
1150
  </define>
1129
1151
  <define name="ReducedBibliographicItem">
1130
1152
  <a:documentation>Reduced description of a bibliographic resource, without mandatory title and docidentifier, used for document relations
@@ -1224,9 +1246,9 @@ Refer to `BibliographicItem` for definitions</a:documentation>
1224
1246
  <optional>
1225
1247
  <ref name="validity"/>
1226
1248
  </optional>
1227
- <optional>
1249
+ <zeroOrMore>
1228
1250
  <ref name="depiction"/>
1229
- </optional>
1251
+ </zeroOrMore>
1230
1252
  </define>
1231
1253
  <define name="btitle">
1232
1254
  <a:documentation>A title of a bibliographic item, associated with a type of title</a:documentation>
@@ -1241,6 +1263,11 @@ Refer to `BibliographicItem` for definitions</a:documentation>
1241
1263
  </define>
1242
1264
  <define name="formattedref">
1243
1265
  <element name="formattedref">
1266
+ <optional>
1267
+ <attribute name="format">
1268
+ <a:documentation>format of formatted reference; Metanorma assumes references are formatted as Metanorma XML</a:documentation>
1269
+ </attribute>
1270
+ </optional>
1244
1271
  <oneOrMore>
1245
1272
  <ref name="TextElement"/>
1246
1273
  </oneOrMore>
@@ -1279,17 +1306,17 @@ for which this claim of validity is made, if applicable</a:documentation>
1279
1306
  </define>
1280
1307
  <define name="validityBegins">
1281
1308
  <element name="validityBegins">
1282
- <ref name="ISO8601Date"/>
1309
+ <ref name="ISO8601DateTime"/>
1283
1310
  </element>
1284
1311
  </define>
1285
1312
  <define name="validityEnds">
1286
1313
  <element name="validityEnds">
1287
- <ref name="ISO8601Date"/>
1314
+ <ref name="ISO8601DateTime"/>
1288
1315
  </element>
1289
1316
  </define>
1290
1317
  <define name="validityRevision">
1291
1318
  <element name="revision">
1292
- <ref name="ISO8601Date"/>
1319
+ <ref name="ISO8601DateTime"/>
1293
1320
  </element>
1294
1321
  </define>
1295
1322
  <define name="TypedTitleString">
@@ -1812,6 +1839,11 @@ May be used to differentiate rendering of notes in bibliographies</a:documentati
1812
1839
  <a:documentation>Abstract of bibliographic item</a:documentation>
1813
1840
  <element name="abstract">
1814
1841
  <ref name="LocalizedStringAttributes"/>
1842
+ <optional>
1843
+ <attribute name="format">
1844
+ <a:documentation>What format the formatted abstract is in. In Metanorma, assumed to be Metanorma XML</a:documentation>
1845
+ </attribute>
1846
+ </optional>
1815
1847
  <choice>
1816
1848
  <oneOrMore>
1817
1849
  <ref name="BasicBlockNoId">
@@ -1907,10 +1939,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
1907
1939
  <value>hasAnnotation</value>
1908
1940
  <value>draftOf</value>
1909
1941
  <value>hasDraft</value>
1910
- <value>preliminaryDraftOf</value>
1911
- <value>hasPreliminaryDraft</value>
1912
- <value>revisionDraftOf</value>
1913
- <value>hasRevisionDraft</value>
1942
+ <value>predecessorDraftOf</value>
1943
+ <value>hasPredecessorDraft</value>
1944
+ <value>successorDraftOf</value>
1945
+ <value>hasSuccessorDraft</value>
1914
1946
  <value>editionOf</value>
1915
1947
  <value>hasEdition</value>
1916
1948
  <value>updates</value>
@@ -2031,13 +2063,13 @@ provided that it is not the entire bibliographic item that is so related</a:docu
2031
2063
  <ref name="LocalizedString"/>
2032
2064
  </element>
2033
2065
  </optional>
2034
- <oneOrMore>
2066
+ <zeroOrMore>
2035
2067
  <element name="taxon">
2036
2068
  <a:documentation>The keywords as a hierarchical taxonomy. For example, the sequence of `taxon` elements
2037
2069
  `pump`, `centrifugal pump`, `line shaft pump` represents a taxonomic classification</a:documentation>
2038
2070
  <ref name="LocalizedString"/>
2039
2071
  </element>
2040
- </oneOrMore>
2072
+ </zeroOrMore>
2041
2073
  <zeroOrMore>
2042
2074
  <ref name="vocabid">
2043
2075
  <a:documentation>Identifiers for the keyword as a controlled vocabulary</a:documentation>
@@ -1,35 +1,35 @@
1
1
  {
2
- "relaton-models": "v1.4.1",
3
- "basicdoc-models": "v1.2.2",
2
+ "relaton-models": "v1.5.6",
3
+ "basicdoc-models": "v1.2.5",
4
4
  "metanorma-requirements-models": "v1.0.2",
5
- "relaton-model-ieee": "v1.0.1",
6
- "relaton-model-iso": "v1.0.5",
7
- "relaton-model-iec": "v1.0.0",
8
- "relaton-model-bsi": "v1.0.3",
9
- "relaton-model-gb": "v1.0.0",
5
+ "relaton-model-ieee": "v1.1.3",
6
+ "relaton-model-iso": "v1.1.2",
7
+ "relaton-model-iec": "v1.1.2",
8
+ "relaton-model-bsi": "v1.1.3",
9
+ "relaton-model-gb": "v1.1.2",
10
10
  "relaton-model-mpfa": "v1.0.0",
11
- "relaton-model-bipm": "v1.0.1",
11
+ "relaton-model-bipm": "v1.1.2",
12
12
  "relaton-model-w3c": "v1.0.0",
13
- "relaton-model-3gpp": "v1.0.1",
14
- "relaton-model-csa": "v1.0.0",
15
- "relaton-model-cc": "v1.0.0",
16
- "relaton-model-ietf": "v1.0.1",
17
- "relaton-model-iho": "v1.0.0",
18
- "relaton-model-itu": "v1.0.2",
19
- "relaton-model-m3aawg": "v1.0.0",
20
- "relaton-model-nist": "v1.0.0",
21
- "relaton-model-ribose": "v1.0.0",
22
- "relaton-model-ogc": "v1.0.1",
23
- "relaton-model-un": "v1.0.0",
13
+ "relaton-model-3gpp": "v1.0.4",
14
+ "relaton-model-cc": "v1.1.2",
15
+ "relaton-model-ietf": "v1.1.2",
16
+ "relaton-model-iho": "v1.1.2",
17
+ "relaton-model-itu": "v1.1.3",
18
+ "relaton-model-m3aawg": "v1.0.1",
19
+ "relaton-model-nist": "v1.1.2",
20
+ "relaton-model-ribose": "v1.1.2",
21
+ "relaton-model-ogc": "v1.1.2",
24
22
  "relaton-model-cen": "v1.0.1",
25
23
  "relaton-model-ecma": "v1.0.0",
26
24
  "relaton-model-cie": "v1.0.0",
27
25
  "relaton-model-iana": "v1.0.0",
28
26
  "relaton-model-omg": "v1.0.0",
29
- "relaton-model-oasis": "v1.0.1",
30
- "relaton-model-jis": "v0.0.1",
31
- "relaton-model-etsi": "v0.0.3",
32
- "relaton-model-plateau": "v0.0.2",
33
- "metanorma-model": "v1.4.1",
34
- "date": "2024-12-03T03:33:24Z"
27
+ "relaton-model-oasis": "v1.0.4",
28
+ "relaton-model-jis": "v1.0.2",
29
+ "relaton-model-etsi": "v0.1.2",
30
+ "relaton-model-plateau": "v0.1.0",
31
+ "relaton-model-ccsds": "",
32
+ "relaton-model-un": "v1.0.2",
33
+ "metanorma-model": "v2.1.6",
34
+ "date": "2026-04-03T02:05:43Z"
35
35
  }