bolognese 1.3.1 → 1.3.2
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/Gemfile.lock +1 -1
- data/lib/bolognese/author_utils.rb +9 -6
- data/lib/bolognese/datacite_utils.rb +1 -1
- data/lib/bolognese/utils.rb +2 -2
- data/lib/bolognese/version.rb +1 -1
- data/spec/readers/datacite_reader_spec.rb +10 -9
- data/spec/writers/schema_org_writer_spec.rb +24 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c470f4a7231fe120bbcfe85bb804b7b092df761a7273883211afca1dec075b07
|
4
|
+
data.tar.gz: 502d58d7e1e81be65cc22ced4d67d0e01408678b6f1601f338631c95455e7c41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ee3911bffb285fb868f7eb7dcea74cfe8fde2f7e64bcf06409b190bb71067da272deffefd50bbf9d8c10c6ca17442afd930aac8330c7918bcde235f996a6e37
|
7
|
+
data.tar.gz: 25cd55aae3ebea0206f93a46b4af8b51fede6bde3fc03be3f1aa37ed79b5bf1d36d5024338b21ba5e16a11609210ea607b8211ff8cf46da4db05a351bf0bd3b1
|
data/Gemfile.lock
CHANGED
@@ -136,19 +136,22 @@ module Bolognese
|
|
136
136
|
def get_affiliations(affiliations)
|
137
137
|
Array.wrap(affiliations).map do |a|
|
138
138
|
if a.is_a?(String)
|
139
|
-
id = nil
|
140
139
|
name = a.squish
|
140
|
+
affiliation_identifier = nil
|
141
141
|
affiliation_identifier_scheme = nil
|
142
|
+
scheme_uri = nil
|
142
143
|
else
|
143
|
-
|
144
|
-
|
144
|
+
affiliation_identifier = a["affiliationIdentifier"]
|
145
|
+
affiliation_identifier = !affiliation_identifier.to_s.start_with?("https://") && a["schemeURI"].present? ? normalize_id(a["schemeURI"] + affiliation_identifier) : normalize_id(affiliation_identifier)
|
145
146
|
name = a["__content__"].squish
|
146
147
|
affiliation_identifier_scheme = a["affiliationIdentifierScheme"]
|
148
|
+
scheme_uri = a["SchemeURI"]
|
147
149
|
end
|
148
150
|
|
149
|
-
{ "
|
150
|
-
"
|
151
|
-
"affiliationIdentifierScheme" => affiliation_identifier_scheme
|
151
|
+
{ "name" => name,
|
152
|
+
"affiliationIdentifier" => affiliation_identifier,
|
153
|
+
"affiliationIdentifierScheme" => affiliation_identifier_scheme,
|
154
|
+
"schemeUri" => scheme_uri }.compact
|
152
155
|
end.presence
|
153
156
|
end
|
154
157
|
end
|
@@ -76,7 +76,7 @@ module Bolognese
|
|
76
76
|
xml.nameIdentifier(ni["nameIdentifier"], 'nameIdentifierScheme' => ni["nameIdentifierScheme"], 'schemeURI' => ni["schemeUri"])
|
77
77
|
end
|
78
78
|
Array.wrap(person["affiliation"]).each do |affiliation|
|
79
|
-
attributes = { "affiliationIdentifierScheme" => affiliation["affiliationIdentifierScheme"], "schemeURI" => affiliation["schemeUri"] }.compact
|
79
|
+
attributes = { "affiliationIdentifier" => affiliation["affiliationIdentifier"], "affiliationIdentifierScheme" => affiliation["affiliationIdentifierScheme"], "schemeURI" => affiliation["schemeUri"] }.compact
|
80
80
|
xml.affiliation(affiliation["name"], attributes)
|
81
81
|
end
|
82
82
|
end
|
data/lib/bolognese/utils.rb
CHANGED
@@ -582,7 +582,7 @@ module Bolognese
|
|
582
582
|
id = nil
|
583
583
|
else
|
584
584
|
name = a["name"]
|
585
|
-
id = a["
|
585
|
+
id = a["affiliationIdentifier"]
|
586
586
|
end
|
587
587
|
|
588
588
|
{
|
@@ -605,7 +605,7 @@ module Bolognese
|
|
605
605
|
id = nil
|
606
606
|
else
|
607
607
|
name = a["name"]
|
608
|
-
id = a["
|
608
|
+
id = a["affiliationIdentifier"]
|
609
609
|
end
|
610
610
|
|
611
611
|
{
|
data/lib/bolognese/version.rb
CHANGED
@@ -91,18 +91,19 @@ describe Bolognese::Metadata, vcr: true do
|
|
91
91
|
expect(subject.types["ris"]).to eq("COMP")
|
92
92
|
expect(subject.types["citeproc"]).to eq("article")
|
93
93
|
expect(subject.creators.length).to eq(3)
|
94
|
-
expect(subject.creators.first).to eq("nameType"=>"Personal", "affiliation" => [{"
|
94
|
+
expect(subject.creators.first).to eq("nameType"=>"Personal", "affiliation" => [{"affiliationIdentifier"=>"https://ror.org/04wxnsj81", "affiliationIdentifierScheme"=>"ROR", "name"=>"DataCite"}],
|
95
95
|
"familyName" => "Miller",
|
96
96
|
"givenName" => "Elizabeth",
|
97
97
|
"name" => "Miller, Elizabeth",
|
98
98
|
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0001-5000-0007", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}],)
|
99
|
-
expect(subject.creators.dig(1, "affiliation")).to eq([{"
|
100
|
-
"
|
99
|
+
expect(subject.creators.dig(1, "affiliation")).to eq([{"affiliationIdentifier"=>"https://ror.org/05gq02987",
|
100
|
+
"affiliationIdentifierScheme"=>"ROR",
|
101
101
|
"name"=>"Brown University"},
|
102
|
-
{"
|
103
|
-
|
104
|
-
|
105
|
-
expect(subject.creators.dig(2, "affiliation")).to eq([{"
|
102
|
+
{"affiliationIdentifier"=>"https://grid.ac/institutes/grid.268117.b",
|
103
|
+
"affiliationIdentifierScheme"=>"GRID",
|
104
|
+
"name"=>"Wesleyan University"}])
|
105
|
+
expect(subject.creators.dig(2, "affiliation")).to eq([{"affiliationIdentifier"=>"https://ror.org/05gq02987",
|
106
|
+
"affiliationIdentifierScheme"=>"ROR", "name"=>"Brown University"}])
|
106
107
|
expect(subject.titles).to eq([{"lang"=>"en-US", "title"=>"Full DataCite XML Example"}, {"lang"=>"en-US", "title"=>"Demonstration of DataCite Properties.", "titleType"=>"Subtitle"}])
|
107
108
|
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5072/example-full",
|
108
109
|
"identifierType"=>"DOI"},
|
@@ -112,8 +113,8 @@ describe Bolognese::Metadata, vcr: true do
|
|
112
113
|
expect(subject.rights_list).to eq([{"lang"=>"en-US", "rightsUri"=>"http://creativecommons.org/publicdomain/zero/1.0"}])
|
113
114
|
expect(subject.publication_year).to eq("2014")
|
114
115
|
expect(subject.contributors).to eq([{"nameType"=>"Personal", "name"=>"Starr, Joan", "givenName"=>"Joan", "familyName"=>"Starr", "nameIdentifiers"=>[{"nameIdentifier"=>"https://orcid.org/0000-0002-7285-027X", "schemeUri"=>"https://orcid.org", "nameIdentifierScheme"=>"ORCID"}], "affiliation"=>
|
115
|
-
[{"
|
116
|
-
"
|
116
|
+
[{"affiliationIdentifier"=>"https://ror.org/03yrm5c26",
|
117
|
+
"affiliationIdentifierScheme"=>"ROR",
|
117
118
|
"name"=>"California Digital Library"}], "contributorType"=>"ProjectLeader"}])
|
118
119
|
expect(subject.subjects).to eq([{"lang"=>"en-US", "schemeUri"=>"http://dewey.info/", "subject"=>"000 computer science", "subjectScheme"=>"dewey"}])
|
119
120
|
expect(subject.dates).to eq([{"date"=>"2017-09-13", "dateInformation"=>"Updated with 4.2 properties", "dateType"=>"Updated"}, {"date"=>"2014", "dateType"=>"Issued"}])
|
@@ -186,6 +186,30 @@ describe Bolognese::Metadata, vcr: true do
|
|
186
186
|
expect(json["contentUrl"]).to include("s3://cgp-commons-public/topmed_open_access/197bc047-e917-55ed-852d-d563cdbc50e4/NWD165827.recab.cram", "gs://topmed-irc-share/public/NWD165827.recab.cram")
|
187
187
|
end
|
188
188
|
|
189
|
+
it "affiliation identifier" do
|
190
|
+
input = fixture_path + 'datacite-example-affiliation.xml'
|
191
|
+
subject = Bolognese::Metadata.new(input: input)
|
192
|
+
json = JSON.parse(subject.schema_org)
|
193
|
+
expect(json["@id"]).to eq("https://doi.org/10.5072/example-full")
|
194
|
+
expect(json["@type"]).to eq("SoftwareSourceCode")
|
195
|
+
expect(json["name"]).to eq("Full DataCite XML Example")
|
196
|
+
expect(json["author"].length).to eq(3)
|
197
|
+
expect(json["author"].first).to eq("@id" => "https://orcid.org/0000-0001-5000-0007",
|
198
|
+
"@type" => "Person",
|
199
|
+
"affiliation" => {"@id"=>"https://ror.org/04wxnsj81", "@type"=>"Organization", "name"=>"DataCite"},
|
200
|
+
"familyName" => "Miller",
|
201
|
+
"givenName" => "Elizabeth",
|
202
|
+
"name" => "Elizabeth Miller")
|
203
|
+
expect(json["identifier"]).to eq(
|
204
|
+
[{"@type"=>"PropertyValue",
|
205
|
+
"propertyID"=>"DOI",
|
206
|
+
"value"=>"https://doi.org/10.5072/example-full"},
|
207
|
+
{"@type"=>"PropertyValue",
|
208
|
+
"propertyID"=>"URL",
|
209
|
+
"value"=>"https://schema.datacite.org/meta/kernel-4.2/example/datacite-example-full-v4.2.xml"}]
|
210
|
+
)
|
211
|
+
end
|
212
|
+
|
189
213
|
it "geo_location_point" do
|
190
214
|
input = fixture_path + 'datacite-example-geolocation-2.xml'
|
191
215
|
doi = "10.6071/Z7WC73"
|