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

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 (123) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/README.adoc +183 -154
  4. data/bin/console +1 -1
  5. data/grammars/basicdoc.rng +1516 -645
  6. data/grammars/biblio-standoc.rng +100 -20
  7. data/grammars/biblio.rng +959 -356
  8. data/grammars/versions.json +10 -10
  9. data/lib/relaton/bib/hash_parser_v1.rb +711 -0
  10. data/lib/relaton/bib/item_data.rb +168 -0
  11. data/lib/relaton/bib/model/address.rb +22 -0
  12. data/lib/relaton/bib/model/affiliation.rb +16 -0
  13. data/lib/relaton/bib/model/bibdata.rb +24 -0
  14. data/lib/relaton/bib/model/bibitem.rb +23 -0
  15. data/lib/relaton/bib/model/contact.rb +18 -0
  16. data/lib/relaton/bib/model/contribution_info.rb +16 -0
  17. data/lib/relaton/bib/model/contributor.rb +71 -0
  18. data/lib/relaton/bib/model/copyright.rb +27 -0
  19. data/lib/relaton/bib/model/date.rb +29 -0
  20. data/lib/relaton/bib/model/depiction.rb +14 -0
  21. data/lib/relaton/bib/model/docidentifier.rb +33 -0
  22. data/lib/relaton/bib/model/doctype.rb +14 -0
  23. data/lib/relaton/bib/model/edition.rb +14 -0
  24. data/lib/relaton/bib/model/editorial_group.rb +14 -0
  25. data/lib/relaton/bib/model/ext.rb +29 -0
  26. data/lib/relaton/bib/model/extent.rb +16 -0
  27. data/lib/relaton/bib/model/full_name_type.rb +64 -0
  28. data/lib/relaton/bib/model/fullname.rb +11 -0
  29. data/lib/relaton/bib/model/ics.rb +14 -0
  30. data/lib/relaton/bib/model/image.rb +28 -0
  31. data/lib/relaton/bib/model/item.rb +129 -0
  32. data/lib/relaton/bib/model/item_base.rb +19 -0
  33. data/lib/relaton/bib/model/keyword.rb +30 -0
  34. data/lib/relaton/bib/model/locality.rb +18 -0
  35. data/lib/relaton/bib/model/locality_stack.rb +14 -0
  36. data/lib/relaton/bib/model/localized_string.rb +57 -0
  37. data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
  38. data/lib/relaton/bib/model/logo.rb +12 -0
  39. data/lib/relaton/bib/model/medium.rb +22 -0
  40. data/lib/relaton/bib/model/note.rb +16 -0
  41. data/lib/relaton/bib/model/organization.rb +13 -0
  42. data/lib/relaton/bib/model/organization_type.rb +42 -0
  43. data/lib/relaton/bib/model/person.rb +36 -0
  44. data/lib/relaton/bib/model/phone.rb +14 -0
  45. data/lib/relaton/bib/model/place.rb +33 -0
  46. data/lib/relaton/bib/model/price.rb +14 -0
  47. data/lib/relaton/bib/model/relation.rb +43 -0
  48. data/lib/relaton/bib/model/series.rb +32 -0
  49. data/lib/relaton/bib/model/size.rb +23 -0
  50. data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
  51. data/lib/relaton/bib/model/status.rb +27 -0
  52. data/lib/relaton/bib/model/structured_identifier.rb +48 -0
  53. data/lib/relaton/bib/model/subdivision.rb +14 -0
  54. data/lib/relaton/bib/model/technical_committee.rb +14 -0
  55. data/lib/relaton/bib/model/title.rb +18 -0
  56. data/lib/relaton/bib/model/uri.rb +18 -0
  57. data/lib/relaton/bib/model/validity.rb +16 -0
  58. data/lib/relaton/bib/model/version.rb +14 -0
  59. data/lib/relaton/bib/model/workgroup.rb +20 -0
  60. data/lib/relaton/bib/parser/rfc_address.rb +60 -0
  61. data/lib/relaton/bib/parser/rfc_contacts.rb +35 -0
  62. data/lib/relaton/bib/parser/rfc_docidentifier.rb +70 -0
  63. data/lib/relaton/bib/parser/rfc_organization.rb +31 -0
  64. data/lib/relaton/bib/parser/rfc_person.rb +42 -0
  65. data/lib/relaton/bib/parser/rfc_reference.rb +143 -0
  66. data/lib/relaton/bib/parser/rfc_referencegroup.rb +45 -0
  67. data/lib/relaton/bib/parser/rfc_shared.rb +23 -0
  68. data/lib/relaton/bib/renderer/bibtex_builder.rb +348 -0
  69. data/lib/relaton/bib/renderer/rfc.rb +297 -0
  70. data/lib/relaton/bib/util.rb +18 -0
  71. data/lib/relaton/bib/version.rb +5 -0
  72. data/lib/{relaton_bib.rb → relaton/bib.rb} +47 -36
  73. data/lib/{relaton_bib → relaton}/bibtex_parser.rb +24 -27
  74. data/lib/{relaton_bib → relaton}/bibxml_parser.rb +43 -46
  75. data/lib/{relaton_bib → relaton}/hit.rb +3 -3
  76. data/lib/{relaton_bib → relaton}/hit_collection.rb +2 -2
  77. data/lib/{relaton_bib → relaton}/workers_pool.rb +1 -1
  78. data/lib/{relaton_bib → relaton}/xml_parser.rb +49 -51
  79. data/relaton-bib.gemspec +8 -8
  80. metadata +95 -74
  81. data/lib/relaton_bib/bib_item_locality.rb +0 -175
  82. data/lib/relaton_bib/biblio_note.rb +0 -72
  83. data/lib/relaton_bib/biblio_version.rb +0 -46
  84. data/lib/relaton_bib/bibliographic_date.rb +0 -119
  85. data/lib/relaton_bib/bibliographic_item.rb +0 -668
  86. data/lib/relaton_bib/bibliographic_size.rb +0 -103
  87. data/lib/relaton_bib/classification.rb +0 -40
  88. data/lib/relaton_bib/config.rb +0 -16
  89. data/lib/relaton_bib/contribution_info.rb +0 -117
  90. data/lib/relaton_bib/contributor.rb +0 -277
  91. data/lib/relaton_bib/copyright_association.rb +0 -79
  92. data/lib/relaton_bib/document_identifier.rb +0 -118
  93. data/lib/relaton_bib/document_relation.rb +0 -95
  94. data/lib/relaton_bib/document_relation_collection.rb +0 -57
  95. data/lib/relaton_bib/document_status.rb +0 -92
  96. data/lib/relaton_bib/document_type.rb +0 -52
  97. data/lib/relaton_bib/edition.rb +0 -55
  98. data/lib/relaton_bib/editorial_group.rb +0 -41
  99. data/lib/relaton_bib/extent.rb +0 -39
  100. data/lib/relaton_bib/forename.rb +0 -65
  101. data/lib/relaton_bib/formatted_ref.rb +0 -17
  102. data/lib/relaton_bib/formatted_string.rb +0 -133
  103. data/lib/relaton_bib/full_name.rb +0 -108
  104. data/lib/relaton_bib/hash_converter.rb +0 -568
  105. data/lib/relaton_bib/ics.rb +0 -42
  106. data/lib/relaton_bib/image.rb +0 -95
  107. data/lib/relaton_bib/localized_string.rb +0 -149
  108. data/lib/relaton_bib/medium.rb +0 -76
  109. data/lib/relaton_bib/organization.rb +0 -165
  110. data/lib/relaton_bib/person.rb +0 -129
  111. data/lib/relaton_bib/place.rb +0 -203
  112. data/lib/relaton_bib/renderer/bibtex_builder.rb +0 -312
  113. data/lib/relaton_bib/renderer/bibxml.rb +0 -296
  114. data/lib/relaton_bib/series.rb +0 -119
  115. data/lib/relaton_bib/structured_identifier.rb +0 -173
  116. data/lib/relaton_bib/technical_committee.rb +0 -34
  117. data/lib/relaton_bib/typed_title_string.rb +0 -191
  118. data/lib/relaton_bib/typed_uri.rb +0 -57
  119. data/lib/relaton_bib/util.rb +0 -16
  120. data/lib/relaton_bib/validity.rb +0 -52
  121. data/lib/relaton_bib/version.rb +0 -3
  122. data/lib/relaton_bib/workgroup.rb +0 -58
  123. /data/lib/{relaton_bib → relaton}/deep_dup.rb +0 -0
@@ -0,0 +1,129 @@
1
+ require "lutaml/model"
2
+ require "lutaml/model/xml_adapter/nokogiri_adapter"
3
+ require_relative "localized_string_attrs"
4
+ require_relative "localized_string"
5
+ require_relative "date"
6
+ require_relative "locality"
7
+ require_relative "locality_stack"
8
+ require_relative "image"
9
+ require_relative "title"
10
+ require_relative "docidentifier"
11
+ require_relative "note"
12
+ require_relative "full_name_type"
13
+ require_relative "fullname"
14
+ require_relative "contact"
15
+ require_relative "logo"
16
+ require_relative "organization"
17
+ require_relative "affiliation"
18
+ require_relative "person"
19
+ require_relative "contribution_info"
20
+ require_relative "contributor"
21
+ require_relative "edition"
22
+ require_relative "version"
23
+ require_relative "status"
24
+ require_relative "copyright"
25
+ require_relative "place"
26
+ require_relative "series"
27
+ require_relative "medium"
28
+ require_relative "uri"
29
+ require_relative "price"
30
+ require_relative "extent"
31
+ require_relative "size"
32
+ require_relative "keyword"
33
+ require_relative "validity"
34
+ require_relative "depiction"
35
+ require_relative "source_locality_stack"
36
+ require_relative "ext"
37
+
38
+ Lutaml::Model::Config.configure do |config|
39
+ config.xml_adapter = Lutaml::Model::Xml::NokogiriAdapter
40
+ end
41
+
42
+ module Relaton
43
+ module Bib
44
+ class Relation < Lutaml::Model::Serializable
45
+ end
46
+
47
+ # Item class repesents bibliographic item metadata.
48
+ class Item < Lutaml::Model::Serializable
49
+ model ItemData
50
+
51
+ attribute :id, :string
52
+ attribute :type, :string, values: %W[
53
+ article book booklet manual proceedings presentation thesis techreport standard
54
+ unpublished map electronic\sresource audiovisual film video boradcast software
55
+ graphic_work music patent inbook incollection inproceedings journal website
56
+ webresource dataset archival social_media alert message convesation misc
57
+ ]
58
+ attribute :schema_version, :string
59
+ attribute :fetched, :date
60
+ attribute :formattedref, :string, raw: true
61
+ attribute :title, Title, collection: true, initialize_empty: true
62
+ attribute :source, Uri, collection: true, initialize_empty: true
63
+ attribute :docidentifier, Docidentifier, collection: true, initialize_empty: true
64
+ attribute :docnumber, :string
65
+ attribute :date, Date, collection: true, initialize_empty: true
66
+ attribute :contributor, Contributor, collection: true, initialize_empty: true
67
+ attribute :edition, Edition
68
+ attribute :version, Version, collection: true, initialize_empty: true
69
+ attribute :note, Note, collection: true, initialize_empty: true
70
+ attribute :language, :string, collection: true, initialize_empty: true
71
+ attribute :locale, :string, collection: true, initialize_empty: true
72
+ attribute :script, :string, collection: true, initialize_empty: true
73
+ attribute :abstract, LocalizedMarkedUpString, collection: true, initialize_empty: true
74
+ attribute :status, Status
75
+ attribute :copyright, Copyright, collection: true, initialize_empty: true
76
+ attribute :relation, Relation, collection: true, initialize_empty: true
77
+ attribute :series, Series, collection: true, initialize_empty: true
78
+ attribute :medium, Medium
79
+ attribute :place, Place, collection: true, initialize_empty: true
80
+ attribute :price, Price, collection: true, initialize_empty: true
81
+ attribute :extent, Extent, collection: true, initialize_empty: true
82
+ attribute :size, Size
83
+ attribute :accesslocation, :string, collection: true, initialize_empty: true
84
+ attribute :license, :string, collection: true, initialize_empty: true
85
+ attribute :classification, Docidentifier, collection: true, initialize_empty: true
86
+ attribute :keyword, Keyword, collection: true, initialize_empty: true
87
+ attribute :validity, Validity
88
+ attribute :depiction, Depiction
89
+ attribute :ext, Ext
90
+
91
+ xml do # rubocop:disable Metrics/BlockLength
92
+ map_attribute "id", to: :id
93
+ map_attribute "type", to: :type
94
+ map_attribute "schema-version", to: :schema_version
95
+ map_element "fetched", to: :fetched
96
+ map_element "formattedref", to: :formattedref
97
+ map_element "title", to: :title # , with: { from: :title_from_xml, to: :title_to_xml }
98
+ map_element "uri", to: :source
99
+ map_element "docidentifier", to: :docidentifier
100
+ map_element "docnumber", to: :docnumber
101
+ map_element "date", to: :date
102
+ map_element "contributor", to: :contributor
103
+ map_element "edition", to: :edition
104
+ map_element "version", to: :version
105
+ map_element "note", to: :note
106
+ map_element "language", to: :language
107
+ map_element "locale", to: :locale
108
+ map_element "script", to: :script
109
+ map_element "abstract", to: :abstract
110
+ map_element "status", to: :status
111
+ map_element "copyright", to: :copyright
112
+ map_element "relation", to: :relation # , with: { from: :relation_from_xml, to: :relation_to_xml }
113
+ map_element "series", to: :series
114
+ map_element "medium", to: :medium
115
+ map_element "place", to: :place
116
+ map_element "price", to: :price
117
+ map_element "extent", to: :extent
118
+ map_element "size", to: :size
119
+ map_element "accesslocation", to: :accesslocation
120
+ map_element "license", to: :license
121
+ map_element "classification", to: :classification
122
+ map_element "keyword", to: :keyword
123
+ map_element "validity", to: :validity
124
+ map_element "depiction", to: :depiction
125
+ map_element "ext", to: :ext
126
+ end
127
+ end
128
+ end
129
+ end
@@ -0,0 +1,19 @@
1
+ module Relaton
2
+ module Bib
3
+ # The class is for relaton bibitem instances.
4
+ # The in relaton bibitem instances dosn't have schema-version & fetched attributes.
5
+ class ItemBase < Item
6
+ model ItemData
7
+
8
+ # we don't need id, schema-version & fetched attributes in reation/bibitem
9
+ mappings[:xml].instance_variable_get(:@attributes).delete("id")
10
+ mappings[:xml].instance_variable_get(:@attributes).delete("schema-version")
11
+ mappings[:xml].instance_variable_get(:@elements).delete("fetched")
12
+ mappings[:xml].instance_variable_get(:@elements).delete("ext")
13
+ attributes.delete :id
14
+ attributes.delete :schema_version
15
+ attributes.delete :fetched
16
+ attributes.delete :ext
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,30 @@
1
+ module Relaton
2
+ module Bib
3
+ class Keyword < Lutaml::Model::Serializable
4
+ class Vocabid < Lutaml::Model::Serializable
5
+ attribute :type, :string
6
+ attribute :uri, :string
7
+ attribute :code, :string
8
+ attribute :term, :string
9
+
10
+ xml do
11
+ map_attribute "type", to: :type
12
+ map_attribute "uri", to: :uri
13
+ map_element "code", to: :code
14
+ map_element "term", to: :term
15
+ end
16
+ end
17
+
18
+ attribute :vocab, LocalizedString, collection: true, initialize_empty: true
19
+ attribute :taxon, LocalizedString, collection: (1..), initialize_empty: true
20
+ attribute :vocabid, Vocabid
21
+
22
+ xml do
23
+ root "keyword"
24
+ map_element "vocab", to: :vocab
25
+ map_element "taxon", to: :taxon
26
+ map_element "vocabid", to: :vocabid
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,18 @@
1
+ module Relaton
2
+ module Bib
3
+ class Locality < Lutaml::Model::Serializable
4
+ attribute :type, :string, pattern: %r{
5
+ section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|
6
+ figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+
7
+ }x
8
+ attribute :reference_from, :string
9
+ attribute :reference_to, :string
10
+
11
+ xml do
12
+ map_attribute "type", to: :type
13
+ map_element "referenceFrom", to: :reference_from
14
+ map_element "referenceTo", to: :reference_to
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ module Relaton
2
+ module Bib
3
+ class LocalityStack < Lutaml::Model::Serializable
4
+ attribute :connective, :string, values: %w[and or from to]
5
+ attribute :locality, Locality, collection: true, initialize_empty: true
6
+
7
+ xml do
8
+ root "localityStack"
9
+ map_attribute "connective", to: :connective
10
+ map_element "locality", to: :locality
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,57 @@
1
+ module Relaton
2
+ module Bib
3
+ class LocalizedString < LocalizedStringAttrs
4
+ attribute :content, :string
5
+
6
+ xml do
7
+ map_content to: :content
8
+ end
9
+
10
+ key_value do
11
+ map "content", to: :content # , with: { from: :content_from_key_value, to: :content_to_key_value }
12
+ map "language", to: :language
13
+ end
14
+ end
15
+
16
+ class TypedLocalizedString < LocalizedString
17
+ attribute :type, :string
18
+
19
+ xml do
20
+ map_attribute "type", to: :type
21
+ end
22
+
23
+ key_value do
24
+ map "type", to: :type
25
+ end
26
+ end
27
+
28
+ class LocalizedMarkedUpString < LocalizedStringAttrs
29
+ attribute :content, :string
30
+
31
+ xml do
32
+ map_all to: :content, with: { from: :content_from_xml, to: :content_to_xml }
33
+ end
34
+
35
+ key_value do
36
+ map "content", to: :content, with: { from: :content_from_key_value, to: :content_to_key_value }
37
+ map "language", to: :language
38
+ end
39
+
40
+ def content_from_xml(model, value)
41
+ model.content = value
42
+ end
43
+
44
+ def content_to_xml(model, parent, doc)
45
+ doc.add_xml_fragment parent, model.content
46
+ end
47
+
48
+ def content_from_key_value(model, value)
49
+ model.content = value
50
+ end
51
+
52
+ def content_to_key_value(model, doc)
53
+ doc["content"] = model.content
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,24 @@
1
+ module Relaton
2
+ module Bib
3
+ class LocalizedStringAttrs < Lutaml::Model::Serializable
4
+ attribute :language, :string
5
+ attribute :locale, :string
6
+ attribute :script, :string
7
+
8
+ # def self.inherited(base)
9
+ # super
10
+ # base.class_eval do
11
+ xml do
12
+ map_attribute "language", to: :language
13
+ map_attribute "locale", to: :locale
14
+ map_attribute "script", to: :script
15
+ end
16
+
17
+ key_value do
18
+ map "language", to: :language
19
+ map "locale", to: :locale
20
+ map "script", to: :script
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,12 @@
1
+ module Relaton
2
+ module Bib
3
+ class Logo < Lutaml::Model::Serializable
4
+ attribute :image, Image
5
+
6
+ xml do
7
+ root "logo"
8
+ map_element "image", to: :image
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,22 @@
1
+ module Relaton
2
+ module Bib
3
+ class Medium < Lutaml::Model::Serializable
4
+ attribute :content, :string
5
+ attribute :genre, :string
6
+ attribute :form, :string
7
+ attribute :carrier, :string
8
+ attribute :size, :string
9
+ attribute :scale, :string
10
+
11
+ xml do
12
+ root "medium"
13
+ map_element "content", to: :content
14
+ map_element "genre", to: :genre
15
+ map_element "form", to: :form
16
+ map_element "carrier", to: :carrier
17
+ map_element "size", to: :size
18
+ map_element "scale", to: :scale
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,16 @@
1
+ module Relaton
2
+ module Bib
3
+ class Note < LocalizedMarkedUpString
4
+ attribute :type, :string
5
+
6
+ xml do
7
+ root "note"
8
+ map_attribute "type", to: :type
9
+ end
10
+
11
+ key_value do
12
+ map "type", to: :type
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ require_relative "organization_type"
2
+
3
+ module Relaton
4
+ module Bib
5
+ class Organization < Lutaml::Model::Serializable
6
+ include OrganizationType
7
+
8
+ xml do
9
+ root "organization"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,42 @@
1
+ module Relaton
2
+ module Bib
3
+ module OrganizationType
4
+ class Identifier < Lutaml::Model::Serializable
5
+ attribute :type, :string
6
+ attribute :content, :string
7
+
8
+ xml do
9
+ root "identifier"
10
+ map_attribute "type", to: :type
11
+ map_content to: :content
12
+ end
13
+ end
14
+
15
+ def self.included(base) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
16
+ require_relative "subdivision"
17
+
18
+ base.instance_eval do
19
+ include Contact
20
+
21
+ attribute :name, TypedLocalizedString, collection: true, initialize_empty: true
22
+ attribute :subdivision, Subdivision, collection: true, initialize_empty: true
23
+ attribute :abbreviation, LocalizedString
24
+ attribute :identifier, Identifier, collection: true, initialize_empty: true
25
+ attribute :logo, Logo
26
+
27
+ xml do
28
+ map_element "name", to: :name
29
+ map_element "subdivision", to: :subdivision
30
+ map_element "abbreviation", to: :abbreviation
31
+ map_element "identifier", to: :identifier
32
+ map_element "address", to: :address
33
+ map_element "phone", to: :phone
34
+ map_element "email", to: :email
35
+ map_element "uri", to: :uri
36
+ map_element "logo", to: :logo
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,36 @@
1
+ module Relaton
2
+ module Bib
3
+ class Person < Lutaml::Model::Serializable
4
+ class Identifier < Lutaml::Model::Serializable
5
+ attribute :type, :string
6
+ attribute :content, :string
7
+
8
+ xml do
9
+ root "identifier"
10
+ map_attribute "type", to: :type
11
+ map_content to: :content
12
+ end
13
+ end
14
+
15
+ include Contact
16
+
17
+ attribute :name, FullName
18
+ attribute :credential, :string, collection: true, initialize_empty: true
19
+ attribute :affiliation, Affiliation, collection: true, initialize_empty: true
20
+ attribute :identifier, Identifier, collection: true, initialize_empty: true
21
+
22
+ xml do
23
+ root "person"
24
+
25
+ map_element "name", to: :name
26
+ map_element "credential", to: :credential
27
+ map_element "affiliation", to: :affiliation
28
+ map_element "identifier", to: :identifier
29
+ map_element "address", to: :address
30
+ map_element "phone", to: :phone
31
+ map_element "email", to: :email
32
+ map_element "uri", to: :uri
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,14 @@
1
+ module Relaton
2
+ module Bib
3
+ class Phone < Lutaml::Model::Serializable
4
+ attribute :type, :string
5
+ attribute :content, :string
6
+
7
+ xml do
8
+ root "phone"
9
+ map_attribute "type", to: :type
10
+ map_content to: :content
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,33 @@
1
+ module Relaton
2
+ module Bib
3
+ class Place < Lutaml::Model::Serializable
4
+ class RegionType < Lutaml::Model::Serializable
5
+ attribute :iso, :string
6
+ attribute :recommended, :boolean
7
+ attribute :content, :string
8
+
9
+ xml do
10
+ root "region"
11
+ map_attribute "iso", to: :iso
12
+ map_attribute "recommended", to: :recommended
13
+ map_content to: :content
14
+ end
15
+ end
16
+
17
+ attribute :city, :string
18
+ attribute :region, RegionType, collection: true, initialize_empty: true
19
+ attribute :country, RegionType, collection: true, initialize_empty: true
20
+ attribute :formatted_place, :string
21
+ attribute :uri, Uri
22
+
23
+ xml do
24
+ root "place"
25
+ map_element "city", to: :city
26
+ map_element "region", to: :region
27
+ map_element "country", to: :country
28
+ map_element "formattedPlace", to: :formatted_place
29
+ map_element "uri", to: :uri
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,14 @@
1
+ module Relaton
2
+ module Bib
3
+ class Price < Lutaml::Model::Serializable
4
+ attribute :currency, :string
5
+ attribute :content, :string
6
+
7
+ xml do
8
+ root "price"
9
+ map_attribute "currency", to: :currency
10
+ map_content to: :content
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,43 @@
1
+ require_relative "item_base"
2
+
3
+ module Relaton
4
+ module Bib
5
+ class Relation
6
+ attribute :type, :string, values: %w[
7
+ includes includedIn hasPart partOf merges mergedInto splits splitInto
8
+ instanceOf hasInstance exemplarOf hasExemplar manifestationOf
9
+ hasManifestation reproductionOf hasReproduction reprintOf hasReprint
10
+ expressionOf hasExpression translatedFrom hasTranslation arrangementOf
11
+ hasArrangement abridgementOf hasAbridgement annotationOf hasAnnotation
12
+ draftOfhasDraft preliminaryDraftOf hasPreliminaryDraft revisionDraftOf
13
+ hasRevisionDraft editionOf hasEdition updates updatedBy derivedFrom
14
+ derives describes describedBy catalogues cataloguedBy hasSuccessor
15
+ successorOf adaptedFrom hasAdaptation adoptedFrom adoptedAs reviewOf
16
+ hasReview commentaryOf hasCommentary related hasComplement complementOf
17
+ obsoletes obsoletedBy cites isCitedIn
18
+ ]
19
+ attribute :description, LocalizedMarkedUpString
20
+ attribute :bibitem, ItemBase
21
+ choice(min: 1, max: 1) do
22
+ attribute :locality, Locality, collection: true, initialize_empty: true
23
+ attribute :locality_stack, LocalityStack, collection: true, initialize_empty: true
24
+ end
25
+ choice(min: 1, max: 1) do
26
+ attribute :source_locality, Locality, collection: true, initialize_empty: true
27
+ attribute :source_locality_stack, SourceLocalityStack, collection: true, initialize_empty: true
28
+ end
29
+
30
+ xml do
31
+ root "relation"
32
+
33
+ map_attribute "type", to: :type
34
+ map_element "description", to: :description
35
+ map_element "bibitem", to: :bibitem
36
+ map_element "locality", to: :locality
37
+ map_element "localityStack", to: :locality_stack
38
+ map_element "sourceLocality", to: :source_locality
39
+ map_element "sourceLocalityStack", to: :source_locality_stack
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,32 @@
1
+ module Relaton
2
+ module Bib
3
+ class Series < Lutaml::Model::Serializable
4
+ attribute :type, :string, values: %w[main alt]
5
+ attribute :formattedref, :string, raw: true
6
+ attribute :title, Title, collection: (1..)
7
+ attribute :place, Place
8
+ attribute :organization, :string
9
+ attribute :abbreviation, LocalizedString
10
+ attribute :from, :date
11
+ attribute :to, :date
12
+ attribute :number, :string
13
+ attribute :partnumber, :string
14
+ attribute :run, :string
15
+
16
+ xml do
17
+ root "series"
18
+ map_attribute "type", to: :type
19
+ map_element "formattedref", to: :formattedref
20
+ map_element "title", to: :title
21
+ map_element "place", to: :place
22
+ map_element "organization", to: :organization
23
+ map_element "abbreviation", to: :abbreviation
24
+ map_element "from", to: :from
25
+ map_element "to", to: :to
26
+ map_element "number", to: :number
27
+ map_element "partnumber", to: :partnumber
28
+ map_element "run", to: :run
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,23 @@
1
+ module Relaton
2
+ module Bib
3
+ class Size < Lutaml::Model::Serializable
4
+ class Value < Lutaml::Model::Serializable
5
+ attribute :type, :string
6
+ attribute :content, :string
7
+
8
+ xml do
9
+ root "value"
10
+ map_attribute "type", to: :type
11
+ map_content to: :content
12
+ end
13
+ end
14
+
15
+ attribute :value, Value, collection: (1..)
16
+
17
+ xml do
18
+ root "size"
19
+ map_element "value", to: :value
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,14 @@
1
+ module Relaton
2
+ module Bib
3
+ class SourceLocalityStack < Lutaml::Model::Serializable
4
+ attribute :connective, :string, values: %w[and or from to]
5
+ attribute :source_locality, Locality, collection: true, initialize_empty: true
6
+
7
+ xml do
8
+ root "sourceLocalityStack"
9
+ map_attribute "connective", to: :connective
10
+ map_element "sourceLocality", to: :source_locality
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,27 @@
1
+ module Relaton
2
+ module Bib
3
+ class Status < Lutaml::Model::Serializable
4
+ class Stage < Lutaml::Model::Serializable
5
+ attribute :abbreviation, :string
6
+ attribute :content, :string
7
+
8
+ xml do
9
+ root "stage"
10
+ map_attribute "abbreviation", to: :abbreviation
11
+ map_content to: :content
12
+ end
13
+ end
14
+
15
+ attribute :stage, Stage
16
+ attribute :substage, Stage
17
+ attribute :iteration, :string
18
+
19
+ xml do
20
+ root "status"
21
+ map_element "stage", to: :stage
22
+ map_element "substage", to: :substage
23
+ map_element "iteration", to: :iteration
24
+ end
25
+ end
26
+ end
27
+ end