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.
Files changed (205) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +33 -0
  3. data/README.md +93 -150
  4. data/datacite-mapping.gemspec +1 -1
  5. data/lib/datacite/mapping.rb +12 -27
  6. data/lib/datacite/mapping/alternate_identifier.rb +2 -0
  7. data/lib/datacite/mapping/contributor.rb +6 -2
  8. data/lib/datacite/mapping/creator.rb +33 -3
  9. data/lib/datacite/mapping/date.rb +28 -76
  10. data/lib/datacite/mapping/date_value.rb +116 -0
  11. data/lib/datacite/mapping/description.rb +9 -8
  12. data/lib/datacite/mapping/funding_reference.rb +20 -5
  13. data/lib/datacite/mapping/geo_location.rb +25 -4
  14. data/lib/datacite/mapping/geo_location_box.rb +10 -8
  15. data/lib/datacite/mapping/geo_location_node.rb +68 -0
  16. data/lib/datacite/mapping/geo_location_point.rb +8 -8
  17. data/lib/datacite/mapping/geo_location_polygon.rb +76 -0
  18. data/lib/datacite/mapping/identifier.rb +23 -11
  19. data/lib/datacite/mapping/module_info.rb +3 -3
  20. data/lib/datacite/mapping/name_identifier.rb +1 -0
  21. data/lib/datacite/mapping/namespace_extensions.rb +12 -0
  22. data/lib/datacite/mapping/read_only_nodes.rb +65 -0
  23. data/lib/datacite/mapping/related_identifier.rb +28 -0
  24. data/lib/datacite/mapping/resource.rb +88 -43
  25. data/lib/datacite/mapping/rights.rb +2 -0
  26. data/lib/datacite/mapping/subject.rb +10 -9
  27. data/lib/datacite/mapping/title.rb +7 -11
  28. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3059p-mrt-datacite.xml +0 -0
  29. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r31017-mrt-datacite.xml +0 -0
  30. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3201j-mrt-datacite.xml +0 -0
  31. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r33w26-mrt-datacite.xml +0 -0
  32. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r34s3v-mrt-datacite.xml +0 -0
  33. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r36p4t-mrt-datacite.xml +0 -0
  34. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r39g6f-mrt-datacite.xml +0 -0
  35. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3cc7d-mrt-datacite.xml +0 -0
  36. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3d59d-mrt-datacite.xml +0 -0
  37. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3f59q-mrt-datacite.xml +0 -0
  38. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3g591-mrt-datacite.xml +0 -0
  39. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3k016-mrt-datacite.xml +0 -0
  40. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3kw2j-mrt-datacite.xml +0 -0
  41. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3mw2v-mrt-datacite.xml +0 -0
  42. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3np4v-mrt-datacite.xml +0 -0
  43. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3pp45-mrt-datacite.xml +0 -0
  44. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3rp4s-mrt-datacite.xml +0 -0
  45. data/spec/data/{dash1-datacite-xml → dash1}/dataone-ark+=c5146=r3tg63-mrt-datacite.xml +0 -0
  46. data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1159q-mrt-datacite.xml +0 -0
  47. data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d17g6j-mrt-datacite.xml +0 -0
  48. data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1c88g-mrt-datacite.xml +0 -0
  49. data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1cc74-mrt-datacite.xml +0 -0
  50. data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1h019-mrt-datacite.xml +0 -0
  51. data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1ms3x-mrt-datacite.xml +0 -0
  52. data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1mw2k-mrt-datacite.xml +0 -0
  53. data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1rg66-mrt-datacite.xml +0 -0
  54. data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1rp4h-mrt-datacite.xml +0 -0
  55. data/spec/data/{dash1-datacite-xml → dash1}/ucb-ark+=b6078=d1wc7s-mrt-datacite.xml +0 -0
  56. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1001p-mrt-datacite.xml +0 -0
  57. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1059f-mrt-datacite.xml +0 -0
  58. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d11010-mrt-datacite.xml +0 -0
  59. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1159r-mrt-datacite.xml +0 -0
  60. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d12019-mrt-datacite.xml +0 -0
  61. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d12s30-mrt-datacite.xml +0 -0
  62. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1301m-mrt-datacite.xml +0 -0
  63. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d13s39-mrt-datacite.xml +0 -0
  64. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d13w2z-mrt-datacite.xml +0 -0
  65. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d14s3m-mrt-datacite.xml +0 -0
  66. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d15k5m-mrt-datacite.xml +0 -0
  67. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d15p48-mrt-datacite.xml +0 -0
  68. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d16k5x-mrt-datacite.xml +0 -0
  69. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d16p4k-mrt-datacite.xml +0 -0
  70. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d17g6k-mrt-datacite.xml +0 -0
  71. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d17p4w-mrt-datacite.xml +0 -0
  72. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d18g6w-mrt-datacite.xml +0 -0
  73. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1988w-mrt-datacite.xml +0 -0
  74. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d19g66-mrt-datacite.xml +0 -0
  75. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1b886-mrt-datacite.xml +0 -0
  76. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1bc7v-mrt-datacite.xml +0 -0
  77. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1c88h-mrt-datacite.xml +0 -0
  78. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1cc75-mrt-datacite.xml +0 -0
  79. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1d595-mrt-datacite.xml +0 -0
  80. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1f30c-mrt-datacite.xml +0 -0
  81. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1f59g-mrt-datacite.xml +0 -0
  82. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1g011-mrt-datacite.xml +0 -0
  83. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1g59s-mrt-datacite.xml +0 -0
  84. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1h01b-mrt-datacite.xml +0 -0
  85. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1h593-mrt-datacite.xml +0 -0
  86. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1j01n-mrt-datacite.xml +0 -0
  87. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1js3b-mrt-datacite.xml +0 -0
  88. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1k01z-mrt-datacite.xml +0 -0
  89. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1ks3n-mrt-datacite.xml +0 -0
  90. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1kw29-mrt-datacite.xml +0 -0
  91. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1ms3z-mrt-datacite.xml +0 -0
  92. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1mw2m-mrt-datacite.xml +0 -0
  93. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1np4m-mrt-datacite.xml +0 -0
  94. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1pk58-mrt-datacite.xml +0 -0
  95. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1pp4x-mrt-datacite.xml +0 -0
  96. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1qg6x-mrt-datacite.xml +0 -0
  97. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1qp47-mrt-datacite.xml +0 -0
  98. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1rg67-mrt-datacite.xml +0 -0
  99. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1rp4j-mrt-datacite.xml +0 -0
  100. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1sg6j-mrt-datacite.xml +0 -0
  101. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1t88j-mrt-datacite.xml +0 -0
  102. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1tg6v-mrt-datacite.xml +0 -0
  103. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1v88v-mrt-datacite.xml +0 -0
  104. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1vc7h-mrt-datacite.xml +0 -0
  105. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1w885-mrt-datacite.xml +0 -0
  106. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1wc7t-mrt-datacite.xml +0 -0
  107. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1x59t-mrt-datacite.xml +0 -0
  108. data/spec/data/{dash1-datacite-xml → dash1}/uci-ark+=b7280=d1z594-mrt-datacite.xml +0 -0
  109. data/spec/data/{dash1-datacite-xml → dash1}/ucla-ark+=b5060=d2qr4v2t-mrt-datacite.xml +0 -0
  110. data/spec/data/{dash1-datacite-xml → dash1}/ucla-ark+=b5068=d1cc7x-mrt-datacite.xml +0 -0
  111. data/spec/data/{dash1-datacite-xml → dash1}/ucla-ark+=b5068=d1h59v-mrt-datacite.xml +0 -0
  112. data/spec/data/{dash1-datacite-xml → dash1}/ucla-ark+=b5068=d1rp49-mrt-datacite.xml +0 -0
  113. data/spec/data/{dash1-datacite-xml → dash1}/ucla-ark+=b5068=d1wc7k-mrt-datacite.xml +0 -0
  114. data/spec/data/{dash1-datacite-xml → dash1}/ucm-ark+=13030=m51g217t-mrt-datacite.xml +0 -0
  115. data/spec/data/{dash1-datacite-xml → dash1}/ucm-ark+=b6071=z7wc73-mrt-datacite.xml +0 -0
  116. data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8301x-mrt-datacite.xml +0 -0
  117. data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d86p4w-mrt-datacite.xml +0 -0
  118. data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8bc75-mrt-datacite.xml +0 -0
  119. data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8g593-mrt-datacite.xml +0 -0
  120. data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8h59d-mrt-datacite.xml +0 -0
  121. data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8kw2m-mrt-datacite.xml +0 -0
  122. data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8rp4v-mrt-datacite.xml +0 -0
  123. data/spec/data/{dash1-datacite-xml → dash1}/ucop-ark+=b5060=d8z59f-mrt-datacite.xml +0 -0
  124. data/spec/data/{dash1-datacite-xml → dash1}/ucsc-ark+=b7291=d11592-mrt-datacite.xml +0 -0
  125. data/spec/data/{dash1-datacite-xml → dash1}/ucsc-ark+=b7291=d17p46-mrt-datacite.xml +0 -0
  126. data/spec/data/{dash1-datacite-xml → dash1}/ucsc-ark+=b7291=d1h59d-mrt-datacite.xml +0 -0
  127. data/spec/data/{dash1-datacite-xml → dash1}/ucsc-ark+=b7291=d1mw2x-mrt-datacite.xml +0 -0
  128. data/spec/data/{dash1-datacite-xml → dash1}/ucsc-ark+=b7291=d1wc74-mrt-datacite.xml +0 -0
  129. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6057cv6-mrt-datacite.xml +0 -0
  130. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6154f00-mrt-datacite.xml +0 -0
  131. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q61z429d-mrt-datacite.xml +0 -0
  132. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q62z13fs-mrt-datacite.xml +0 -0
  133. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q65q4t1r-mrt-datacite.xml +0 -0
  134. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q66q1v54-mrt-datacite.xml +0 -0
  135. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q67p8w9z-mrt-datacite.xml +0 -0
  136. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q68g8hmp-mrt-datacite.xml +0 -0
  137. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6bg2kwf-mrt-datacite.xml +0 -0
  138. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6c8276k-mrt-datacite.xml +0 -0
  139. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6cc0xmh-mrt-datacite.xml +0 -0
  140. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6d798bd-mrt-datacite.xml +0 -0
  141. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6h12zxh-mrt-datacite.xml +0 -0
  142. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6h41pb7-mrt-datacite.xml +0 -0
  143. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6kw5cxv-mrt-datacite.xml +0 -0
  144. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6ms3qnx-mrt-datacite.xml +0 -0
  145. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6mw2f2n-mrt-datacite.xml +0 -0
  146. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6pn93h6-mrt-datacite.xml +0 -0
  147. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6qn64nk-mrt-datacite.xml +0 -0
  148. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6rf5rzx-mrt-datacite.xml +0 -0
  149. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6rn35sz-mrt-datacite.xml +0 -0
  150. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6sf2t3q-mrt-datacite.xml +0 -0
  151. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6td9v7j-mrt-datacite.xml +0 -0
  152. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6w66hpn-mrt-datacite.xml +0 -0
  153. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6x63jt1-mrt-datacite.xml +0 -0
  154. data/spec/data/{dash1-datacite-xml → dash1}/ucsf-ark+=b7272=q6z60kzd-mrt-datacite.xml +0 -0
  155. data/spec/data/datacite-4-synthetic.xml +110 -0
  156. data/spec/data/datacite3/datacite-example-Box_dateCollected_DataCollector-v3.0.xml +46 -0
  157. data/spec/data/datacite3/datacite-example-GeoLocation-v3.0.xml +50 -0
  158. data/spec/data/datacite3/datacite-example-HasMetadata-v3.0.xml +52 -0
  159. data/spec/data/datacite3/datacite-example-ResearchGroup_Methods-v3.0.xml +36 -0
  160. data/spec/data/datacite3/datacite-example-ResourceTypeGeneral_Collection-v3.0.xml +38 -0
  161. data/spec/data/datacite3/datacite-example-complicated-v3.0.xml +48 -0
  162. data/spec/data/datacite3/datacite-example-dataset-v3.0.xml +35 -0
  163. data/spec/data/datacite3/datacite-example-full-v3.1.xml +61 -0
  164. data/spec/data/datacite3/datacite-example-relationTypeIsIdenticalTo-v3.0.xml +48 -0
  165. data/spec/data/datacite3/datacite-example-video-v3.0.xml +26 -0
  166. data/spec/data/datacite3/datacite-example-workflow-v3.0.xml +43 -0
  167. data/spec/data/{metadata.xsd → datacite3/metadata.xsd} +0 -0
  168. data/spec/data/datacite4/datacite-example-Box_dateCollected_DataCollector-v4.0.xml +52 -0
  169. data/spec/data/datacite4/datacite-example-GeoLocation-v4.0.xml +66 -0
  170. data/spec/data/datacite4/datacite-example-HasMetadata-v4.0.xml +62 -0
  171. data/spec/data/datacite4/datacite-example-ResearchGroup_Methods-v4.0.xml +44 -0
  172. data/spec/data/datacite4/datacite-example-ResourceTypeGeneral_Collection-v4.0.xml +52 -0
  173. data/spec/data/datacite4/datacite-example-complicated-v4.0.xml +54 -0
  174. data/spec/data/datacite4/datacite-example-dataset-v4.0.xml +39 -0
  175. data/spec/data/{resource.xml → datacite4/datacite-example-full-v4.0.xml} +14 -4
  176. data/spec/data/{kernel-4.0 → datacite4}/datacite-example-fundingReference-v.4.0.xml +0 -0
  177. data/spec/data/datacite4/datacite-example-relationTypeIsIdenticalTo-v4.0.xml +65 -0
  178. data/spec/data/datacite4/datacite-example-video-v4.0.xml +31 -0
  179. data/spec/data/datacite4/datacite-example-workflow-v4.0.xml +55 -0
  180. data/spec/data/{kernel-4.0 → datacite4}/metadata.xsd +0 -0
  181. data/spec/rspec_custom_matchers.rb +5 -1
  182. data/spec/spec_helper.rb +1 -1
  183. data/spec/unit/datacite/mapping/contributor_spec.rb +7 -0
  184. data/spec/unit/datacite/mapping/creator_spec.rb +92 -0
  185. data/spec/unit/datacite/mapping/date_spec.rb +25 -214
  186. data/spec/unit/datacite/mapping/date_value_spec.rb +143 -0
  187. data/spec/unit/datacite/mapping/description_spec.rb +4 -3
  188. data/spec/unit/datacite/mapping/funding_reference_spec.rb +5 -5
  189. data/spec/unit/datacite/mapping/geo_location_box_spec.rb +0 -36
  190. data/spec/unit/datacite/mapping/geo_location_point_spec.rb +0 -25
  191. data/spec/unit/datacite/mapping/geo_location_polygon_spec.rb +47 -0
  192. data/spec/unit/datacite/mapping/geo_location_spec.rb +153 -6
  193. data/spec/unit/datacite/mapping/identifier_spec.rb +9 -0
  194. data/spec/unit/datacite/mapping/related_identifier_spec.rb +23 -0
  195. data/spec/unit/datacite/mapping/resource_spec.rb +994 -874
  196. data/spec/unit/datacite/mapping/subject_spec.rb +12 -6
  197. data/spec/unit/datacite/mapping/title_spec.rb +20 -6
  198. metadata +320 -278
  199. data/lib/datacite/mapping/nonvalidating.rb +0 -10
  200. data/lib/datacite/mapping/nonvalidating/identifier.rb +0 -40
  201. data/lib/datacite/mapping/nonvalidating/subject.rb +0 -43
  202. data/spec/data/mrt-datacite.xml +0 -61
  203. data/spec/unit/datacite/mapping/log_spec.rb +0 -23
  204. data/spec/unit/datacite/mapping/nonvalidating/identifier_spec.rb +0 -52
  205. data/spec/unit/datacite/mapping/resource_type_spec.rb +0 -68
@@ -0,0 +1,68 @@
1
+ require 'xml/mapping_extensions'
2
+
3
+ module Datacite
4
+ module Mapping
5
+ # Abstract superclass of GeoLocation parsing nodes
6
+ class GeoLocationNode < XML::Mapping::SingleAttributeNode
7
+
8
+ attr_reader :geom_class
9
+ attr_reader :coord_elements
10
+
11
+ def initialize(*args)
12
+ fail 'No geometry class provided' unless @geom_class
13
+ fail 'No coordinate elements provided' unless @coord_elements
14
+ path, *args = super(*args)
15
+ @path = ::XML::XXPath.new(path)
16
+ args
17
+ end
18
+
19
+ def datacite_3?
20
+ mapping == :datacite_3
21
+ end
22
+
23
+ def extract_attr_value(xml)
24
+ return from_text(xml) || from_children(xml)
25
+ rescue => e
26
+ raise e, "#{@owner}.#{@attrname}: Can't extract #{self.class} from #{xml}: #{e.message}"
27
+ end
28
+
29
+ def set_attr_value(xml, value) # rubocop:disable Metrics/AbcSize
30
+ fail "Invalid value: expected #{geom_class} instance, was #{value || 'nil'}" unless value && value.is_a?(geom_class)
31
+ element = @path.first(xml, ensure_created: true)
32
+
33
+ if datacite_3?
34
+ element.text = value.to_s
35
+ else
36
+ coord_elements.each do |getter, element_name|
37
+ child = element.elements << REXML::Element.new(element_name)
38
+ child.text = value.send(getter)
39
+ end
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ # Parses Datacite 3.x text coordinates
46
+ def from_text(xml)
47
+ xml_text = default_when_xpath_err { @path.first(xml).text }
48
+ return unless xml_text
49
+
50
+ stripped = xml_text.strip
51
+ return if stripped.empty?
52
+
53
+ coords = stripped.split(/\s+/).map(&:to_f)
54
+ geom_class.new(*coords)
55
+ end
56
+
57
+ # Parses Datacite 4.x child-element coordinates
58
+ def from_children(xml)
59
+ elem = @path.first(xml)
60
+ coords_hash = coord_elements.map do |key, element_name|
61
+ value = elem.elements[element_name].text
62
+ [key, value && value.to_f]
63
+ end.to_h
64
+ geom_class.new(coords_hash)
65
+ end
66
+ end
67
+ end
68
+ end
@@ -1,4 +1,5 @@
1
1
  require 'xml/mapping'
2
+ require 'datacite/mapping/geo_location_node'
2
3
 
3
4
  module Datacite
4
5
  module Mapping
@@ -63,7 +64,7 @@ module Datacite
63
64
  return nil unless other.class == self.class
64
65
  [:latitude, :longitude].each do |c|
65
66
  order = send(c) <=> other.send(c)
66
- return order if order != 0
67
+ return order if order.nonzero?
67
68
  end
68
69
  0
69
70
  end
@@ -87,13 +88,12 @@ module Datacite
87
88
  end
88
89
 
89
90
  # XML mapping node for `<geoLocationPoint/>`
90
- class GeoLocationPointNode < XML::MappingExtensions::NodeBase
91
- # Converts a whitespace-separated pair of coordinates to a {GeoLocationPoint}.
92
- # @param xml_text [String] the coordinates, in the order `lat` `long`.
93
- def to_value(xml_text)
94
- stripped = xml_text.strip
95
- coords = stripped.split(/\s+/).map(&:to_f)
96
- GeoLocationPoint.new(*coords)
91
+ class GeoLocationPointNode < GeoLocationNode
92
+ def initialize(*args)
93
+ @geom_class = GeoLocationPoint
94
+ @coord_elements = { latitude: 'pointLatitude',
95
+ longitude: 'pointLongitude' }.freeze
96
+ super
97
97
  end
98
98
  end
99
99
  XML::Mapping.add_node_class GeoLocationPointNode
@@ -0,0 +1,76 @@
1
+ require 'xml/mapping'
2
+
3
+ module Datacite
4
+ module Mapping
5
+ class GeoLocationPolygon
6
+ include Comparable
7
+ include XML::Mapping
8
+
9
+ # Creates a new `GeoLocationPolygon`.
10
+ #
11
+ # @param points [Array<GeoLocationPoint>] an array of points defining the polygon area.
12
+ # Per the spec, the array should contain at least four points, the first and last being
13
+ # identical to close the polygon.
14
+ def initialize(points:) # TODO: allow simple array of point args, array of hashes
15
+ self.points = points
16
+ warn "Polygon should contain at least 4 points, but has #{points.size}" if points.size < 4
17
+ warn "Polygon is not closed; last and first point should be identical, but were: [#{points[0]}], [#{points[-1]}]" if points.size > 1 unless points[0] == points[-1]
18
+ end
19
+
20
+ def points=(value)
21
+ @points = value || []
22
+ end
23
+
24
+ def <=>(other)
25
+ return nil unless other.class == self.class
26
+ points <=> other.points
27
+ end
28
+
29
+ def hash
30
+ points.hash
31
+ end
32
+
33
+ def to_s
34
+ point_hashes = points.map { |p| "{ latitude: #{p.latitude}, longitude: #{p.longitude} }" }.join(', ')
35
+ "[ #{point_hashes} ]"
36
+ end
37
+
38
+ # # @!attribute [rw] polygon
39
+ # # @return [Array<GeoLocationPoint>] an array of points defining the polygon area.
40
+ array_node :points, 'polygonPoint',
41
+ default_value: [],
42
+ marshaller: (proc { |xml, value| marshal_point(xml, value) }),
43
+ unmarshaller: (proc { |xml| unmarshal_point(xml) })
44
+
45
+ use_mapping :datacite_3
46
+
47
+ # TODO: does this ever get called?
48
+ read_only_array_node :points, 'polygonPoint', class: GeoLocationPoint, default_value: [], warn_reason: 'not available in Datacite 3'
49
+
50
+ fallback_mapping :datacite_3, :_default
51
+
52
+ # TODO: Figure out how to DRY this with GeoLocationPointNode
53
+
54
+ COORD_ELEMENTS = { longitude: 'pointLongitude',
55
+ latitude: 'pointLatitude' }.freeze
56
+
57
+ def self.marshal_point(element, value)
58
+ COORD_ELEMENTS.each do |getter, element_name|
59
+ v = value.send(getter)
60
+ puts "adding #{element_name}: #{v}"
61
+ child = element.elements << REXML::Element.new(element_name)
62
+ child.text = v
63
+ end
64
+ end
65
+
66
+ def self.unmarshal_point(elem)
67
+ coords_hash = COORD_ELEMENTS.map do |key, element_name|
68
+ value = elem.elements[element_name].text
69
+ [key, value && value.to_f]
70
+ end.to_h
71
+ GeoLocationPoint.new(coords_hash)
72
+ end
73
+
74
+ end
75
+ end
76
+ end
@@ -2,7 +2,7 @@ require 'xml/mapping'
2
2
 
3
3
  module Datacite
4
4
  module Mapping
5
- DOI_PATTERN = %r{10\..+/.+}
5
+ DOI_PATTERN = %r{10\.\S+/\S+}
6
6
 
7
7
  # The persistent identifier that identifies the resource.
8
8
  #
@@ -24,9 +24,10 @@ module Datacite
24
24
  end
25
25
 
26
26
  def value=(v)
27
- fail ArgumentError, 'Identifier must have a non-nil value' unless v
28
- fail ArgumentError, "Identifier value '#{v}' is not a valid DOI" unless v.match(DOI_PATTERN)
29
- @value = v
27
+ new_value = v && v.strip
28
+ fail ArgumentError, 'Identifier must have a non-nil value' unless new_value
29
+ fail ArgumentError, "Identifier value '#{new_value}' is not a valid DOI" unless new_value.match(DOI_PATTERN)
30
+ @value = new_value
30
31
  end
31
32
 
32
33
  # Sets the identifier type. Should only be called by the XML mapping engine.
@@ -50,16 +51,27 @@ module Datacite
50
51
  Identifier.new(value: match[0])
51
52
  end
52
53
 
53
- def self.extract_and_set_value(obj, xml)
54
- obj.value = xml.text
54
+ text_node :value, 'text()'
55
+ text_node :identifier_type, '@identifierType'
56
+
57
+ fallback_mapping :datacite_3, :_default
58
+ end
59
+
60
+ # Custom node to warn (but not blow up) if we read an XML `<resource/>` that's
61
+ # missing its `<identifier/>`.
62
+ class IdentifierNode < XML::Mapping::ObjectNode
63
+ def xml_to_obj(_obj, xml)
64
+ super if has_element?(xml)
55
65
  end
56
- private_class_method :extract_and_set_value
57
66
 
58
- text_node :identifier_type, '@identifierType'
67
+ private
59
68
 
60
- # The default reader throws an opaque XPath error if there's no element text,
61
- # so we extract it manually and let the accessor raise an error instead
62
- text_node :value, 'text()', reader: method(:extract_and_set_value)
69
+ def has_element?(xml) # rubocop:disable Style/PredicateName
70
+ @path.first(xml)
71
+ rescue XML::XXPathError
72
+ warn '<identifier/> not found; add a valid Identifier to the Resource before saving'
73
+ end
63
74
  end
75
+ XML::Mapping.add_node_class IdentifierNode
64
76
  end
65
77
  end
@@ -1,12 +1,12 @@
1
1
  module Datacite
2
2
  module Mapping
3
3
  # The name of this gem
4
- NAME = 'datacite-mapping'
4
+ NAME = 'datacite-mapping'.freeze
5
5
 
6
6
  # The version of this gem
7
- VERSION = '0.1.17.2'
7
+ VERSION = '0.2.0'.freeze
8
8
 
9
9
  # The copyright notice for this gem
10
- COPYRIGHT = 'Copyright (c) 2016 The Regents of the University of California'
10
+ COPYRIGHT = 'Copyright (c) 2016 The Regents of the University of California'.freeze
11
11
  end
12
12
  end
@@ -38,6 +38,7 @@ module Datacite
38
38
  # @return [String] the identifier value. Cannot be nil.
39
39
  text_node :value, 'text()'
40
40
 
41
+ fallback_mapping :datacite_3, :_default
41
42
  end
42
43
  end
43
44
  end
@@ -0,0 +1,12 @@
1
+ require 'xml/mapping_extensions'
2
+
3
+ # TODO: port this to xml-mapping_extensions
4
+ module XML
5
+ module MappingExtensions
6
+ class Namespace
7
+ def with_prefix(new_prefix)
8
+ Namespace.new(uri: uri, prefix: new_prefix, schema_location: schema_location)
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,65 @@
1
+ require 'xml/mapping'
2
+
3
+ module XML
4
+ class XXPath
5
+ attr_reader :xpathstr
6
+ end
7
+ end
8
+
9
+ module Datacite
10
+ module Mapping
11
+
12
+ module ReadOnlyNodes
13
+ def warn_reason
14
+ @warn_reason ||= @options[:warn_reason]
15
+ end
16
+
17
+ def value_from(obj)
18
+ obj.send(@attrname)
19
+ end
20
+
21
+ def value_str(val)
22
+ return "[ #{val.map(&:to_s).join(', ')} ]" if val.is_a?(Array)
23
+ "'#{val}'"
24
+ end
25
+
26
+ def obj_to_xml(obj, _xml)
27
+ val = value_from(obj)
28
+ return unless val
29
+ warn_ignored(val)
30
+ end
31
+
32
+ def warn_ignored(val)
33
+ warning = "ignoring #{@attrname} #{value_str(val)}"
34
+ warning.prepend("#{warn_reason}; ") if warn_reason
35
+ ReadOnlyNodes.warn(warning)
36
+ end
37
+
38
+ # public to allow testing
39
+ def self.warn(warning)
40
+ super
41
+ end
42
+ end
43
+
44
+ class ReadOnlyTextNode < XML::Mapping::TextNode
45
+ def warn_ignored(val)
46
+ fail ArgumentError, "Expected string, got #{val}" unless val.respond_to?(:strip)
47
+ return if val.strip.empty?
48
+ super
49
+ end
50
+ include ReadOnlyNodes
51
+ end
52
+ XML::Mapping.add_node_class ReadOnlyTextNode
53
+
54
+ class ReadOnlyArrayNode < XML::Mapping::ArrayNode
55
+ def warn_ignored(val)
56
+ fail ArgumentError, "Expected array, got #{val}" unless val.respond_to?(:empty?)
57
+ return if val.empty?
58
+ super
59
+ end
60
+ include ReadOnlyNodes
61
+ end
62
+ XML::Mapping.add_node_class ReadOnlyArrayNode
63
+
64
+ end
65
+ end
@@ -135,8 +135,31 @@ module Datacite
135
135
  # @!parse URN = URN
136
136
  new :URN, 'URN'
137
137
 
138
+ # @!parse IGSN = IGSN
139
+ new :IGSN, 'IGSN'
138
140
  end
139
141
 
142
+ class Datacite3RidTypeNode < XML::MappingExtensions::TypesafeEnumNode
143
+ def to_xml_text(enum_instance)
144
+ return super unless enum_instance == RelatedIdentifierType::IGSN
145
+ super(RelatedIdentifierType::HANDLE)
146
+ end
147
+ end
148
+ XML::Mapping.add_node_class(Datacite3RidTypeNode)
149
+
150
+ class Datacite3RidValueNode < XML::Mapping::TextNode
151
+ def obj_to_xml(obj, xml)
152
+ return super unless obj.identifier_type == RelatedIdentifierType::IGSN
153
+ igsn_value = obj.value
154
+ handle_value = "10273/#{igsn_value}"
155
+ # TODO: move this somewhere more general
156
+ ReadOnlyNodes.warn("IGSN identifiers not directly supported in Datacite 3; converting IGSN #{igsn_value} to Handle #{handle_value}")
157
+ set_attr_value(xml, handle_value)
158
+ true
159
+ end
160
+ end
161
+ XML::Mapping.add_node_class(Datacite3RidValueNode)
162
+
140
163
  # Globally unique identifier of a related resource.
141
164
  class RelatedIdentifier
142
165
  include XML::Mapping
@@ -198,6 +221,11 @@ module Datacite
198
221
  # @return [String, nil] the type of the metadata scheme. Used only with `HasMetadata`/`IsMetadataFor`. Optional.
199
222
  text_node :scheme_type, '@schemeType', default_value: nil
200
223
 
224
+ use_mapping :datacite_3
225
+ datacite3_rid_type_node :identifier_type, '@relatedIdentifierType', class: RelatedIdentifierType
226
+ datacite3_rid_value_node :value, 'text()'
227
+
228
+ fallback_mapping :datacite_3, :_default
201
229
  end
202
230
  end
203
231
  end
@@ -1,29 +1,40 @@
1
1
  require 'xml/mapping_extensions'
2
- require 'datacite/mapping/alternate_identifier'
3
- require 'datacite/mapping/creator'
2
+
4
3
  require 'datacite/mapping/identifier'
5
- require 'datacite/mapping/nonvalidating'
6
- require 'datacite/mapping/related_identifier'
4
+ require 'datacite/mapping/creator'
5
+ require 'datacite/mapping/title'
6
+ require 'datacite/mapping/subject'
7
+ require 'datacite/mapping/contributor'
8
+ require 'datacite/mapping/date'
7
9
  require 'datacite/mapping/resource_type'
10
+ require 'datacite/mapping/alternate_identifier'
8
11
  require 'datacite/mapping/rights'
9
- require 'datacite/mapping/subject'
10
- require 'datacite/mapping/title'
12
+ require 'datacite/mapping/geo_location'
13
+ require 'datacite/mapping/read_only_nodes'
11
14
 
12
15
  module Datacite
13
16
  module Mapping
14
17
 
15
- DATACITE_3_NAMESPACE = XML::MappingExtensions::Namespace.new(
16
- uri: 'http://datacite.org/schema/kernel-3',
17
- schema_location: 'http://schema.datacite.org/meta/kernel-3/metadata.xsd'
18
- )
19
-
20
18
  # A collection of metadata properties chosen for the accurate and consistent identification
21
19
  # of a resource for citation and retrieval purposes, along with recommended use instructions.
22
20
  # The resource that is being identified can be of any kind, but it is typically a dataset.
23
21
  class Resource # rubocop:disable Metrics/ClassLength
24
22
  include XML::MappingExtensions::Namespaced
25
23
 
26
- namespace DATACITE_3_NAMESPACE
24
+ # Shadows Namespaced::ClassMethods.namespace
25
+ def namespace
26
+ @namespace ||= DATACITE_4_NAMESPACE
27
+ end
28
+
29
+ # Overrides Namespaced::InstanceMethods.fill_into_xml to check mapping
30
+ def fill_into_xml(xml, options = { mapping: :_default })
31
+ if options[:mapping] == :datacite_3
32
+ unless namespace.uri == DATACITE_3_NAMESPACE.uri
33
+ @namespace = DATACITE_3_NAMESPACE.with_prefix(namespace.prefix)
34
+ end
35
+ end
36
+ super
37
+ end
27
38
 
28
39
  # Initialies a new {Resource}
29
40
  #
@@ -36,8 +47,7 @@ module Datacite
36
47
  # @param funding_references [Array<FundingReference>] information about financial support (funding) for the resource being registered.
37
48
  # @param contributors [Array<Contributor>] institutions or persons responsible for collecting, creating, or otherwise contributing to the developement of the dataset.
38
49
  # @param dates [Array<Date>] different dates relevant to the work.
39
- # @param language [String] Primary language of the resource: an IETF BCP 47, ISO 639-1 language code.
40
- # It's unclear from the spec whether language is required; to play it safe, if it's missing, we default to 'en'.
50
+ # @param language [String, nil] Primary language of the resource: an IETF BCP 47, ISO 639-1 language code.
41
51
  # @param resource_type [ResourceType, nil] the type of the resource
42
52
  # @param alternate_identifiers [Array<AlternateIdentifier>] an identifier or identifiers other than the primary {Identifier} applied to the resource being registered.
43
53
  # @param related_identifiers [Array<RelatedIdentifier>] identifiers of related resources.
@@ -47,7 +57,7 @@ module Datacite
47
57
  # @param rights_list [Array<Rights>] rights information for this resource.
48
58
  # @param descriptions [Array<Description>] all additional information that does not fit in any of the other categories.
49
59
  # @param geo_locations [Array<GeoLocations>] spatial region or named place where the data was gathered or about which the data is focused.
50
- def initialize(identifier:, creators:, titles:, publisher:, publication_year:, subjects: [], funding_references: [], contributors: [], dates: [], language: 'en', resource_type: nil, alternate_identifiers: [], related_identifiers: [], sizes: [], formats: [], version: nil, rights_list: [], descriptions: [], geo_locations: []) # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists, Metrics/AbcSize
60
+ def initialize(identifier:, creators:, titles:, publisher:, publication_year:, subjects: [], contributors: [], dates: [], language: nil, funding_references: [], resource_type: nil, alternate_identifiers: [], related_identifiers: [], sizes: [], formats: [], version: nil, rights_list: [], descriptions: [], geo_locations: []) # rubocop:disable Metrics/MethodLength, Metrics/ParameterLists, Metrics/AbcSize
51
61
  self.identifier = identifier
52
62
  self.creators = creators
53
63
  self.titles = titles
@@ -72,17 +82,9 @@ module Datacite
72
82
  # Sets the namespace prefix to be used when writing out XML (defaults to nil)
73
83
  # @param prefix [String, nil] The new prefix, or nil to use the default,
74
84
  # unprefixed namespace
75
- def self.namespace_prefix=(prefix)
85
+ def namespace_prefix=(prefix)
76
86
  old_namespace = namespace
77
- namespace ::XML::MappingExtensions::Namespace.new(uri: old_namespace.uri, schema_location: old_namespace.schema_location, prefix: prefix)
78
- end
79
-
80
- def language
81
- @language || 'en'
82
- end
83
-
84
- def language=(value)
85
- @language = value.strip if value
87
+ @namespace = ::XML::MappingExtensions::Namespace.new(uri: old_namespace.uri, schema_location: old_namespace.schema_location, prefix: prefix)
86
88
  end
87
89
 
88
90
  def identifier=(value)
@@ -91,18 +93,19 @@ module Datacite
91
93
  end
92
94
 
93
95
  def creators=(value)
94
- fail ArgumentError, 'Resource must have at least one creator' unless value && value.size > 0
96
+ fail ArgumentError, 'Resource must have at least one creator' unless value && !value.empty?
95
97
  @creators = value
96
98
  end
97
99
 
98
100
  def titles=(value)
99
- fail ArgumentError, 'Resource must have at least one title' unless value && value.size > 0
101
+ fail ArgumentError, 'Resource must have at least one title' unless value && !value.empty?
100
102
  @titles = value
101
103
  end
102
104
 
103
105
  def publisher=(value)
104
- fail ArgumentError, 'Resource must have at least one publisher' unless value && value.size > 0
105
- @publisher = value.strip
106
+ new_value = value && value.strip
107
+ fail ArgumentError, 'Resource must have a publisher' unless new_value && !new_value.empty?
108
+ @publisher = new_value.strip
106
109
  end
107
110
 
108
111
  def publication_year=(value)
@@ -110,17 +113,57 @@ module Datacite
110
113
  @publication_year = value.to_i
111
114
  end
112
115
 
113
- def subjects
114
- (@subjects ||= []).select(&:value)
116
+ def subjects=(value)
117
+ @subjects = (value && value.select(&:value)) || []
115
118
  end
116
119
 
117
- def subjects=(value)
118
- @subjects = (value || []).select(&:value)
120
+ def contributors=(value)
121
+ @contributors = value || []
122
+ end
123
+
124
+ def dates=(value)
125
+ @dates = value || []
126
+ end
127
+
128
+ def funding_references=(value)
129
+ @funding_references = value || []
130
+ end
131
+
132
+ def alternate_identifiers=(value)
133
+ @alternate_identifiers = value || []
134
+ end
135
+
136
+ def related_identifiers=(value)
137
+ @related_identifiers = value || []
138
+ end
139
+
140
+ def sizes=(value)
141
+ @sizes = value || []
142
+ end
143
+
144
+ def formats=(value)
145
+ @formats = value || []
146
+ end
147
+
148
+ def version=(value)
149
+ @version = value && value.strip
150
+ end
151
+
152
+ def rights_list=(value)
153
+ @rights_list = value || []
154
+ end
155
+
156
+ def descriptions=(value)
157
+ @descriptions = (value && value.select(&:value)) || []
158
+ end
159
+
160
+ def geo_locations=(value)
161
+ @geo_locations = (value && value.select(&:location?)) || []
119
162
  end
120
163
 
121
164
  # @!attribute [rw] identifier
122
165
  # @return [Identifier] a persistent identifier that identifies a resource.
123
- object_node :identifier, 'identifier', class: Identifier
166
+ identifier_node :identifier, 'identifier', class: Identifier
124
167
 
125
168
  # @!attribute [rw] creators
126
169
  # @return [Array<Creator>] the main researchers involved working on the data, or the authors of the publication in priority order.
@@ -156,7 +199,6 @@ module Datacite
156
199
 
157
200
  # @!attribute [rw] language
158
201
  # @return [String] Primary language of the resource: an IETF BCP 47, ISO 639-1 language code.
159
- # It's unclear from the spec whether language is required; to play it safe, if it's missing, we default to 'en'.
160
202
  text_node :language, 'language', default_value: nil
161
203
 
162
204
  # @!attribute [rw] resource_type
@@ -211,10 +253,11 @@ module Datacite
211
253
  # Convenience method to get the funding contributor.
212
254
  # @return [Contributor, nil] the contributor of type FUNDER, if any.
213
255
  def funder_contrib
214
- @funder_contrib ||= contributors.find { |c| c.type == ContributorType::FUNDER }
256
+ contributors.find { |c| c.type == ContributorType::FUNDER }
215
257
  end
216
258
 
217
259
  # Convenience method to get the name of the funding contributor.
260
+ # @deprecated contributor type 'funder' is deprecated. Use {FundingReference} instead.
218
261
  # @return [String, nil] the name of the funding contributor, if any.
219
262
  def funder_name
220
263
  funder_contrib.name if funder_contrib
@@ -232,16 +275,18 @@ module Datacite
232
275
  funder_id.value if funder_id
233
276
  end
234
277
 
235
- use_mapping :nonvalidating
278
+ extend Gem::Deprecate
279
+ deprecate(:funder_contrib, FundingReference, 2016, 9)
280
+ deprecate(:funder_name, FundingReference, 2016, 9)
281
+ deprecate(:funder_id, FundingReference, 2016, 9)
282
+ deprecate(:funder_id_value, FundingReference, 2016, 9)
236
283
 
237
- # Ignore missing or invalid values
238
- object_node :identifier, 'identifier', class: Nonvalidating::Identifier
239
- array_node :subjects, 'subjects', 'subject', class: Nonvalidating::Subject, default_value: []
240
- text_node :language, 'language', default_value: nil
284
+ use_mapping :datacite_3
241
285
 
242
- # TODO: Handle nested contributors, date ranges (e.g. spec/data/dash1-datacite-xml/ucsf-ark+=b7272=q6bg2kwf-mrt-datacite.xml)
286
+ read_only_array_node :funding_references, 'fundingReferences', 'fundingReference', class: FundingReference, default_value: [], warn_reason: '<fundingReferences/> not supported in Datacite 3'
243
287
 
244
- fallback_mapping :nonvalidating, :_default
288
+ fallback_mapping :datacite_3, :_default
245
289
  end
290
+
246
291
  end
247
292
  end