relaton-bib 2.1.5 → 2.1.6
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.
- checksums.yaml +4 -4
- data/.github/workflows/integration-tests.yml +1 -1
- data/CLAUDE.md +12 -0
- data/lib/relaton/bib/model/bibdata.rb +0 -2
- data/lib/relaton/bib/model/bibdata_shared.rb +0 -2
- data/lib/relaton/bib/model/bibitem.rb +0 -2
- data/lib/relaton/bib/model/bibitem_shared.rb +0 -2
- data/lib/relaton/bib/model/contact.rb +0 -4
- data/lib/relaton/bib/model/date.rb +0 -2
- data/lib/relaton/bib/model/ext.rb +0 -4
- data/lib/relaton/bib/model/item.rb +3 -48
- data/lib/relaton/bib/model/organization.rb +0 -2
- data/lib/relaton/bib/model/organization_type.rb +0 -2
- data/lib/relaton/bib/model/relation.rb +1 -3
- data/lib/relaton/bib/model/series.rb +0 -2
- data/lib/relaton/bib/model_autoload.rb +85 -0
- data/lib/relaton/bib/version.rb +1 -1
- data/lib/relaton/bib.rb +3 -10
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9c31cacb170e9441c45a4103838d25c58057e82a24e8b83c4f889f2999968fe3
|
|
4
|
+
data.tar.gz: 28856ec2709501d82efa918a127ec23a9742bdd9e610597707367983433df7d9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: adc75a6f70d8fc625b51e5015f903728c00ca72b9301187cd58133f0a0088e31f908cbc8d4f28292964093aeb12506d107575474d6e9b273543c2354e175c167
|
|
7
|
+
data.tar.gz: 509bb3955d8313ef5cd56fbfefa6d151b2002535fefabae6b3926f9ff05aaa22ea0e87802d9ab8d08a108b252e0b2d8483a5c90a72c78cf391a8a3bdfbf922f5
|
data/CLAUDE.md
CHANGED
|
@@ -37,6 +37,18 @@ bin/console
|
|
|
37
37
|
|
|
38
38
|
The codebase uses [lutaml-model](https://github.com/lutaml/lutaml-model) for serialization. Each model class in `lib/relaton/bib/model/` inherits from `Lutaml::Model::Serializable` and declares attributes with XML/YAML/JSON mappings.
|
|
39
39
|
|
|
40
|
+
### Constant loading (autoload)
|
|
41
|
+
|
|
42
|
+
Model and converter constants are wired via Ruby `autoload` from a central manifest,
|
|
43
|
+
[lib/relaton/bib/model_autoload.rb](lib/relaton/bib/model_autoload.rb). This makes load order
|
|
44
|
+
irrelevant and avoids circular requires between mutually-referencing classes (e.g. `OrganizationType`
|
|
45
|
+
↔ `Subdivision`). **When adding a new model class, add an `autoload` entry to the manifest** rather
|
|
46
|
+
than a `require_relative` in a sibling file. The manifest also eagerly loads `lutaml/model`/`lutaml/xml`
|
|
47
|
+
and runs the `Lutaml::Model::Config.configure` block so the XML adapter is set regardless of which
|
|
48
|
+
class is referenced first. Exceptions that keep `require_relative`: files that only *reopen* an
|
|
49
|
+
already-defined module to add methods (the converter method-partials under
|
|
50
|
+
`lib/relaton/bib/converter/*/`), which `autoload` cannot express.
|
|
51
|
+
|
|
40
52
|
### Core Classes
|
|
41
53
|
|
|
42
54
|
**`Relaton::Bib::Item`** ([lib/relaton/bib/model/item.rb](lib/relaton/bib/model/item.rb)) - The main serialization class defining all bibliographic attributes and their XML mappings. Uses `ItemData` as its underlying model.
|
|
@@ -1,53 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require_relative "localized_string"
|
|
5
|
-
require_relative "formattedref"
|
|
6
|
-
require_relative "abstract"
|
|
7
|
-
require_relative "date"
|
|
8
|
-
require_relative "locality"
|
|
9
|
-
require_relative "locality_stack"
|
|
10
|
-
require_relative "image"
|
|
11
|
-
require_relative "title"
|
|
12
|
-
require_relative "docidentifier"
|
|
13
|
-
require_relative "note"
|
|
14
|
-
require_relative "full_name_type"
|
|
15
|
-
require_relative "fullname"
|
|
16
|
-
require_relative "contact"
|
|
17
|
-
require_relative "logo"
|
|
18
|
-
require_relative "organization"
|
|
19
|
-
require_relative "affiliation"
|
|
20
|
-
require_relative "person"
|
|
21
|
-
require_relative "contribution_info"
|
|
22
|
-
require_relative "contributor"
|
|
23
|
-
require_relative "edition"
|
|
24
|
-
require_relative "version"
|
|
25
|
-
require_relative "status"
|
|
26
|
-
require_relative "copyright"
|
|
27
|
-
require_relative "place"
|
|
28
|
-
require_relative "series"
|
|
29
|
-
require_relative "medium"
|
|
30
|
-
require_relative "uri"
|
|
31
|
-
require_relative "price"
|
|
32
|
-
require_relative "extent"
|
|
33
|
-
require_relative "size"
|
|
34
|
-
require_relative "keyword"
|
|
35
|
-
require_relative "validity"
|
|
36
|
-
require_relative "depiction"
|
|
37
|
-
require_relative "source_locality_stack"
|
|
38
|
-
require_relative "ext"
|
|
39
|
-
require_relative "item_shared"
|
|
40
|
-
require_relative "type/plain_date"
|
|
41
|
-
|
|
42
|
-
Lutaml::Model::Config.configure do |config|
|
|
43
|
-
config.xml_adapter_type = :nokogiri
|
|
44
|
-
end
|
|
45
|
-
|
|
1
|
+
# Model classes are wired via autoload (see model_autoload.rb); the lutaml
|
|
2
|
+
# requires and XML adapter configuration live there so they run eagerly,
|
|
3
|
+
# independent of which model class is referenced first.
|
|
46
4
|
module Relaton
|
|
47
5
|
module Bib
|
|
48
|
-
class Relation < Lutaml::Model::Serializable
|
|
49
|
-
end
|
|
50
|
-
|
|
51
6
|
# Item class repesents bibliographic item metadata.
|
|
52
7
|
# Used for YAML/JSON parsing and as the XML dispatch entry point.
|
|
53
8
|
class Item < Lutaml::Model::Serializable
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
require_relative "item_base"
|
|
2
|
-
|
|
3
1
|
module Relaton
|
|
4
2
|
module Bib
|
|
5
|
-
class Relation
|
|
3
|
+
class Relation < Lutaml::Model::Serializable
|
|
6
4
|
attribute :type, :string, values: %w[
|
|
7
5
|
includes includedIn hasPart partOf merges mergedInto splits splitInto
|
|
8
6
|
instanceOf hasInstance exemplarOf hasExemplar manifestationOf
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Central autoload manifest for the model + converter layer.
|
|
2
|
+
#
|
|
3
|
+
# Declaring these as autoloads (instead of a require_relative chain) makes load
|
|
4
|
+
# order irrelevant and removes the circular require between OrganizationType and
|
|
5
|
+
# Subdivision (issue #120): a constant is loaded on first reference rather than
|
|
6
|
+
# at file-load time, so mutually-referencing classes resolve each other lazily.
|
|
7
|
+
#
|
|
8
|
+
# lutaml-model must be available before the first model autoload fires, and the
|
|
9
|
+
# XML adapter must be configured eagerly here (not inside item.rb) so that
|
|
10
|
+
# serializing through any model class works regardless of which one is
|
|
11
|
+
# referenced first.
|
|
12
|
+
require "lutaml/model"
|
|
13
|
+
require "lutaml/xml"
|
|
14
|
+
|
|
15
|
+
Lutaml::Model::Config.configure do |config|
|
|
16
|
+
config.xml_adapter_type = :nokogiri
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
module Relaton
|
|
20
|
+
module Bib
|
|
21
|
+
autoload :Abstract, "relaton/bib/model/abstract"
|
|
22
|
+
autoload :Address, "relaton/bib/model/address"
|
|
23
|
+
autoload :Affiliation, "relaton/bib/model/affiliation"
|
|
24
|
+
autoload :Bibdata, "relaton/bib/model/bibdata"
|
|
25
|
+
autoload :BibdataShared, "relaton/bib/model/bibdata_shared"
|
|
26
|
+
autoload :Bibitem, "relaton/bib/model/bibitem"
|
|
27
|
+
autoload :BibitemShared, "relaton/bib/model/bibitem_shared"
|
|
28
|
+
autoload :Contact, "relaton/bib/model/contact"
|
|
29
|
+
autoload :ContributionInfo, "relaton/bib/model/contribution_info"
|
|
30
|
+
autoload :Contributor, "relaton/bib/model/contributor"
|
|
31
|
+
autoload :Copyright, "relaton/bib/model/copyright"
|
|
32
|
+
autoload :Date, "relaton/bib/model/date"
|
|
33
|
+
autoload :Depiction, "relaton/bib/model/depiction"
|
|
34
|
+
autoload :Docidentifier, "relaton/bib/model/docidentifier"
|
|
35
|
+
autoload :Doctype, "relaton/bib/model/doctype"
|
|
36
|
+
autoload :Edition, "relaton/bib/model/edition"
|
|
37
|
+
autoload :Ext, "relaton/bib/model/ext"
|
|
38
|
+
autoload :Extent, "relaton/bib/model/extent"
|
|
39
|
+
autoload :Formattedref, "relaton/bib/model/formattedref"
|
|
40
|
+
autoload :FullName, "relaton/bib/model/fullname"
|
|
41
|
+
autoload :FullNameType, "relaton/bib/model/full_name_type"
|
|
42
|
+
autoload :ICS, "relaton/bib/model/ics"
|
|
43
|
+
autoload :Image, "relaton/bib/model/image"
|
|
44
|
+
autoload :Item, "relaton/bib/model/item"
|
|
45
|
+
autoload :ItemBase, "relaton/bib/model/item_base"
|
|
46
|
+
autoload :ItemShared, "relaton/bib/model/item_shared"
|
|
47
|
+
autoload :Keyword, "relaton/bib/model/keyword"
|
|
48
|
+
autoload :Locality, "relaton/bib/model/locality"
|
|
49
|
+
autoload :LocalityStack, "relaton/bib/model/locality_stack"
|
|
50
|
+
# localized_string.rb defines three top-level constants:
|
|
51
|
+
autoload :LocalizedString, "relaton/bib/model/localized_string"
|
|
52
|
+
autoload :TypedLocalizedString, "relaton/bib/model/localized_string"
|
|
53
|
+
autoload :LocalizedMarkedUpString, "relaton/bib/model/localized_string"
|
|
54
|
+
autoload :LocalizedStringAttrs, "relaton/bib/model/localized_string_attrs"
|
|
55
|
+
autoload :Logo, "relaton/bib/model/logo"
|
|
56
|
+
autoload :Medium, "relaton/bib/model/medium"
|
|
57
|
+
autoload :Note, "relaton/bib/model/note"
|
|
58
|
+
autoload :Organization, "relaton/bib/model/organization"
|
|
59
|
+
autoload :OrganizationType, "relaton/bib/model/organization_type"
|
|
60
|
+
autoload :Person, "relaton/bib/model/person"
|
|
61
|
+
autoload :Phone, "relaton/bib/model/phone"
|
|
62
|
+
autoload :Place, "relaton/bib/model/place"
|
|
63
|
+
# type/ is only a directory; these constants are top-level under Bib:
|
|
64
|
+
autoload :PlainDate, "relaton/bib/model/type/plain_date"
|
|
65
|
+
autoload :StringDate, "relaton/bib/model/type/string_date"
|
|
66
|
+
autoload :Price, "relaton/bib/model/price"
|
|
67
|
+
autoload :Relation, "relaton/bib/model/relation"
|
|
68
|
+
autoload :Series, "relaton/bib/model/series"
|
|
69
|
+
autoload :Size, "relaton/bib/model/size"
|
|
70
|
+
autoload :SourceLocalityStack, "relaton/bib/model/source_locality_stack"
|
|
71
|
+
autoload :Status, "relaton/bib/model/status"
|
|
72
|
+
autoload :StructuredIdentifier, "relaton/bib/model/structured_identifier"
|
|
73
|
+
autoload :Subdivision, "relaton/bib/model/subdivision"
|
|
74
|
+
autoload :Title, "relaton/bib/model/title"
|
|
75
|
+
autoload :Uri, "relaton/bib/model/uri"
|
|
76
|
+
autoload :Validity, "relaton/bib/model/validity"
|
|
77
|
+
autoload :Version, "relaton/bib/model/version"
|
|
78
|
+
|
|
79
|
+
module Converter
|
|
80
|
+
autoload :BibXml, "relaton/bib/converter/bibxml"
|
|
81
|
+
autoload :Bibtex, "relaton/bib/converter/bibtex"
|
|
82
|
+
autoload :Asciibib, "relaton/bib/converter/asciibib"
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
data/lib/relaton/bib/version.rb
CHANGED
data/lib/relaton/bib.rb
CHANGED
|
@@ -9,17 +9,10 @@ require_relative "bib/version"
|
|
|
9
9
|
require_relative "bib/util"
|
|
10
10
|
require_relative "bib/sanitizer"
|
|
11
11
|
require_relative "bib/namespace_helper"
|
|
12
|
+
# Model and converter classes are wired via autoload (see model_autoload.rb) so
|
|
13
|
+
# that load order is irrelevant and mutually-referencing classes resolve lazily.
|
|
14
|
+
require_relative "bib/model_autoload"
|
|
12
15
|
require_relative "bib/item_data"
|
|
13
|
-
require_relative "bib/model/item"
|
|
14
|
-
require_relative "bib/model/item_base"
|
|
15
|
-
require_relative "bib/model/bibitem_shared"
|
|
16
|
-
require_relative "bib/model/bibdata_shared"
|
|
17
|
-
require_relative "bib/model/bibitem"
|
|
18
|
-
require_relative "bib/model/bibdata"
|
|
19
|
-
require_relative "bib/converter/bibxml"
|
|
20
|
-
require_relative "bib/converter/bibtex"
|
|
21
|
-
require_relative "bib/converter/asciibib"
|
|
22
|
-
require_relative "bib/model/relation"
|
|
23
16
|
|
|
24
17
|
module Relaton
|
|
25
18
|
# class Error < StandardError; end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-bib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bibtex-ruby
|
|
@@ -226,6 +226,7 @@ files:
|
|
|
226
226
|
- lib/relaton/bib/model/uri.rb
|
|
227
227
|
- lib/relaton/bib/model/validity.rb
|
|
228
228
|
- lib/relaton/bib/model/version.rb
|
|
229
|
+
- lib/relaton/bib/model_autoload.rb
|
|
229
230
|
- lib/relaton/bib/namespace_helper.rb
|
|
230
231
|
- lib/relaton/bib/sanitizer.rb
|
|
231
232
|
- lib/relaton/bib/util.rb
|