bolognese 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2c9c9b6ae436d5c28cc42cf4d8016241d662f204513421100107336745aee23e
4
- data.tar.gz: 651aae07a34751e4adf64939530641f42c6fb781741fbfab7284a92e079518f2
3
+ metadata.gz: 347b7bb3e8466ba382357816de4d0a07ef64424ec37244b98f12372c0d475ee8
4
+ data.tar.gz: a5cef69c662b4fa675951c37d175bde3ff4556252e0176309f2769cfb4544359
5
5
  SHA512:
6
- metadata.gz: a68a022bf10284fd457cd4a0ac5a2f8189b9da5fb518997642c2c0e3589da1377cc8559fc39816bfb7a8754af4c1e7610038629e626579c4025c86bc1a636a02
7
- data.tar.gz: 9bb5a682e638852461a0f7c87dfd5b75a634e80204047acaae50ae99c5e417bfd1fd07f704238e57bd626a309eab9d0ee177b94a205b45efc84b2804b3680423
6
+ metadata.gz: a49a0ddaf9749f22de36e8e3d941c664135c540d8815a4cbcefcbe64ebc4922b3ae138194c41df003dcdb194ea99c796dc726b339b27cbbae9d93fb880995a07
7
+ data.tar.gz: f1298514c8b8e175754502de187e067eb89da8692bce34cf8e76a17de9501275a9db465a47641538e6456317c4876a806996c5d4c17a271cc15b7e0a466b818d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.0.11)
4
+ bolognese (1.0.12)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -161,7 +161,7 @@ module Bolognese
161
161
  "southBoundLatitude" => gl.dig("geoLocationBox", "southBoundLatitude"),
162
162
  "northBoundLatitude" => gl.dig("geoLocationBox", "northBoundLatitude")
163
163
  }.compact.presence,
164
- "geoLocationPlace" => gl["geoLocationPlace"],
164
+ "geoLocationPlace" => parse_attributes(gl["geoLocationPlace"], first: true).to_s.strip.presence
165
165
  }.compact
166
166
  end
167
167
  end.compact
@@ -177,16 +177,16 @@ module Bolognese
177
177
  "creator" => get_authors(Array.wrap(meta.dig("creators", "creator"))),
178
178
  "contributor" => get_authors(Array.wrap(meta.dig("contributors", "contributor"))),
179
179
  "periodical" => periodical,
180
- "publisher" => meta.fetch("publisher", nil).to_s.strip.presence,
180
+ "publisher" => parse_attributes(meta.fetch("publisher", nil), first: true).to_s.strip.presence,
181
181
  "source" => "DataCite",
182
182
  "funding_references" => funding_references,
183
183
  "dates" => dates,
184
- "publication_year" => meta.fetch("publicationYear", nil).to_s.presence,
184
+ "publication_year" => parse_attributes(meta.fetch("publicationYear", nil), first: true).to_s.strip.presence,
185
185
  "descriptions" => descriptions,
186
186
  "rights_list" => rights_list,
187
187
  "version" => meta.fetch("version", nil).to_s.presence,
188
188
  "subjects" => subjects,
189
- "language" => meta.fetch("language", nil).to_s.presence,
189
+ "language" => parse_attributes(meta.fetch("language", nil), first: true).to_s.strip.presence,
190
190
  "geo_locations" => geo_locations,
191
191
  "related_identifiers" => related_identifiers,
192
192
  "formats" => formats,
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.0.11"
2
+ VERSION = "1.0.12"
3
3
  end
@@ -0,0 +1,51 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
+ <resource
3
+ xmlns="http://datacite.org/schema/kernel-4"
4
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4/metadata.xsd">
5
+ <identifier identifierType="DOI">10.15770/EUM_SAF_OSI_9999</identifier>
6
+ <creators>
7
+ <creator>
8
+ <creatorName>SAF on Ocean and Sea Ice</creatorName>
9
+ </creator>
10
+ <creator>
11
+ <creatorName>OSI SAF</creatorName>
12
+ </creator>
13
+ </creators>
14
+ <titles>
15
+ <title xml:lang="en">DOI Test 2 title content</title>
16
+ <title xml:lang="en">AAPP</title>
17
+ </titles>
18
+ <publisher>OSI SAF</publisher>
19
+ <publicationYear>2004</publicationYear>
20
+ <resourceType resourceTypeGeneral="Collection">Climate Data Record</resourceType>
21
+ <dates>
22
+ <date dateType="Created">2004-01-19</date>
23
+ <date dateType="Valid">2004-01-19/2015-12-31</date>
24
+ </dates>
25
+ <language>en</language>
26
+ <relatedIdentifiers>
27
+ <relatedIdentifier relatedIdentifierType="URL" relationType="HasMetadata" relatedMetadataScheme="http://schemas.opengis.net/iso/19139/20060504/gmd/gmd.xsd" schemeURI="http://schemas.opengis.net/csw/2.0.2/csw.xsd" schemeType="xsd">https://eumetsat.eggits.net/elastic-csw/download/EO:EUM:CM:MSG:DOI_TEST_2</relatedIdentifier>
28
+ <relatedIdentifier relatedIdentifierType="URL" relationType="IsDocumentedBy" schemeType="text/html">https://eumetsat.eggits.net/nextgen-pn/product/EO:EUM:CM:MSG:DOI_TEST_2</relatedIdentifier>
29
+ </relatedIdentifiers>
30
+ <rightsList>
31
+ <rights>copyright</rights>
32
+ </rightsList>
33
+ <descriptions>
34
+ <description descriptionType="Methods" xml:lang="en">This is the DOI TEST 2 product where this is the description field content.</description>
35
+ </descriptions>
36
+ <geoLocations>
37
+ <geoLocation>
38
+ <geoLocationBox>
39
+ <westBoundLongitude>-70.0</westBoundLongitude>
40
+ <eastBoundLongitude>70.0</eastBoundLongitude>
41
+ <southBoundLatitude>-70.0</southBoundLatitude>
42
+ <northBoundLatitude>70.0</northBoundLatitude>
43
+ </geoLocationBox>
44
+ </geoLocation>
45
+ <geoLocation>
46
+ <geoLocationPlace
47
+ xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">Regional
48
+ </geoLocationPlace>
49
+ </geoLocation>
50
+ </geoLocations>
51
+ </resource>
@@ -180,9 +180,9 @@ describe Bolognese::Metadata, vcr: true do
180
180
  input = fixture_path + 'datacite-multiple-language.xml'
181
181
  subject = Bolognese::Metadata.new(input: input)
182
182
  expect(subject.types["schemaOrg"]).to eq("Collection")
183
- expect(subject.language).to eq("[\"de\", \"en\"]")
184
- expect(subject.publisher).to eq("[\"Universitätsbibliothek Tübingen\", \"University Library Tübingen\"]")
185
- expect(subject.publication_year).to eq("[\"2015\", \"2016\"]")
183
+ expect(subject.language).to eq("de")
184
+ expect(subject.publisher).to eq("Universitätsbibliothek Tübingen")
185
+ expect(subject.publication_year).to eq("2015")
186
186
  expect(subject.valid?).to be false
187
187
  expect(subject.errors).to eq("13:0: ERROR: Element '{http://datacite.org/schema/kernel-2.2}publisher': This element is not expected. Expected is ( {http://datacite.org/schema/kernel-2.2}publicationYear ).")
188
188
  end
@@ -195,6 +195,16 @@ describe Bolognese::Metadata, vcr: true do
195
195
  expect(subject.geo_locations).to eq([{"geoLocationPoint"=>{"pointLatitude"=>"-11.64583333", "pointLongitude"=>"-68.2975"}}])
196
196
  end
197
197
 
198
+ it "xml:lang attribute" do
199
+ input = fixture_path + 'datacite-xml-lang.xml'
200
+ subject = Bolognese::Metadata.new(input: input)
201
+ expect(subject.valid?).to be true
202
+ expect(subject.types["schemaOrg"]).to eq("Collection")
203
+ expect(subject.titles).to eq([{"lang"=>"en", "title"=>"DOI Test 2 title content"}, {"lang"=>"en", "title"=>"AAPP"}])
204
+ expect(subject.descriptions).to eq([{"description"=>"This is the DOI TEST 2 product where this is the description field content.", "descriptionType"=>"Methods", "lang"=>"en"}])
205
+ expect(subject.geo_locations).to eq([{"geoLocationBox"=>{"eastBoundLongitude"=>"70.0", "northBoundLatitude"=>"70.0", "southBoundLatitude"=>"-70.0", "westBoundLongitude"=>"-70.0"}}, {"geoLocationPlace"=>"Regional"}])
206
+ end
207
+
198
208
  it "schema 4.0" do
199
209
  input = fixture_path + 'schema_4.0.xml'
200
210
  subject = Bolognese::Metadata.new(input: input)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
@@ -674,6 +674,7 @@ files:
674
674
  - spec/fixtures/datacite-geolocation-empty.xml
675
675
  - spec/fixtures/datacite-metadata-sample-complicated-v2.2.xml
676
676
  - spec/fixtures/datacite-multiple-language.xml
677
+ - spec/fixtures/datacite-xml-lang.xml
677
678
  - spec/fixtures/datacite.json
678
679
  - spec/fixtures/datacite.xml
679
680
  - spec/fixtures/datacite_dataset.xml