datacite-mapping 0.1.17.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
File without changes
|
@@ -0,0 +1,65 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
|
3
|
+
<identifier identifierType="DOI">10.5072/10.CPoS-example</identifier>
|
4
|
+
<creators>
|
5
|
+
<creator>
|
6
|
+
<creatorName>Kreyenfeld, Michaela</creatorName>
|
7
|
+
<givenName>Michaela</givenName>
|
8
|
+
<familyName>Kreyenfeld</familyName>
|
9
|
+
<nameIdentifier nameIdentifierScheme="ISNI" schemeURI="http://isni.org/isni/">0000000117540116</nameIdentifier>
|
10
|
+
</creator>
|
11
|
+
<creator>
|
12
|
+
<creatorName>Hornung, Anne</creatorName>
|
13
|
+
<givenName>Anne</givenName>
|
14
|
+
<familyName>Hornung</familyName>
|
15
|
+
<nameIdentifier nameIdentifierScheme="VIAF" schemeURI="http://viaf.org/viaf/">304639093</nameIdentifier>
|
16
|
+
</creator>
|
17
|
+
<creator>
|
18
|
+
<creatorName>Kubisch, Karolin</creatorName>
|
19
|
+
<givenName>Karolin</givenName>
|
20
|
+
<familyName>Kubisch</familyName>
|
21
|
+
<nameIdentifier nameIdentifierScheme="VIAF" schemeURI="http://viaf.org/viaf/">303937450</nameIdentifier>
|
22
|
+
</creator>
|
23
|
+
</creators>
|
24
|
+
<titles>
|
25
|
+
<title>The German Generations and Gender Survey</title>
|
26
|
+
<title xml:lang="en" titleType="Subtitle">Some Critical Reflections on the Validity of Fertility Histories</title>
|
27
|
+
</titles>
|
28
|
+
<publisher>Federal Institute for Population Research, Germany</publisher>
|
29
|
+
<publicationYear>2013</publicationYear>
|
30
|
+
<subjects>
|
31
|
+
<subject>Fertility</subject>
|
32
|
+
<subject>Marriage</subject>
|
33
|
+
<subject>Germany</subject>
|
34
|
+
<subject>Data validation</subject>
|
35
|
+
<subject>Mikrozensus</subject>
|
36
|
+
<subject>Gender survey</subject>
|
37
|
+
<subject schemeURI="http://www.gesis.org/en/services/research/tools-for-searching/classification" subjectScheme="GESIS">10300 Demography, Population Research</subject>
|
38
|
+
</subjects>
|
39
|
+
<contributors>
|
40
|
+
<contributor contributorType="Editor">
|
41
|
+
<contributorName>Federal Institute for Population Research</contributorName>
|
42
|
+
<nameIdentifier nameIdentifierScheme="ISNI" schemeURI="http://isni.org/isni/">0000000094455866</nameIdentifier>
|
43
|
+
</contributor>
|
44
|
+
</contributors>
|
45
|
+
<language>eng</language>
|
46
|
+
<resourceType resourceTypeGeneral="Text">Article</resourceType>
|
47
|
+
<alternateIdentifiers>
|
48
|
+
<alternateIdentifier alternateIdentifierType="internal ID">da|ra.14.103</alternateIdentifier>
|
49
|
+
</alternateIdentifiers>
|
50
|
+
<relatedIdentifiers>
|
51
|
+
<relatedIdentifier relatedIdentifierType="URN" relationType="IsIdenticalTo">urn:nbn:de:bib-cpos-2013-02en8</relatedIdentifier>
|
52
|
+
<relatedIdentifier relatedIdentifierType="DOI" relationType="IsIdenticalTo">10.4232/10.CPoS-2013-02en</relatedIdentifier>
|
53
|
+
</relatedIdentifiers>
|
54
|
+
<formats>
|
55
|
+
<format>PDF</format>
|
56
|
+
</formats>
|
57
|
+
<version>1</version>
|
58
|
+
<rightsList>
|
59
|
+
<rights rightsURI="http://creativecommons.org/licenses/by-nc-nd/3.0/deed">Creative Commons License: Attribution-NonCommercial-NoDerivs 3.0 Unported</rights>
|
60
|
+
</rightsList>
|
61
|
+
<descriptions>
|
62
|
+
<description descriptionType="SeriesInformation">Comparative Population Studies Vol 38, No 1 (2013)</description>
|
63
|
+
<description descriptionType="Abstract">This paper validates the fertility histories of the German Generations and Gender Survey (GGS). Focusing on the cohorts 1930-69 of West German women, the total number of children, the parity distribution and the parity progression ratios are comparedto external sources. One major result from this validation is that the German GGS understates the fertility for the older cohorts and overstates it for the younger ones.</description>
|
64
|
+
</descriptions>
|
65
|
+
</resource>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
|
3
|
+
<identifier identifierType="DOI">10.5072/1153992</identifier>
|
4
|
+
<creators>
|
5
|
+
<creator>
|
6
|
+
<creatorName>Lynn, Briscoe</creatorName>
|
7
|
+
<givenName>Briscoe</givenName>
|
8
|
+
<familyName>Lynn</familyName>
|
9
|
+
</creator>
|
10
|
+
</creators>
|
11
|
+
<titles>
|
12
|
+
<title>Walking Your Space, Evaluating Your Home</title>
|
13
|
+
<title titleType="Subtitle">Making Energy Efficiency Work for You</title>
|
14
|
+
</titles>
|
15
|
+
<publisher>Photovoltaic Institute</publisher>
|
16
|
+
<publicationYear>2013</publicationYear>
|
17
|
+
<subjects>
|
18
|
+
<subject>Solar Energy</subject>
|
19
|
+
</subjects>
|
20
|
+
<language>eng</language>
|
21
|
+
<resourceType resourceTypeGeneral="Audiovisual">narrated video</resourceType>
|
22
|
+
<formats>
|
23
|
+
<format>MP4</format>
|
24
|
+
</formats>
|
25
|
+
<descriptions>
|
26
|
+
<description descriptionType="Abstract">
|
27
|
+
This hour-long video features John Halter as the narrator. Mr. Halter is best known as a journalist rather than a TV star, and here he plays that role as he does an "expose" type of walkthrough a new home. The home has been advertised as a house with
|
28
|
+
the very latest in state-of-the art energy efficiency, especially solar. Mr. Halter puts the home through an investigation and determines that it can, indeed, live up to its claims.
|
29
|
+
</description>
|
30
|
+
</descriptions>
|
31
|
+
</resource>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
|
3
|
+
<identifier identifierType="DOI">10.5072/100044</identifier>
|
4
|
+
<creators>
|
5
|
+
<creator>
|
6
|
+
<creatorName>Luo, R</creatorName>
|
7
|
+
</creator>
|
8
|
+
<creator>
|
9
|
+
<creatorName>Liu, B</creatorName>
|
10
|
+
</creator>
|
11
|
+
<creator>
|
12
|
+
<creatorName>Xie, Y</creatorName>
|
13
|
+
</creator>
|
14
|
+
<creator>
|
15
|
+
<creatorName>Li, Z</creatorName>
|
16
|
+
</creator>
|
17
|
+
</creators>
|
18
|
+
<titles>
|
19
|
+
<title>
|
20
|
+
Software and supporting material for "SOAPdenovo2: An empirically improved memory-efficient short read de novo assembly"
|
21
|
+
</title>
|
22
|
+
</titles>
|
23
|
+
<publisher>GigaScience Database</publisher>
|
24
|
+
<publicationYear>2012</publicationYear>
|
25
|
+
<subjects>
|
26
|
+
<subject>DNA (Genetics)</subject>
|
27
|
+
<subject>Computer Program</subject>
|
28
|
+
</subjects>
|
29
|
+
<dates>
|
30
|
+
<date dateType="Available">2012-12-13</date>
|
31
|
+
</dates>
|
32
|
+
<language>eng</language>
|
33
|
+
<resourceType resourceTypeGeneral="Workflow">Software</resourceType>
|
34
|
+
<relatedIdentifiers>
|
35
|
+
<relatedIdentifier relatedIdentifierType="DOI" relationType="IsReferencedBy">10.5072/2047-217X-1-1</relatedIdentifier>
|
36
|
+
<relatedIdentifier relatedIdentifierType="DOI" relationType="Compiles">10.5072/100038</relatedIdentifier>
|
37
|
+
</relatedIdentifiers>
|
38
|
+
<sizes>
|
39
|
+
<size>31 MB</size>
|
40
|
+
</sizes>
|
41
|
+
<rightsList>
|
42
|
+
<rights rightsURI="http://creativecommons.org/publicdomain/zero/1.0/">CC0 1.0 Universal</rights>
|
43
|
+
</rightsList>
|
44
|
+
<descriptions>
|
45
|
+
<description descriptionType="Abstract">
|
46
|
+
SOAPdenovo2 is the latest de novo genome assembly package from BGI's SOAP (short oligonucleotide analysis package) suite of tools (homepage here: http://soap.genomics.org.cn/). Compared to SOAPdenovo1, this new version has the advantage of a new
|
47
|
+
algorithm design that reduces memory consumption in graph construction, resolves more repeat regions in contig assembly, increases coverage and length in scaffold construction, improves gap closure, and is optimized for large genomes. Using new
|
48
|
+
sequencing data from the YH (Homo sapiens) diploid genome - the first sequenced Han Chinese individual, an updated assembly was produced (see dataset here: doi:10.5524/100038), with the N50 scores for the contig and scaffold being 3-fold and 50-fold
|
49
|
+
longer, respectively, than the first published version. The genome coverage increased from 81.16% to 93.91%, and memory consumption was ~2/3 times lower during the point of largest memory consumption. Benchmarking with Assemblathon1 and GAGE datasets
|
50
|
+
shows that SOAPdenovo2 greatly surpasses its predecessor SOAPdenovo1 and is competitive to other assemblers on both assembly length and accuracy. In order to facilitate readers to repeat and recreate these findings, configured packages with the
|
51
|
+
compressed pipelines containing all of the necessary shell scripts and tools are available from the BGI FTP server (ftp://public.genomics.org.cn/BGI/SOAPdenovo2). The latest version of SOAPdenovo2 is available from Sourceforge:
|
52
|
+
http://soapdenovo2.sourceforge.net/ These pipelines will also soon be made available from our data platform as Galaxy workflows: http://galaxy.cbiit.cuhk.edu.hk/
|
53
|
+
</description>
|
54
|
+
</descriptions>
|
55
|
+
</resource>
|
File without changes
|
@@ -28,7 +28,7 @@ RSpec::Matchers.define :be_xml do |expected|
|
|
28
28
|
end
|
29
29
|
|
30
30
|
match do |actual|
|
31
|
-
expected_xml = to_nokogiri(expected) || fail("expected value #{expected} does not appear to be XML")
|
31
|
+
expected_xml = to_nokogiri(expected) || fail("expected value #{expected || 'nil'} does not appear to be XML")
|
32
32
|
actual_xml = to_nokogiri(actual)
|
33
33
|
|
34
34
|
EquivalentXml.equivalent?(expected_xml, actual_xml, element_order: false, normalize_whitespace: true)
|
@@ -37,6 +37,10 @@ RSpec::Matchers.define :be_xml do |expected|
|
|
37
37
|
failure_message do |actual|
|
38
38
|
expected_string = to_pretty(to_nokogiri(expected))
|
39
39
|
actual_string = to_pretty(to_nokogiri(actual)) || actual
|
40
|
+
|
41
|
+
File.open('tmp/actual.xml', 'w') { |f| f.write(actual_string) }
|
42
|
+
File.open('tmp/expected.xml', 'w') { |f| f.write(expected_string) }
|
43
|
+
|
40
44
|
"expected XML:\n#{expected_string}\n\nbut was:\n#{actual_string}"
|
41
45
|
end
|
42
46
|
|
data/spec/spec_helper.rb
CHANGED
@@ -65,6 +65,13 @@ module Datacite
|
|
65
65
|
expect { contrib.name = '' }.to raise_error(ArgumentError)
|
66
66
|
expect(contrib.name).to eq('Hershlag, Natalie')
|
67
67
|
end
|
68
|
+
it 'strips' do
|
69
|
+
contrib = Contributor.allocate
|
70
|
+
contrib.name = '
|
71
|
+
Hershlag, Natalie
|
72
|
+
'
|
73
|
+
expect(contrib.name).to eq('Hershlag, Natalie')
|
74
|
+
end
|
68
75
|
end
|
69
76
|
|
70
77
|
describe '#type=' do
|
@@ -25,6 +25,16 @@ module Datacite
|
|
25
25
|
creator = Creator.new(name: 'Hedy Lamarr')
|
26
26
|
expect(creator.affiliations).to eq([])
|
27
27
|
end
|
28
|
+
|
29
|
+
it 'sets the given and family names' do
|
30
|
+
creator = Creator.new(name: 'Hedy Lamarr', given_name: 'Hedy', family_name: 'Lamarr')
|
31
|
+
expect(creator.given_name).to eq('Hedy')
|
32
|
+
expect(creator.family_name).to eq('Lamarr')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'defaults to nil given and family names' do
|
36
|
+
|
37
|
+
end
|
28
38
|
end
|
29
39
|
|
30
40
|
describe '#name=' do
|
@@ -43,6 +53,43 @@ module Datacite
|
|
43
53
|
expect { creator.name = '' }.to raise_error(ArgumentError)
|
44
54
|
expect(creator.name).to eq('Hedy Lamarr')
|
45
55
|
end
|
56
|
+
it 'strips' do
|
57
|
+
creator = Creator.allocate
|
58
|
+
creator.name = '
|
59
|
+
Hedy Lamarr
|
60
|
+
'
|
61
|
+
expect(creator.name).to eq('Hedy Lamarr')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe '#given_name=' do
|
66
|
+
it 'sets the given_name' do
|
67
|
+
creator = Creator.allocate
|
68
|
+
creator.given_name = 'Hedy'
|
69
|
+
expect(creator.given_name).to eq('Hedy')
|
70
|
+
end
|
71
|
+
it 'strips' do
|
72
|
+
creator = Creator.allocate
|
73
|
+
creator.given_name = '
|
74
|
+
Hedy
|
75
|
+
'
|
76
|
+
expect(creator.given_name).to eq('Hedy')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
describe '#family_name=' do
|
81
|
+
it 'sets the family_name' do
|
82
|
+
creator = Creator.allocate
|
83
|
+
creator.family_name = 'Lamarr'
|
84
|
+
expect(creator.family_name).to eq('Lamarr')
|
85
|
+
end
|
86
|
+
it 'strips' do
|
87
|
+
creator = Creator.allocate
|
88
|
+
creator.family_name = '
|
89
|
+
Lamarr
|
90
|
+
'
|
91
|
+
expect(creator.family_name).to eq('Lamarr')
|
92
|
+
end
|
46
93
|
end
|
47
94
|
|
48
95
|
describe '#identifier=' do
|
@@ -118,6 +165,51 @@ module Datacite
|
|
118
165
|
expect(creator.save_to_xml).to be_xml(expected_xml)
|
119
166
|
end
|
120
167
|
end
|
168
|
+
|
169
|
+
describe 'DC4 family and given names' do
|
170
|
+
describe 'DC3 mapping' do
|
171
|
+
it 'doesn\'t write DC4 family and given names' do
|
172
|
+
id = NameIdentifier.new(scheme: 'ISNI', scheme_uri: URI('http://isni.org/'), value: '0000-0001-1690-159X')
|
173
|
+
creator = Creator.new(name: 'Hedy Lamarr', given_name: 'Hedy', family_name: 'Lamarr', identifier: id, affiliations: ['United Artists', 'Metro-Goldwyn-Mayer'])
|
174
|
+
expected_xml = '<creator>
|
175
|
+
<creatorName>Hedy Lamarr</creatorName>
|
176
|
+
<nameIdentifier schemeURI="http://isni.org/" nameIdentifierScheme="ISNI">0000-0001-1690-159X</nameIdentifier>
|
177
|
+
<affiliation>United Artists</affiliation>
|
178
|
+
<affiliation>Metro-Goldwyn-Mayer</affiliation>
|
179
|
+
</creator>'
|
180
|
+
expect(creator.save_to_xml(mapping: :datacite_3)).to be_xml(expected_xml)
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
describe 'DC4 mapping' do
|
185
|
+
it 'reads DC4 family and given names' do
|
186
|
+
xml = '<creator>
|
187
|
+
<creatorName>Hedy Lamarr</creatorName>
|
188
|
+
<givenName>Hedy</givenName>
|
189
|
+
<familyName>Lamarr</familyName>
|
190
|
+
<nameIdentifier schemeURI="http://isni.org/" nameIdentifierScheme="ISNI">0000-0001-1690-159X</nameIdentifier>
|
191
|
+
<affiliation>United Artists</affiliation>
|
192
|
+
<affiliation>Metro-Goldwyn-Mayer</affiliation>
|
193
|
+
</creator>'
|
194
|
+
creator = Creator.parse_xml(xml)
|
195
|
+
expect(creator.given_name).to eq('Hedy')
|
196
|
+
expect(creator.family_name).to eq('Lamarr')
|
197
|
+
end
|
198
|
+
it 'writes DC4 family and given names' do
|
199
|
+
expected_xml = '<creator>
|
200
|
+
<creatorName>Hedy Lamarr</creatorName>
|
201
|
+
<givenName>Hedy</givenName>
|
202
|
+
<familyName>Lamarr</familyName>
|
203
|
+
<nameIdentifier schemeURI="http://isni.org/" nameIdentifierScheme="ISNI">0000-0001-1690-159X</nameIdentifier>
|
204
|
+
<affiliation>United Artists</affiliation>
|
205
|
+
<affiliation>Metro-Goldwyn-Mayer</affiliation>
|
206
|
+
</creator>'
|
207
|
+
id = NameIdentifier.new(scheme: 'ISNI', scheme_uri: URI('http://isni.org/'), value: '0000-0001-1690-159X')
|
208
|
+
creator = Creator.new(name: 'Hedy Lamarr', given_name: 'Hedy', family_name: 'Lamarr', identifier: id, affiliations: ['United Artists', 'Metro-Goldwyn-Mayer'])
|
209
|
+
expect(creator.save_to_xml).to be_xml(expected_xml)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
121
213
|
end
|
122
214
|
end
|
123
215
|
end
|
@@ -4,108 +4,30 @@ module Datacite
|
|
4
4
|
module Mapping
|
5
5
|
describe Date do
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
with_year_month: '1914-08',
|
14
|
-
iso8601: '1914-08-04T11:01+01:00',
|
15
|
-
iso8601_secs: '1914-08-04T11:01:06+01:00',
|
16
|
-
iso8601_frac: '1914-08-04T11:01:06.0123+01:00',
|
17
|
-
year_range: '1914-1915'
|
18
|
-
}
|
19
|
-
@dates = @values.map { |format, v| [format, Date.new(type: DateType::AVAILABLE, value: v)] }.to_h
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#initialize' do
|
23
|
-
it 'accepts a DateTime' do
|
24
|
-
d = @dates[:with_date_time]
|
25
|
-
expect(d).to be_a(Date)
|
26
|
-
expect(d.value).not_to be_nil
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'accepts a Date' do
|
30
|
-
d = @dates[:with_date]
|
31
|
-
expect(d).to be_a(Date)
|
32
|
-
expect(d.value).not_to be_nil
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'accepts a year as an integer' do
|
36
|
-
d = @dates[:with_year]
|
37
|
-
expect(d).to be_a(Date)
|
38
|
-
expect(d.value).not_to be_nil
|
39
|
-
end
|
40
|
-
|
41
|
-
it 'accepts a year as a string' do
|
42
|
-
d = @dates[:with_year_str]
|
43
|
-
expect(d).to be_a(Date)
|
44
|
-
expect(d.value).not_to be_nil
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'accepts a year-month string' do
|
48
|
-
d = @dates[:with_year_month]
|
49
|
-
expect(d).to be_a(Date)
|
50
|
-
expect(d.value).not_to be_nil
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'accepts an ISO 8601 date string with hours and minutes' do
|
54
|
-
d = @dates[:iso8601]
|
55
|
-
expect(d).to be_a(Date)
|
56
|
-
expect(d.value).not_to be_nil
|
57
|
-
end
|
58
|
-
|
59
|
-
it 'accepts an ISO 8601 date string with hours, minutes, and seconds' do
|
60
|
-
d = @dates[:iso8601_secs]
|
61
|
-
expect(d).to be_a(Date)
|
62
|
-
expect(d.value).not_to be_nil
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'accepts an ISO 8601 date string with hours, minutes, seconds, and fractional seconds' do
|
66
|
-
d = @dates[:iso8601_frac]
|
67
|
-
expect(d).to be_a(Date)
|
68
|
-
expect(d.value).not_to be_nil
|
7
|
+
describe 'RKMS-ISO8601 support' do
|
8
|
+
it 'supports closed datetime ranges' do
|
9
|
+
date = Date.new(value: '1997-07-16T19:30+10:00/1997-07-17T15:30-05:00', type: DateType::VALID)
|
10
|
+
expect(date.date_value).to be_nil
|
11
|
+
expect(date.range_start).to eq(DateValue.new('1997-07-16T19:30+10:00'))
|
12
|
+
expect(date.range_end).to eq(DateValue.new('1997-07-17T15:30-05:00'))
|
69
13
|
end
|
70
14
|
|
71
|
-
it '
|
72
|
-
|
73
|
-
expect(
|
74
|
-
expect(
|
15
|
+
it 'supports left open datetime ranges' do
|
16
|
+
date = Date.new(value: '/1997-07-17T15:30-05:00', type: DateType::VALID)
|
17
|
+
expect(date.date_value).to be_nil
|
18
|
+
expect(date.range_start).to be_nil
|
19
|
+
expect(date.range_end).to eq(DateValue.new('1997-07-17T15:30-05:00'))
|
75
20
|
end
|
76
21
|
|
77
|
-
it '
|
78
|
-
|
22
|
+
it 'supports right open datetime ranges' do
|
23
|
+
date = Date.new(value: '1997-07-16T19:30+10:00/', type: DateType::VALID)
|
24
|
+
expect(date.date_value).to be_nil
|
25
|
+
expect(date.range_start).to eq(DateValue.new('1997-07-16T19:30+10:00'))
|
26
|
+
expect(date.range_end).to be_nil
|
79
27
|
end
|
80
28
|
|
81
|
-
it '
|
82
|
-
expect { Date.new(value:
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe 'value=' do
|
87
|
-
it 'accepts all date formats' do
|
88
|
-
@values.each_value do |v|
|
89
|
-
d = Date.allocate
|
90
|
-
d.value = v
|
91
|
-
expect(d.value).not_to be_nil, "Expected non-nil value for #{v}, got nil"
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'supports RKMS-ISO8601 date ranges'
|
96
|
-
|
97
|
-
it 'rejects invalid dates' do
|
98
|
-
d = Date.new(value: 1914, type: DateType::AVAILABLE)
|
99
|
-
old_value = d.value
|
100
|
-
expect { d.value = 'elvis' }.to raise_error(ArgumentError)
|
101
|
-
expect(d.value).to eq(old_value)
|
102
|
-
end
|
103
|
-
|
104
|
-
it 'rejects nil' do
|
105
|
-
d = Date.new(value: 1914, type: DateType::AVAILABLE)
|
106
|
-
old_value = d.value
|
107
|
-
expect { d.value = nil }.to raise_error(ArgumentError)
|
108
|
-
expect(d.value).to eq(old_value)
|
29
|
+
it 'fails on range-like non-ranges' do
|
30
|
+
expect { Date.new(value: '5/18/72', type: DateType::VALID) }.to raise_error(ArgumentError)
|
109
31
|
end
|
110
32
|
end
|
111
33
|
|
@@ -123,123 +45,6 @@ module Datacite
|
|
123
45
|
end
|
124
46
|
end
|
125
47
|
|
126
|
-
describe 'value' do
|
127
|
-
it 'returns a string for a DateTime' do
|
128
|
-
expect(@dates[:with_date_time].value).to eq(@values[:with_date_time].iso8601)
|
129
|
-
end
|
130
|
-
it 'returns a string for a Date' do
|
131
|
-
expect(@dates[:with_date].value).to eq(@values[:with_date].iso8601)
|
132
|
-
end
|
133
|
-
it 'returns a string for a year as an integer' do
|
134
|
-
expect(@dates[:with_year].value).to eq(@values[:with_year].to_s)
|
135
|
-
end
|
136
|
-
it 'returns a string for a year as a string' do
|
137
|
-
expect(@dates[:with_year_str].value).to eq(@values[:with_year_str])
|
138
|
-
end
|
139
|
-
it 'returns a string for a year-month string' do
|
140
|
-
expect(@dates[:with_year_month].value).to eq(@values[:with_year_month])
|
141
|
-
end
|
142
|
-
it 'preserves an ISO 8601 date string with hours and minutes' do
|
143
|
-
expect(@dates[:iso8601].value).to eq(@values[:iso8601])
|
144
|
-
end
|
145
|
-
it 'preserves an ISO 8601 date string with hours, minutes, and seconds' do
|
146
|
-
expect(@dates[:iso8601_secs].value).to eq(@values[:iso8601_secs])
|
147
|
-
end
|
148
|
-
it 'preserves an ISO 8601 date string with hours, minutes, seconds, and fractional seconds' do
|
149
|
-
expect(@dates[:iso8601_frac].value).to eq(@values[:iso8601_frac])
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
describe 'year' do
|
154
|
-
it 'returns the year for all date formats' do
|
155
|
-
@dates.each_value do |d|
|
156
|
-
expect(d.year).to eq(1914)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
describe 'month' do
|
162
|
-
it 'returns the month for all date formats that have it' do
|
163
|
-
expected = 8
|
164
|
-
@dates.each_pair do |format, d|
|
165
|
-
if [:with_year, :with_year_str, :year_range].include?(format)
|
166
|
-
expect(d.month).to be_nil
|
167
|
-
else
|
168
|
-
expect(d.month).to eq(expected), "expected #{expected}, got #{d.month} for :#{format} (#{d.value})"
|
169
|
-
end
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
describe 'day' do
|
175
|
-
it 'returns the day for all date formats that have it' do
|
176
|
-
expected = 4
|
177
|
-
@dates.each_pair do |format, d|
|
178
|
-
if [:with_year, :with_year_str, :with_year_month, :year_range].include?(format)
|
179
|
-
expect(d.day).to be_nil
|
180
|
-
else
|
181
|
-
expect(d.day).to eq(expected), "expected #{expected}, got #{d.day} for :#{format} (#{d.value})"
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
describe 'hour' do
|
188
|
-
it 'returns the hour for all formats that have it' do
|
189
|
-
expected = 11
|
190
|
-
@dates.each_pair do |format, d|
|
191
|
-
if [:with_date, :with_year, :with_year_str, :with_year_month, :year_range].include?(format)
|
192
|
-
expect(d.hour).to be_nil, "expected nil, got #{d.hour} for :#{format} (#{d.value})"
|
193
|
-
else
|
194
|
-
expect(d.hour).to eq(expected), "expected #{expected}, got #{d.hour} for :#{format} (#{d.value})"
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
describe 'minute' do
|
201
|
-
it 'returns the minutes for all formats that have it' do
|
202
|
-
expected = 1
|
203
|
-
@dates.each_pair do |format, d|
|
204
|
-
if [:with_date, :with_year, :with_year_str, :with_year_month, :year_range].include?(format)
|
205
|
-
expect(d.minute).to be_nil, "expected nil, got #{d.hour} for :#{format} (#{d.value})"
|
206
|
-
else
|
207
|
-
expect(d.minute).to eq(expected), "expected #{expected}, got #{d.minute} for :#{format} (#{d.value})"
|
208
|
-
end
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
describe 'sec' do
|
214
|
-
it 'returns the seconds for all formats that have it' do
|
215
|
-
expected = 6
|
216
|
-
@dates.each_pair do |format, d|
|
217
|
-
if [:with_date, :with_year, :with_year_str, :with_year_month, :year_range].include?(format)
|
218
|
-
expect(d.sec).to be_nil, "expected nil, got #{d.hour} for :#{format} (#{d.value})"
|
219
|
-
elsif format == :iso8601
|
220
|
-
expect(d.sec).to eq(0)
|
221
|
-
else
|
222
|
-
expect(d.sec).to eq(expected), "expected #{expected}, got #{d.sec} for :#{format} (#{d.value})"
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
describe 'nsec' do
|
229
|
-
it 'returns the nanoseconds for all formats that have it' do
|
230
|
-
expected = 12_300_000
|
231
|
-
@dates.each_pair do |format, d|
|
232
|
-
if [:with_date, :with_year, :with_year_str, :with_year_month, :year_range].include?(format)
|
233
|
-
expect(d.nsec).to be_nil, "expected nil, got #{d.hour} for :#{format} (#{d.value})"
|
234
|
-
elsif [:iso8601, :iso8601_secs].include?(format)
|
235
|
-
expect(d.nsec).to eq(0)
|
236
|
-
else
|
237
|
-
expect(d.nsec).to eq(expected), "expected #{expected}, got #{d.nsec} for :#{format} (#{d.value})"
|
238
|
-
end
|
239
|
-
end
|
240
|
-
end
|
241
|
-
end
|
242
|
-
|
243
48
|
describe '#save_to_xml' do
|
244
49
|
it 'writes XML' do
|
245
50
|
d = Date.new(value: '1914-08-04T11:01:06.0123+01:00', type: DateType::AVAILABLE)
|
@@ -248,7 +53,13 @@ module Datacite
|
|
248
53
|
end
|
249
54
|
end
|
250
55
|
|
251
|
-
describe '#load_from_xml'
|
56
|
+
describe '#load_from_xml' do
|
57
|
+
it 'reads XML' do
|
58
|
+
xml = '<date dateType="Available">1914-08-04T11:01:06.0123+01:00</date>'
|
59
|
+
d = Date.parse_xml(xml)
|
60
|
+
expect(d.date_value).to eq(DateValue.new(DateTime.new(1914, 8, 4, 11, 0o1, 6.0123, '+1')))
|
61
|
+
end
|
62
|
+
end
|
252
63
|
end
|
253
64
|
end
|
254
65
|
end
|