datacite-mapping 0.1.17.2 → 0.2.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.
- checksums.yaml +4 -4
- data/CHANGES.md +33 -0
- data/README.md +93 -150
- data/datacite-mapping.gemspec +1 -1
- data/lib/datacite/mapping.rb +12 -27
- data/lib/datacite/mapping/alternate_identifier.rb +2 -0
- data/lib/datacite/mapping/contributor.rb +6 -2
- data/lib/datacite/mapping/creator.rb +33 -3
- data/lib/datacite/mapping/date.rb +28 -76
- data/lib/datacite/mapping/date_value.rb +116 -0
- data/lib/datacite/mapping/description.rb +9 -8
- data/lib/datacite/mapping/funding_reference.rb +20 -5
- data/lib/datacite/mapping/geo_location.rb +25 -4
- data/lib/datacite/mapping/geo_location_box.rb +10 -8
- data/lib/datacite/mapping/geo_location_node.rb +68 -0
- data/lib/datacite/mapping/geo_location_point.rb +8 -8
- data/lib/datacite/mapping/geo_location_polygon.rb +76 -0
- data/lib/datacite/mapping/identifier.rb +23 -11
- data/lib/datacite/mapping/module_info.rb +3 -3
- data/lib/datacite/mapping/name_identifier.rb +1 -0
- data/lib/datacite/mapping/namespace_extensions.rb +12 -0
- data/lib/datacite/mapping/read_only_nodes.rb +65 -0
- data/lib/datacite/mapping/related_identifier.rb +28 -0
- data/lib/datacite/mapping/resource.rb +88 -43
- data/lib/datacite/mapping/rights.rb +2 -0
- data/lib/datacite/mapping/subject.rb +10 -9
- data/lib/datacite/mapping/title.rb +7 -11
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3059p-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r31017-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3201j-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r33w26-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r34s3v-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r36p4t-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r39g6f-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3cc7d-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3d59d-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3f59q-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3g591-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3k016-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3kw2j-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3mw2v-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3np4v-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3pp45-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3rp4s-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3tg63-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1159q-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d17g6j-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1c88g-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1cc74-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1h019-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1ms3x-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1mw2k-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1rg66-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1rp4h-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1wc7s-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1001p-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1059f-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d11010-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1159r-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d12019-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d12s30-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1301m-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d13s39-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d13w2z-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d14s3m-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d15k5m-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d15p48-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d16k5x-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d16p4k-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d17g6k-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d17p4w-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d18g6w-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1988w-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d19g66-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1b886-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1bc7v-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1c88h-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1cc75-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1d595-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1f30c-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1f59g-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1g011-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1g59s-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1h01b-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1h593-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1j01n-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1js3b-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1k01z-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1ks3n-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1kw29-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1ms3z-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1mw2m-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1np4m-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1pk58-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1pp4x-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1qg6x-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1qp47-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1rg67-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1rp4j-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1sg6j-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1t88j-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1tg6v-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1v88v-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1vc7h-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1w885-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1wc7t-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1x59t-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1z594-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucla-ark+=b5060=d2qr4v2t-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucla-ark+=b5068=d1cc7x-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucla-ark+=b5068=d1h59v-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucla-ark+=b5068=d1rp49-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucla-ark+=b5068=d1wc7k-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucm-ark+=13030=m51g217t-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucm-ark+=b6071=z7wc73-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8301x-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d86p4w-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8bc75-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8g593-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8h59d-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8kw2m-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8rp4v-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8z59f-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsc-ark+=b7291=d11592-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsc-ark+=b7291=d17p46-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsc-ark+=b7291=d1h59d-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsc-ark+=b7291=d1mw2x-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsc-ark+=b7291=d1wc74-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6057cv6-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6154f00-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q61z429d-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q62z13fs-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q65q4t1r-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q66q1v54-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q67p8w9z-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q68g8hmp-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6bg2kwf-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6c8276k-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6cc0xmh-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6d798bd-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6h12zxh-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6h41pb7-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6kw5cxv-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6ms3qnx-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6mw2f2n-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6pn93h6-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6qn64nk-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6rf5rzx-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6rn35sz-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6sf2t3q-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6td9v7j-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6w66hpn-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6x63jt1-mrt-datacite.xml +0 -0
- data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6z60kzd-mrt-datacite.xml +0 -0
- data/spec/data/datacite-4-synthetic.xml +110 -0
- data/spec/data/datacite3/datacite-example-Box_dateCollected_DataCollector-v3.0.xml +46 -0
- data/spec/data/datacite3/datacite-example-GeoLocation-v3.0.xml +50 -0
- data/spec/data/datacite3/datacite-example-HasMetadata-v3.0.xml +52 -0
- data/spec/data/datacite3/datacite-example-ResearchGroup_Methods-v3.0.xml +36 -0
- data/spec/data/datacite3/datacite-example-ResourceTypeGeneral_Collection-v3.0.xml +38 -0
- data/spec/data/datacite3/datacite-example-complicated-v3.0.xml +48 -0
- data/spec/data/datacite3/datacite-example-dataset-v3.0.xml +35 -0
- data/spec/data/datacite3/datacite-example-full-v3.1.xml +61 -0
- data/spec/data/datacite3/datacite-example-relationTypeIsIdenticalTo-v3.0.xml +48 -0
- data/spec/data/datacite3/datacite-example-video-v3.0.xml +26 -0
- data/spec/data/datacite3/datacite-example-workflow-v3.0.xml +43 -0
- data/spec/data/{metadata.xsd → datacite3/metadata.xsd} +0 -0
- data/spec/data/datacite4/datacite-example-Box_dateCollected_DataCollector-v4.0.xml +52 -0
- data/spec/data/datacite4/datacite-example-GeoLocation-v4.0.xml +66 -0
- data/spec/data/datacite4/datacite-example-HasMetadata-v4.0.xml +62 -0
- data/spec/data/datacite4/datacite-example-ResearchGroup_Methods-v4.0.xml +44 -0
- data/spec/data/datacite4/datacite-example-ResourceTypeGeneral_Collection-v4.0.xml +52 -0
- data/spec/data/datacite4/datacite-example-complicated-v4.0.xml +54 -0
- data/spec/data/datacite4/datacite-example-dataset-v4.0.xml +39 -0
- data/spec/data/{resource.xml → datacite4/datacite-example-full-v4.0.xml} +14 -4
- data/spec/data/{kernel-4.0 → datacite4}/datacite-example-fundingReference-v.4.0.xml +0 -0
- data/spec/data/datacite4/datacite-example-relationTypeIsIdenticalTo-v4.0.xml +65 -0
- data/spec/data/datacite4/datacite-example-video-v4.0.xml +31 -0
- data/spec/data/datacite4/datacite-example-workflow-v4.0.xml +55 -0
- data/spec/data/{kernel-4.0 → datacite4}/metadata.xsd +0 -0
- data/spec/rspec_custom_matchers.rb +5 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/unit/datacite/mapping/contributor_spec.rb +7 -0
- data/spec/unit/datacite/mapping/creator_spec.rb +92 -0
- data/spec/unit/datacite/mapping/date_spec.rb +25 -214
- data/spec/unit/datacite/mapping/date_value_spec.rb +143 -0
- data/spec/unit/datacite/mapping/description_spec.rb +4 -3
- data/spec/unit/datacite/mapping/funding_reference_spec.rb +5 -5
- data/spec/unit/datacite/mapping/geo_location_box_spec.rb +0 -36
- data/spec/unit/datacite/mapping/geo_location_point_spec.rb +0 -25
- data/spec/unit/datacite/mapping/geo_location_polygon_spec.rb +47 -0
- data/spec/unit/datacite/mapping/geo_location_spec.rb +153 -6
- data/spec/unit/datacite/mapping/identifier_spec.rb +9 -0
- data/spec/unit/datacite/mapping/related_identifier_spec.rb +23 -0
- data/spec/unit/datacite/mapping/resource_spec.rb +994 -874
- data/spec/unit/datacite/mapping/subject_spec.rb +12 -6
- data/spec/unit/datacite/mapping/title_spec.rb +20 -6
- metadata +320 -278
- data/lib/datacite/mapping/nonvalidating.rb +0 -10
- data/lib/datacite/mapping/nonvalidating/identifier.rb +0 -40
- data/lib/datacite/mapping/nonvalidating/subject.rb +0 -43
- data/spec/data/mrt-datacite.xml +0 -61
- data/spec/unit/datacite/mapping/log_spec.rb +0 -23
- data/spec/unit/datacite/mapping/nonvalidating/identifier_spec.rb +0 -52
- data/spec/unit/datacite/mapping/resource_type_spec.rb +0 -68
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ca854763f76a711279af3353b9c5a9a5414058c
|
|
4
|
+
data.tar.gz: 3f99767c5394f6ae49e2ef60253d5064bfe33cd7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4161a49d7de22ed8528970d7a90afd4231ddd4e7a311aff1f836cbcd34cdaddde9b13719bd3fba239045dd8f636f4e5a226714354dab57bbf2f10cbe89e3a2d0
|
|
7
|
+
data.tar.gz: c4af15defeecf0ed3c9a36c3de15ce980f157b1baafac5d1b43a5d393c0067d3a3c3fdef7b0b9634cf116d191e899e920b9cdd88a719f0f3ca5a08c17f73c1ca
|
data/CHANGES.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
## 0.2.0
|
|
2
|
+
|
|
3
|
+
- Datacite 4.0 support:
|
|
4
|
+
- reading supports both Datacite 3 and Datacite 4
|
|
5
|
+
- writing now defaults to Datacite 4
|
|
6
|
+
- deprecated elements will produce a warning
|
|
7
|
+
- Datacite 3 support via `mapping: :datacite_3`
|
|
8
|
+
- invalid elements (`<geoLocationPolygon/>`, `<fundingReference>`)
|
|
9
|
+
will be dropped, with a warning
|
|
10
|
+
- [IGSN](http://igsn.github.io/overview/) identifiers will be converted to Handle identifiers
|
|
11
|
+
- `language` and `xml:lang` attributes no longer default to `'en'` and are
|
|
12
|
+
now fully optional.
|
|
13
|
+
- `Date` now properly supports [RKMS-ISO8601](http://www.ukoln.ac.uk/metadata/dcmi/collection-RKMS-ISO8601/)
|
|
14
|
+
date ranges
|
|
15
|
+
- Remove `Datacite::Mapping.log` in favor of `warn()`
|
|
16
|
+
- Array fields (`subjects`, `contributors`, etc.) can no longer be set to nil; if set to
|
|
17
|
+
nil they will instead return an empty array.
|
|
18
|
+
- `:nonvalidating` mapping has been removed. Instead:
|
|
19
|
+
- `<subject/>` and `<description/>` tags without text are ignored on read, as are `<geoLocation>`
|
|
20
|
+
tags with no child elements.
|
|
21
|
+
- missing `<identifiers/>` and `<identifiers/>` with missing values are ignored on read, but
|
|
22
|
+
the `Resource` must be given a valid `Identifier` before writing it back out.
|
|
23
|
+
|
|
24
|
+
## 0.1.18 (unreleased)
|
|
25
|
+
|
|
26
|
+
- Datacite 4.0 support:
|
|
27
|
+
- read Datacite 4.0 `<fundingReference/>` tag (introduced in 0.1.17)
|
|
28
|
+
- read Datacite 4.0 `<geoLocationBox>` nodes with coordinates in child nodes
|
|
29
|
+
(`<southBoundLatitude>`, `<westBoundLongitude>`, `<northBoundLatitude>`, `<eastBoundLongitude>`)
|
|
30
|
+
rather than element text
|
|
31
|
+
- read Datacite 4.0 `<geoLocationPoint` nodes coordinates in child nodes
|
|
32
|
+
(`<pointLatitude>`, `<pointLongitude>`) rather than element text
|
|
33
|
+
|
|
1
34
|
## 0.1.17.2 (19 August 2016)
|
|
2
35
|
|
|
3
36
|
- Filter out `<subject/>` tags without values
|
data/README.md
CHANGED
|
@@ -5,184 +5,127 @@
|
|
|
5
5
|
[](http://inch-ci.org/github/CDLUC3/datacite-mapping)
|
|
6
6
|
[](https://github.com/CDLUC3/datacite-mapping/releases)
|
|
7
7
|
|
|
8
|
-
A library for mapping [DataCite XML](http://schema.datacite.org/meta/kernel-
|
|
8
|
+
A library for mapping [DataCite XML](http://schema.datacite.org/meta/kernel-4/) to Ruby objects,
|
|
9
|
+
based on [xml-mapping](http://multi-io.github.io/xml-mapping/) and
|
|
10
|
+
[xml-mapping_extensions](https://github.com/dmolesUC3/xml-mapping_extensions).
|
|
9
11
|
Full API documentation on [RubyDoc.info](http://www.rubydoc.info/github/CDLUC3/datacite-mapping/master/frames).
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Supports [Datacite 4.0](https://schema.labs.datacite.org/meta/kernel-4.0/); backward-compatible with
|
|
14
|
+
[Datacite 3.1](https://schema.labs.datacite.org/meta/kernel-3/).
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
require 'datacite/mapping'
|
|
16
|
+
## Usage
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
The core of the Datacite::Mapping library is the `Resource` class, corresponding to the root `<resource/>` element
|
|
19
|
+
in a Datacite document.
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
resource = Resource.parse_xml(xml_file)
|
|
20
|
-
|
|
21
|
-
creators = resource.creators
|
|
22
|
-
citation = ''
|
|
23
|
-
citation << creators.map(&:name).join('; ')
|
|
24
|
-
citation << ' '
|
|
25
|
-
citation << "(#{resource.publication_year})"
|
|
26
|
-
citation << ': '
|
|
27
|
-
title = resource.titles[0].value
|
|
28
|
-
citation << title
|
|
29
|
-
citation << (title.end_with?('.') ? ' ' : '. ')
|
|
30
|
-
citation << resource.publisher
|
|
31
|
-
|
|
32
|
-
puts("Citation: #{citation}")
|
|
33
|
-
|
|
34
|
-
abstract = resource.descriptions.find { |d| d.type = DescriptionType::ABSTRACT }
|
|
35
|
-
puts("Abstract: #{abstract.value}")
|
|
36
|
-
end
|
|
37
|
-
```
|
|
21
|
+
### Reading
|
|
38
22
|
|
|
39
|
-
|
|
23
|
+
To create a `Resource` object from XML file, use `Resource.parse_xml` or `Resource.load_from_file`,
|
|
24
|
+
depending on the data source:
|
|
40
25
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
of Ilulissat Ice Fjord and in the sedimentary basin of Disko Bay to the
|
|
49
|
-
west of the fjord mouth. Submarine landscape and sediment distribution
|
|
50
|
-
patterns are interpreted in terms of glaciomarine facies types that are
|
|
51
|
-
related to variations in the past position of the glacier front. In
|
|
52
|
-
particular, asymmetric ridges that form a curved entity and a large sill at
|
|
53
|
-
the fjord mouth may represent moraines that depict at least two relatively
|
|
54
|
-
stable positions of the ice front in the Disko Bay and at the fjord mouth.
|
|
55
|
-
In this respect, Ilulissat Glacier shows prominent differences to the East
|
|
56
|
-
Greenland Kangerlussuaq Glacier which is comparable in present size and
|
|
57
|
-
present role for the ice discharge from the inland ice sheet. Two linear
|
|
58
|
-
clusters of pockmarks in the center of the sedimentary basin seem to be
|
|
59
|
-
linked to ongoing methane release due to dissociation of gas hydrates, a
|
|
60
|
-
process fueled by climate warming in the Arctic realm.
|
|
61
|
-
```
|
|
26
|
+
| XML source | Method to use |
|
|
27
|
+
| ----------------- | ------------------------- |
|
|
28
|
+
| file path | `Resource.load_from_file` |
|
|
29
|
+
| `String` | `Resource.parse_xml` |
|
|
30
|
+
| `IO` | `Resource.parse_xml` |
|
|
31
|
+
| `REXML::Document` | `Resource.parse_xml` |
|
|
32
|
+
| `REXML::Element` | `Resource.parse_xml` |
|
|
62
33
|
|
|
63
|
-
|
|
34
|
+
Example:
|
|
64
35
|
|
|
65
36
|
```ruby
|
|
66
37
|
require 'datacite/mapping'
|
|
67
38
|
include Datacite::Mapping
|
|
68
39
|
|
|
69
|
-
|
|
70
|
-
#
|
|
40
|
+
resource = Resource.load_from_file('datacite-example-full-v4.0.xml')
|
|
41
|
+
# => #<Datacite::Mapping::Resource:0x007f97689e87a0 …
|
|
42
|
+
|
|
43
|
+
abstract = resource.descriptions.find { |d| d.type = DescriptionType::ABSTRACT }
|
|
44
|
+
# => #<Datacite::Mapping::Description:0x007f976aafa330 …
|
|
45
|
+
abstract.value
|
|
46
|
+
# => "XML example of all DataCite Metadata Schema v4.0 properties."
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Note that Datacite::Mapping uses the `TypesafeEnum` gem to represent controlled vocabularies such
|
|
50
|
+
as [ResourceTypeGeneral](http://www.rubydoc.info/github/CDLUC3/datacite-mapping/master/Datacite/Mapping/ResourceTypeGeneral)
|
|
51
|
+
and [DescriptionType](http://www.rubydoc.info/github/CDLUC3/datacite-mapping/master/Datacite/Mapping/DescriptionType).
|
|
52
|
+
|
|
53
|
+
### Writing
|
|
54
|
+
|
|
55
|
+
In general, a `Resource` object must be provided with all required attributes on initialization.
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
71
58
|
resource = Resource.new(
|
|
72
|
-
identifier: Identifier.new(value: '10.
|
|
59
|
+
identifier: Identifier.new(value: '10.5555/12345678'),
|
|
73
60
|
creators: [
|
|
74
|
-
Creator.new(
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
Creator.new(
|
|
62
|
+
name: 'Josiah Carberry',
|
|
63
|
+
identifier: NameIdentifier.new(
|
|
64
|
+
scheme: 'ORCID',
|
|
65
|
+
scheme_uri: URI('http://orcid.org/'),
|
|
66
|
+
value: '0000-0002-1825-0097'
|
|
67
|
+
),
|
|
68
|
+
affiliations: [
|
|
69
|
+
'Department of Psychoceramics, Brown University'
|
|
70
|
+
]
|
|
71
|
+
)
|
|
77
72
|
],
|
|
78
73
|
titles: [
|
|
79
|
-
Title.new(value: '
|
|
74
|
+
Title.new(value: 'Toward a Unified Theory of High-Energy Metaphysics: Silly String Theory')
|
|
80
75
|
],
|
|
81
|
-
publisher: '
|
|
82
|
-
publication_year:
|
|
83
|
-
subjects: [
|
|
84
|
-
Subject.new(value: 'Assessment'),
|
|
85
|
-
Subject.new(value: 'Information Literacy'),
|
|
86
|
-
Subject.new(value: 'Engineering'),
|
|
87
|
-
Subject.new(value: 'Undergraduate Students'),
|
|
88
|
-
Subject.new(value: 'CELT'),
|
|
89
|
-
Subject.new(value: 'Purdue University')
|
|
90
|
-
],
|
|
91
|
-
language: 'en',
|
|
92
|
-
resource_type: ResourceType.new(resource_type_general: ResourceTypeGeneral::DATASET, value: 'Dataset'),
|
|
93
|
-
version: '1',
|
|
94
|
-
descriptions: [
|
|
95
|
-
Description.new(
|
|
96
|
-
type: DescriptionType::ABSTRACT,
|
|
97
|
-
value: 'We developed an instrument, Critical Engineering Literacy Test
|
|
98
|
-
(CELT), which is a multiple choice instrument designed to
|
|
99
|
-
measure undergraduate students’ scientific and information
|
|
100
|
-
literacy skills. It requires students to first read a
|
|
101
|
-
technical memo and, based on the memo’s arguments, answer
|
|
102
|
-
eight multiple choice and six open-ended response questions.
|
|
103
|
-
We collected data from 143 first-year engineering students and
|
|
104
|
-
conducted an item analysis. The KR-20 reliability of the
|
|
105
|
-
instrument was .39. Item difficulties ranged between .17 to
|
|
106
|
-
.83. The results indicate low reliability index but acceptable
|
|
107
|
-
levels of item difficulties and item discrimination indices.
|
|
108
|
-
Students were most challenged when answering items measuring
|
|
109
|
-
scientific and mathematical literacy (i.e., identifying
|
|
110
|
-
incorrect information).'
|
|
111
|
-
)
|
|
112
|
-
]
|
|
76
|
+
publisher: 'Journal of Psychoceramics',
|
|
77
|
+
publication_year: 2008
|
|
113
78
|
)
|
|
114
|
-
|
|
115
|
-
puts resource.write_xml
|
|
79
|
+
# => #<Datacite::Mapping::Resource:0x007f9768958fb0 …
|
|
116
80
|
```
|
|
117
81
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<creator>
|
|
131
|
-
<creatorName>Purzer, Senay</creatorName>
|
|
132
|
-
</creator>
|
|
133
|
-
</creators>
|
|
134
|
-
<titles>
|
|
135
|
-
<title xml:lang='en'>Critical Engineering Literacy Test (CELT)</title>
|
|
136
|
-
</titles>
|
|
137
|
-
<publisher>Purdue University Research Repository (PURR)</publisher>
|
|
138
|
-
<publicationYear>2013</publicationYear>
|
|
139
|
-
<subjects>
|
|
140
|
-
<subject xml:lang='en'>Assessment</subject>
|
|
141
|
-
<subject xml:lang='en'>Information Literacy</subject>
|
|
142
|
-
<subject xml:lang='en'>Engineering</subject>
|
|
143
|
-
<subject xml:lang='en'>Undergraduate Students</subject>
|
|
144
|
-
<subject xml:lang='en'>CELT</subject>
|
|
145
|
-
<subject xml:lang='en'>Purdue University</subject>
|
|
146
|
-
</subjects>
|
|
147
|
-
<language>en</language>
|
|
148
|
-
<resourceType resourceTypeGeneral='Dataset'>Dataset</resourceType>
|
|
149
|
-
<version>1</version>
|
|
150
|
-
<descriptions>
|
|
151
|
-
<description xml:lang='en' descriptionType='Abstract'>
|
|
152
|
-
We developed an instrument, Critical Engineering Literacy Test (CELT),
|
|
153
|
-
which is a multiple choice instrument designed to measure undergraduate
|
|
154
|
-
students’ scientific and information literacy skills. It requires students
|
|
155
|
-
to first read a technical memo and, based on the memo’s arguments, answer
|
|
156
|
-
eight multiple choice and six open-ended response questions. We collected
|
|
157
|
-
data from 143 first-year engineering students and conducted an item
|
|
158
|
-
analysis. The KR-20 reliability of the instrument was .39. Item
|
|
159
|
-
difficulties ranged between .17 to .83. The results indicate low
|
|
160
|
-
reliability index but acceptable levels of item difficulties and item
|
|
161
|
-
discrimination indices. Students were most challenged when answering items
|
|
162
|
-
measuring scientific and mathematical literacy (i.e., identifying
|
|
163
|
-
incorrect information).
|
|
164
|
-
</description>
|
|
165
|
-
</descriptions>
|
|
166
|
-
</resource>
|
|
82
|
+
To create XML from a `Resource` object, use `Resource.write_xml`, `Resource.save_to_file`, or
|
|
83
|
+
`Resource.save_to_xml`, depending on the destination:
|
|
84
|
+
|
|
85
|
+
| XML destination | Method to use |
|
|
86
|
+
| ----------------- | ----------------------- |
|
|
87
|
+
| XML string | `Resource.write_xml` |
|
|
88
|
+
| file path | `Resource.save_to_file` |
|
|
89
|
+
| `REXML::Element` | `Resource.save_xml` |
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
|
+
resource.write_xml
|
|
93
|
+
# => "<resource xsi:schemaLocation='http://datacite.org/schema/kernel-4 …
|
|
167
94
|
```
|
|
168
95
|
|
|
169
|
-
|
|
96
|
+
#### Namespace prefix
|
|
170
97
|
|
|
171
|
-
|
|
172
|
-
old, noncompliant data files. Specifically, it parses identifiers and subjects without values:
|
|
98
|
+
To set a prefix for the Datacite namespace, use `Resource.namespace_prefix=`:
|
|
173
99
|
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
|
|
100
|
+
```ruby
|
|
101
|
+
resource.namespace_prefix = 'dcs'
|
|
102
|
+
resource.write_xml
|
|
103
|
+
# => "<dcs:resource xmlns:dcs='http://datacite.org/schema/kernel-4' …
|
|
177
104
|
```
|
|
178
105
|
|
|
179
|
-
|
|
106
|
+
### Datacite 3 compatibility
|
|
107
|
+
|
|
108
|
+
In general, Datacite::Mapping is lax on read, accepting either Datacite 3 or Datacite 4 or a mix,
|
|
109
|
+
and (mostly for historical reasons involving bad data its authors needed to parse) allowing some
|
|
110
|
+
deviations from the schema. By default, it writes Datacite 4, but can write Datacite 3 by passing
|
|
111
|
+
an optional argument to any of the writer methods:
|
|
180
112
|
|
|
181
113
|
```ruby
|
|
182
|
-
resource
|
|
183
|
-
resource
|
|
114
|
+
resource.write_xml(mapping: :datacite_3) # note schema URL below
|
|
115
|
+
# => "<resource xsi:schemaLocation='http://datacite.org/schema/kernel-3
|
|
184
116
|
```
|
|
185
117
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
118
|
+
When using the `:datacite_3` mapping, the Datacite 4 `<geoLocationPolygon/>` and `<fundingReference/>`
|
|
119
|
+
elements, which are not supported in Datacite 3, will be dropped, with a warning. Any
|
|
120
|
+
`<relatedIdentifier/>` elements of type [IGSN](http://igsn.github.io/overview/) will be converted
|
|
121
|
+
to Handle identifiers with prefix 10273 (the prefix of the IGSN resolver).
|
|
122
|
+
|
|
123
|
+
## Contributing
|
|
124
|
+
|
|
125
|
+
Datacite::Mapping is released under an [MIT license](LICENSE.md). When submitting a pull request,
|
|
126
|
+
please make sure the Rubocop style checks pass, as well as making sure unit tests pass with 100%
|
|
127
|
+
coverage; you can check these individually with `bundle exec rubocop` and `bundle exec rake:coverage`,
|
|
128
|
+
or run the default rake task which includes both, `bundle exec rake`.
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
data/datacite-mapping.gemspec
CHANGED
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
|
25
25
|
spec.require_paths = ['lib']
|
|
26
26
|
|
|
27
27
|
spec.add_dependency 'typesafe_enum', '~> 0.1', '>= 0.1.7'
|
|
28
|
-
spec.add_dependency 'xml-mapping_extensions', '~> 0.4', '>= 0.4.
|
|
28
|
+
spec.add_dependency 'xml-mapping_extensions', '~> 0.4', '>= 0.4.7'
|
|
29
29
|
|
|
30
30
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
|
31
31
|
spec.add_development_dependency 'equivalent-xml', '~> 0.6.0'
|
data/lib/datacite/mapping.rb
CHANGED
|
@@ -1,38 +1,23 @@
|
|
|
1
1
|
require 'logger'
|
|
2
|
+
require 'rexml/formatters/transitive' # unaccountably, xml/mapping doesn't do this
|
|
3
|
+
require 'xml/mapping_extensions'
|
|
2
4
|
|
|
3
|
-
# Module for working with the [DataCite metadata schema](https://schema.datacite.org/
|
|
5
|
+
# Module for working with the [DataCite metadata schema](https://schema.datacite.org/)
|
|
4
6
|
module Datacite
|
|
5
7
|
# Maps DataCite XML to Ruby objects
|
|
6
8
|
module Mapping
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
end
|
|
10
|
+
DATACITE_3_NAMESPACE = XML::MappingExtensions::Namespace.new(
|
|
11
|
+
uri: 'http://datacite.org/schema/kernel-3',
|
|
12
|
+
schema_location: 'http://schema.datacite.org/meta/kernel-3/metadata.xsd'
|
|
13
|
+
)
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@log
|
|
19
|
-
end
|
|
15
|
+
DATACITE_4_NAMESPACE = XML::MappingExtensions::Namespace.new(
|
|
16
|
+
uri: 'http://datacite.org/schema/kernel-4',
|
|
17
|
+
schema_location: 'http://schema.datacite.org/meta/kernel-4/metadata.xsd'
|
|
18
|
+
)
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
# @param value [IO] the log device
|
|
23
|
-
def self.log_device=(value)
|
|
24
|
-
@log = new_logger(logdev: value)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
20
|
+
Dir.glob(File.expand_path('../mapping/*.rb', __FILE__)).sort.each(&method(:require))
|
|
28
21
|
|
|
29
|
-
def self.new_logger(logdev:, level: Logger::DEBUG, shift_age: 10, shift_size: 1024 * 1024)
|
|
30
|
-
logger = Logger.new(logdev, shift_age, shift_size)
|
|
31
|
-
logger.level = level
|
|
32
|
-
logger.formatter = proc do |severity, datetime, progname, msg|
|
|
33
|
-
"#{datetime.to_time.utc} #{severity} -#{progname}- #{msg}\n"
|
|
34
|
-
end
|
|
35
|
-
logger
|
|
36
|
-
end
|
|
37
22
|
end
|
|
38
23
|
end
|
|
@@ -24,6 +24,7 @@ module Datacite
|
|
|
24
24
|
# @!parse EDITOR = Editor
|
|
25
25
|
new :EDITOR, 'Editor'
|
|
26
26
|
|
|
27
|
+
# @deprecated contributor type 'funder' is deprecated. Use {FundingReference} instead.
|
|
27
28
|
# @!parse FUNDER = Funder
|
|
28
29
|
new :FUNDER, 'Funder'
|
|
29
30
|
|
|
@@ -91,8 +92,9 @@ module Datacite
|
|
|
91
92
|
end
|
|
92
93
|
|
|
93
94
|
def name=(value)
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
new_value = value && value.strip
|
|
96
|
+
fail ArgumentError, 'Name cannot be empty or nil' unless new_value && !new_value.empty?
|
|
97
|
+
@name = new_value
|
|
96
98
|
end
|
|
97
99
|
|
|
98
100
|
def type=(value)
|
|
@@ -115,6 +117,8 @@ module Datacite
|
|
|
115
117
|
# @!attribute [rw] type
|
|
116
118
|
# @return [ContributorType] the contributor type. Cannot be nil.
|
|
117
119
|
typesafe_enum_node :type, '@contributorType', class: ContributorType
|
|
120
|
+
|
|
121
|
+
fallback_mapping :datacite_3, :_default
|
|
118
122
|
end
|
|
119
123
|
end
|
|
120
124
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'xml/mapping'
|
|
2
|
+
require 'datacite/mapping/read_only_nodes'
|
|
2
3
|
require 'datacite/mapping/name_identifier'
|
|
3
4
|
|
|
4
5
|
module Datacite
|
|
@@ -9,17 +10,32 @@ module Datacite
|
|
|
9
10
|
|
|
10
11
|
# Initializes a new {Creator}.
|
|
11
12
|
# @param name [String] The personal name of the creator, in the format `Family, Given`. Cannot be empty or nil.
|
|
13
|
+
# @param given_name [String, nil] The given name of the creator. Optional.
|
|
14
|
+
# @param given_name [String, nil] The family name of the creator. Optional.
|
|
12
15
|
# @param identifier [NameIdentifier, nil] An identifier for the creator. Optional.
|
|
13
16
|
# @param affiliations [Array<String>, nil] The creator's affiliations. Defaults to an empty list.
|
|
14
|
-
def initialize(name:, identifier: nil, affiliations: [])
|
|
17
|
+
def initialize(name:, given_name: nil, family_name: nil, identifier: nil, affiliations: [])
|
|
15
18
|
self.name = name
|
|
19
|
+
self.given_name = given_name
|
|
20
|
+
self.family_name = family_name
|
|
16
21
|
self.identifier = identifier
|
|
17
22
|
self.affiliations = affiliations
|
|
18
23
|
end
|
|
19
24
|
|
|
20
25
|
def name=(value)
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
new_value = value && value.strip
|
|
27
|
+
fail ArgumentError, 'Name cannot be empty or nil' unless new_value && !new_value.empty?
|
|
28
|
+
@name = new_value
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def given_name=(value)
|
|
32
|
+
new_value = value && value.strip
|
|
33
|
+
@given_name = new_value
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def family_name=(value)
|
|
37
|
+
new_value = value && value.strip
|
|
38
|
+
@family_name = new_value
|
|
23
39
|
end
|
|
24
40
|
|
|
25
41
|
def affiliations=(value)
|
|
@@ -30,6 +46,14 @@ module Datacite
|
|
|
30
46
|
# @return [String] The personal name of the creator, in the format `Family, Given`. Cannot be empty or nil.
|
|
31
47
|
text_node :name, 'creatorName'
|
|
32
48
|
|
|
49
|
+
# @!attribute [rw] given_name
|
|
50
|
+
# @return [String, nil] The given name of the creator. Optional.
|
|
51
|
+
text_node :given_name, 'givenName', default_value: nil
|
|
52
|
+
|
|
53
|
+
# @!attribute [rw] family_name
|
|
54
|
+
# @return [String, nil] The family name of the creator. Optional.
|
|
55
|
+
text_node :family_name, 'familyName', default_value: nil
|
|
56
|
+
|
|
33
57
|
# @!attribute [rw] identifier
|
|
34
58
|
# @return [NameIdentifier, nil] An identifier for the creator. Optional.
|
|
35
59
|
object_node :identifier, 'nameIdentifier', class: NameIdentifier, default_value: nil
|
|
@@ -38,6 +62,12 @@ module Datacite
|
|
|
38
62
|
# @return [Array<String>, nil] The creator's affiliations. Defaults to an empty list.
|
|
39
63
|
array_node :affiliations, 'affiliation', class: String, default_value: []
|
|
40
64
|
|
|
65
|
+
use_mapping :datacite_3
|
|
66
|
+
|
|
67
|
+
read_only_text_node :given_name, 'givenName', default_value: nil, warn_reason: '<givenName/> not supported in Datacite 3'
|
|
68
|
+
read_only_text_node :family_name, 'familyName', default_value: nil, warn_reason: '<familyName/> not supported in Datacite 3'
|
|
69
|
+
|
|
70
|
+
fallback_mapping :datacite_3, :_default
|
|
41
71
|
end
|
|
42
72
|
end
|
|
43
73
|
end
|