bolognese 1.1.2 → 1.1.3

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: 27940cced27604c5cf349c682939611611daf7acc5cd786672483f7f99cffa2d
4
- data.tar.gz: bdb4a1dc2100975979a63ed70800fd8593c17f24b7c4a347aed4e7c647a8d42e
3
+ metadata.gz: 224da431c7712a8499b7c00b00c5704ccf111ecdbd228d6554bfa613c5909713
4
+ data.tar.gz: caf8827bdef8f4a427825d8ea5575c65427962f9cd94e8a92d8e404e4b23e56a
5
5
  SHA512:
6
- metadata.gz: a5a082bd917f785cc61555de341bebe47adb241cc913be30fe39d596e4c6c03457ca472dceca6367e7a7d9235348a26fdbff579b95a8db55d56a5fcb3f98df4f
7
- data.tar.gz: 6fb9777ed5f5435a59aec51aa63135b80f735378dfa8c065191d01e70f51c05694eb3ee9798c2c3982d5f9416c04c8948331129ed98025dcdd5c96036f08a1d1
6
+ metadata.gz: 14595a1ce26d31dba01ef9abde8d85d04e4f65de6adc8a10c34287b5ad5dfc2916a3f03016e7700899d9f49aeb725348dcbc3dd10c720f5e2ae8e38f3a2cf86c
7
+ data.tar.gz: 6f2a0c9d428bf2b280871253f5449ee89b365996e2f8c46d12f6abd346fdd40653ec26846f524693fcdbd67098b4859477f0202de3ceb09339d40f420b3c9d4c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.1.2)
4
+ bolognese (1.1.3)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -36,7 +36,10 @@ module Bolognese
36
36
  id = Array.wrap(identifiers).first.to_h.fetch("identifier", nil)
37
37
  doi = Array.wrap(identifiers).find { |r| r["identifierType"] == "DOI" }.to_h.fetch("identifier", nil)
38
38
 
39
- creators = get_authors(from_schema_org_creators(Array.wrap(meta.fetch("agents", nil))))
39
+ has_agents = meta.fetch("agents", nil)
40
+ authors = has_agents.nil? ? meta.fetch("authors", nil) : has_agents
41
+ creators = get_authors(from_schema_org_creators(Array.wrap(authors)))
42
+
40
43
  contributors = get_authors(from_schema_org_contributors(Array.wrap(meta.fetch("editor", nil))))
41
44
  dates = []
42
45
  dates << { "date" => meta.fetch("datePublished"), "dateType" => "Issued" } if meta.fetch("datePublished", nil).present?
@@ -58,12 +61,16 @@ module Bolognese
58
61
  { "subject" => s }
59
62
  end
60
63
 
64
+ has_title = meta.fetch("title", nil)
65
+
66
+ titles = has_title.nil? ? [{ "title" => meta.fetch("name", nil) }] : [{ "title" => has_title }]
67
+
61
68
  { "id" => id,
62
69
  "types" => types,
63
70
  "identifiers" => identifiers,
64
71
  "doi" => doi_from_url(doi),
65
72
  "url" => normalize_id(meta.fetch("codeRepository", nil)),
66
- "titles" => [{ "title" => meta.fetch("title", nil) }],
73
+ "titles" => titles,
67
74
  "creators" => creators,
68
75
  "contributors" => contributors,
69
76
  "publisher" => publisher,
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
@@ -12,8 +12,8 @@ module Bolognese
12
12
  "@id" => normalize_doi(doi),
13
13
  "identifier" => to_schema_org_identifiers(identifiers),
14
14
  "codeRepository" => url,
15
- "title" => parse_attributes(titles, content: "title", first: true),
16
- "agents" => creators,
15
+ "name" => parse_attributes(titles, content: "title", first: true),
16
+ "authors" => creators,
17
17
  "description" => parse_attributes(descriptions, content: "description", first: true),
18
18
  "version" => version_info,
19
19
  "tags" => subjects.present? ? Array.wrap(subjects).map { |k| parse_attributes(k, content: "subject", first: true) } : nil,
@@ -0,0 +1,86 @@
1
+ {
2
+ "@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld",
3
+ "@type": "SoftwareSourceCode",
4
+ "authors": [{
5
+ "@id": "http://orcid.org/0000-0003-0077-4738",
6
+ "@type": "person",
7
+ "email": "jones@nceas.ucsb.edu",
8
+ "name": "Matt Jones",
9
+ "affiliation": "NCEAS",
10
+ "mustBeCited": true,
11
+ "isMaintainer": true,
12
+ "isRightsHolder": true,
13
+ "role": {
14
+ "namespace": "http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_RoleCode",
15
+ "roleCode": [
16
+ "originator",
17
+ "resourceProvider"
18
+ ]
19
+ }
20
+ }, {
21
+ "@id": "http://orcid.org/0000-0002-2192-403X",
22
+ "@type": "person",
23
+ "email": "slaughter@nceas.ucsb.edu",
24
+ "name": "Peter Slaughter",
25
+ "affiliation": "NCEAS",
26
+ "mustBeCited": true,
27
+ "isMaintainer": false,
28
+ "isRightsHolder": false,
29
+ "role": {
30
+ "namespace": "http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_RoleCode",
31
+ "roleCode": "contributor"
32
+ }
33
+ }, {
34
+ "@type": "organization",
35
+ "email": "info@ucop.edu",
36
+ "name": "University of California, Santa Barbara",
37
+ "role": {
38
+ "namespace": "http://www.ngdc.noaa.gov/metadata/published/xsd/schema/resources/Codelist/gmxCodelists.xml#CI_RoleCode",
39
+ "roleCode": "copyrightHolder"
40
+ }
41
+ }],
42
+ "depends": {
43
+ "@type": "URL",
44
+ "@value": "https://github.com/ropensci/datapack"
45
+ },
46
+ "identifier": "http://dx.doi.org/10.5063/F1M61H5X",
47
+ "codeRepository": "https://github.com/DataONEorg/rdataone",
48
+ "controlledTem": "software",
49
+ "datePublished": "2016-05-27",
50
+ "dateModified": "2016-05-27",
51
+ "dateCreated": "2016-05-27",
52
+ "description": "Provides read and write access to data and metadata from the DataONE network of data repositories.Each DataONE repository implements a consistent repository application programming interface. Users call methods in R to access these remote repository functions, such as methods to query the metadata catalog, get access to metadata for particular data packages, and read the data objects from the data repository.Users can also insert and update data objects on repositories that support these methods.",
53
+ "downloadLink": "https://cran.r-project.org/src/contrib/dataone_2.0.0.tar.gz",
54
+ "funding": "National Science Foundation grant #012345678",
55
+ "isAutomatedBuild": false,
56
+ "issueTracker": "https://github.com/DataONEorg/rdataone/issues",
57
+ "licenseId": "Apache-2.0",
58
+ "publisher": "https://cran.r-project.org",
59
+ "tags": [
60
+ "data sharing",
61
+ "data repository",
62
+ "DataONE"
63
+ ],
64
+ "name": "R Interface to the DataONE REST API",
65
+ "version": "2.0.0",
66
+ "uploadedBy": {
67
+ "@id": "http://orcid.org/0000-0003-0077-4738",
68
+ "@type": "person",
69
+ "email": "mbjones@nceas.ucsb.edu",
70
+ "name": "Matt Jones"
71
+ },
72
+ "programmingLanguage": {
73
+ "name": "R",
74
+ "version": "> 3.1.1",
75
+ "URL": "https://www.r-project.org"
76
+ },
77
+ "readme": "https://github.com/DataONEorg/rdataone/README.md",
78
+ "relatedPublications": "ISBN:0201703726",
79
+ "relationship": {
80
+ "relationshipType": "isPartOf",
81
+ "relatedIdentifier": "urn:uuid:F1A0A7AF-ECF3-4C7D-B675-7C6949963995",
82
+ "relatedIdentifierType": "UUID"
83
+ },
84
+ "softwarePaperCitationIdentifiers": "http://doi.org/0000/0000",
85
+ "zippedCode": "https://cran.r-project.org/src/contrib/dataone_2.0.0.tar.gz"
86
+ }
@@ -2,7 +2,7 @@
2
2
  "@context": "https://raw.githubusercontent.com/codemeta/codemeta/master/codemeta.jsonld",
3
3
  "@type": "SoftwareSourceCode",
4
4
  "@id": "https://doi.org/10.5438/QEG0-3GM3",
5
- "agents": {
5
+ "authors": {
6
6
  "@id": "http://orcid.org/0000-0003-0077-4738",
7
7
  "@type": "person",
8
8
  "name": "Martin Fenner",
@@ -0,0 +1,60 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.datacite.org/dois/10.5063/f1m61h5x
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Mozilla/5.0 (compatible; Maremma/4.2.1; +https://github.com/datacite/maremma)
12
+ Accept:
13
+ - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Date:
20
+ - Tue, 22 Jan 2019 10:40:18 GMT
21
+ Content-Type:
22
+ - application/json; charset=utf-8
23
+ Connection:
24
+ - keep-alive
25
+ Status:
26
+ - 200 OK
27
+ X-Anonymous-Consumer:
28
+ - 'true'
29
+ Cache-Control:
30
+ - max-age=0, private, must-revalidate
31
+ Vary:
32
+ - Accept-Encoding, Origin
33
+ X-Request-Id:
34
+ - 48c91bca-5323-4337-8889-6fda12bb6952
35
+ Etag:
36
+ - W/"cd7a4f850597028d5190ad0be9c79b23"
37
+ X-Runtime:
38
+ - '0.026371'
39
+ X-Powered-By:
40
+ - Phusion Passenger 6.0.1
41
+ Server:
42
+ - nginx/1.15.8 + Phusion Passenger 6.0.1
43
+ body:
44
+ encoding: ASCII-8BIT
45
+ string: '{"data":{"id":"10.5063/f1m61h5x","type":"dois","attributes":{"doi":"10.5063/f1m61h5x","prefix":"10.5063","suffix":"f1m61h5x","identifiers":[{"identifier":"https://doi.org/10.5063/f1m61h5x","identifierType":"DOI"}],"creators":[{"name":"Jones,
46
+ Matthew B.; Slaughter, Peter; Nahf, Rob; Boettiger, Carl ; Jones, Chris; Read,
47
+ Jordan; Walker, Lauren; Hart, Edmund; Chamberlain, Scott"}],"titles":[{"title":"dataone:
48
+ R interface to the DataONE network of data repositories"}],"publisher":"KNB
49
+ Data Repository","container":{},"publicationYear":2016,"subjects":[],"contributors":[],"dates":[{"date":"2016","dateType":"Issued"}],"language":null,"types":{"ris":"COMP","bibtex":"misc","citeproc":"article","schemaOrg":"SoftwareSourceCode","resourceTypeGeneral":"Software"},"relatedIdentifiers":[],"sizes":[],"formats":[],"version":null,"rightsList":[],"descriptions":[],"geoLocations":[],"fundingReferences":[],"xml":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHJlc291cmNlIHhtbG5zPSJodHRwOi8vZGF0YWNpdGUub3JnL3NjaGVtYS9rZXJuZWwtMyIKICB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIgogIHhzaTpzY2hlbWFMb2NhdGlvbj0iaHR0cDovL2RhdGFjaXRlLm9yZy9zY2hlbWEva2VybmVsLTMKICAgIGh0dHA6Ly9zY2hlbWEuZGF0YWNpdGUub3JnL21ldGEva2VybmVsLTMvbWV0YWRhdGEueHNkIj4KICA8aWRlbnRpZmllciBpZGVudGlmaWVyVHlwZT0iRE9JIj4xMC41MDYzL0YxTTYxSDVYPC9pZGVudGlmaWVyPgogIDxjcmVhdG9ycz4KICAgIDxjcmVhdG9yPgogICAgICA8Y3JlYXRvck5hbWU+Sm9uZXMsIE1hdHRoZXcgQi47IFNsYXVnaHRlciwgUGV0ZXI7IE5haGYsIFJvYjsgQm9ldHRpZ2VyLCBDYXJsIDsgSm9uZXMsIENocmlzOyBSZWFkLCBKb3JkYW47IFdhbGtlciwgTGF1cmVuOyBIYXJ0LCBFZG11bmQ7IENoYW1iZXJsYWluLCBTY290dDwvY3JlYXRvck5hbWU+CiAgICA8L2NyZWF0b3I+CiAgPC9jcmVhdG9ycz4KICA8dGl0bGVzPgogICAgPHRpdGxlPmRhdGFvbmU6IFIgaW50ZXJmYWNlIHRvIHRoZSBEYXRhT05FIG5ldHdvcmsgb2YgZGF0YSByZXBvc2l0b3JpZXM8L3RpdGxlPgogIDwvdGl0bGVzPgogIDxwdWJsaXNoZXI+S05CIERhdGEgUmVwb3NpdG9yeTwvcHVibGlzaGVyPgogIDxwdWJsaWNhdGlvblllYXI+MjAxNjwvcHVibGljYXRpb25ZZWFyPgogIDxyZXNvdXJjZVR5cGUgcmVzb3VyY2VUeXBlR2VuZXJhbD0iU29mdHdhcmUiLz4KPC9yZXNvdXJjZT4K","url":"https://github.com/DataONEorg/rdataone","contentUrl":null,"metadataVersion":1,"schemaVersion":"http://datacite.org/schema/kernel-3","source":null,"isActive":true,"state":"findable","reason":null,"created":"2016-03-12T03:15:03.000Z","registered":"2016-03-12T03:15:04.000Z","updated":"2018-10-07T13:22:40.000Z"},"relationships":{"client":{"data":{"id":"cdl.nceas","type":"clients"}},"media":{"data":[]}}},"included":[{"id":"cdl.nceas","type":"clients","attributes":{"name":"National
50
+ Center for Ecological Analysis and Synthesis (NCEAS)","symbol":"CDL.NCEAS","year":2011,"contactName":"EZID
51
+ Support Desk","contactEmail":"ezid@ucop.edu","description":"The NCEAS Data
52
+ Repository contains information about the research data sets collected and
53
+ collated as part of NCEAS'' funded activities. Information in the NCEAS Data
54
+ Repository is concurrently available through the Knowledge Network for Biocomplexity
55
+ (KNB), an international data repository. A number of the data sets were synthesized
56
+ from multiple data sources that originated from the efforts of many contributors,
57
+ while others originated from a single","domains":"*","url":"https://data.nceas.ucsb.edu/","created":"2011-12-13T04:27:25.000Z","updated":"2018-12-20T23:09:38.000Z","isActive":true,"hasPassword":true},"relationships":{"provider":{"data":{"id":"cdl","type":"providers"}},"repository":{"data":{"id":"10.17616/R3FW2J","type":"repositories"}},"prefixes":{"data":[{"id":"10.5063","type":"prefixes"},{"id":"10.5072","type":"prefixes"}]}}}]}'
58
+ http_version:
59
+ recorded_at: Tue, 22 Jan 2019 10:40:18 GMT
60
+ recorded_with: VCR 3.0.3
@@ -28,10 +28,19 @@ describe Bolognese::Metadata, vcr: true do
28
28
  expect(json["@id"]).to eq("https://doi.org/10.5063/f1m61h5x")
29
29
  expect(json["@type"]).to eq("SoftwareSourceCode")
30
30
  expect(json["identifier"]).to eq("@type"=>"PropertyValue", "propertyID"=>"DOI", "value"=>"https://doi.org/10.5063/f1m61h5x")
31
- expect(json["agents"]).to eq([{"name"=>"Jones, Matthew B.; Slaughter, Peter; Nahf, Rob; Boettiger, Carl ; Jones, Chris; Read, Jordan; Walker, Lauren; Hart, Edmund; Chamberlain, Scott"}])
32
- expect(json["title"]).to eq("dataone: R interface to the DataONE network of data repositories")
31
+ expect(json["authors"]).to eq([{"name"=>"Jones, Matthew B.; Slaughter, Peter; Nahf, Rob; Boettiger, Carl ; Jones, Chris; Read, Jordan; Walker, Lauren; Hart, Edmund; Chamberlain, Scott"}])
32
+ expect(json["name"]).to eq("dataone: R interface to the DataONE network of data repositories")
33
33
  expect(json["datePublished"]).to eq("2016")
34
34
  expect(json["publisher"]).to eq("KNB Data Repository")
35
35
  end
36
+
37
+ it "SoftwareSourceCode DataCite check codemeta v2" do
38
+ input = "https://doi.org/10.5063/f1m61h5x"
39
+ subject = Bolognese::Metadata.new(input: input, from: "datacite")
40
+ expect(subject.valid?).to be true
41
+ json = JSON.parse(subject.codemeta)
42
+ expect(json["agents"]).to be_nil
43
+ expect(json["title"]).to be_nil
44
+ end
36
45
  end
37
46
  end
@@ -65,6 +65,16 @@ describe Bolognese::Metadata, vcr: true do
65
65
  expect(crosscite["version"]).to eq("2.0.0")
66
66
  end
67
67
 
68
+ it "rdataone codemeta v2" do
69
+ input = fixture_path + 'codemeta_v2.json'
70
+ subject = Bolognese::Metadata.new(input: input, from: "codemeta")
71
+ crosscite = JSON.parse(subject.crosscite)
72
+ expect(crosscite["titles"]).to eq([{"title"=>"R Interface to the DataONE REST API"}])
73
+ expect(crosscite["creators"].length).to eq(3)
74
+ expect(crosscite["creators"].last).to eq("nameType" => "Organizational", "name"=>"University Of California, Santa Barbara")
75
+ expect(crosscite["version"]).to eq("2.0.0")
76
+ end
77
+
68
78
  it "datacite database attributes" do
69
79
  input = "https://doi.org/10.5061/DRYAD.8515"
70
80
  subject = Bolognese::Metadata.new(input: input, from: "datacite")
@@ -87,6 +87,28 @@ describe Bolognese::Metadata, vcr: true do
87
87
  expect(datacite.fetch("version")).to eq("2.0.0")
88
88
  end
89
89
 
90
+ it "rdataone and codemeta_v2" do
91
+ input = fixture_path + 'codemeta_v2.json'
92
+ subject = Bolognese::Metadata.new(input: input, from: "codemeta")
93
+ expect(subject.valid?).to be true
94
+ datacite = Maremma.from_xml(subject.datacite).fetch("resource", {})
95
+ expect(datacite.dig("titles", "title")).to eq("R Interface to the DataONE REST API")
96
+ expect(datacite.dig("creators", "creator")).to eq([{"creatorName"=>{"__content__"=>"Jones, Matt", "nameType"=>"Personal"},
97
+ "givenName"=>"Matt",
98
+ "familyName"=>"Jones",
99
+ "nameIdentifier"=>
100
+ {"nameIdentifierScheme"=>"ORCID",
101
+ "__content__"=>"https://orcid.org/0000-0003-0077-4738"}},
102
+ {"creatorName"=>{"__content__"=>"Slaughter, Peter", "nameType"=>"Personal"},
103
+ "givenName"=>"Peter",
104
+ "familyName"=>"Slaughter",
105
+ "nameIdentifier"=>
106
+ {"nameIdentifierScheme"=>"ORCID",
107
+ "__content__"=>"https://orcid.org/0000-0002-2192-403X"}},
108
+ {"creatorName"=>{"__content__"=>"University Of California, Santa Barbara", "nameType"=>"Organizational"}}])
109
+ expect(datacite.fetch("version")).to eq("2.0.0")
110
+ end
111
+
90
112
  it "maremma" do
91
113
  input = "https://github.com/datacite/maremma"
92
114
  subject = Bolognese::Metadata.new(input: input, from: "codemeta")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bolognese
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-12 00:00:00.000000000 Z
11
+ date: 2019-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: maremma
@@ -664,6 +664,7 @@ files:
664
664
  - spec/fixtures/citeproc-no-categories.json
665
665
  - spec/fixtures/citeproc.json
666
666
  - spec/fixtures/codemeta.json
667
+ - spec/fixtures/codemeta_v2.json
667
668
  - spec/fixtures/crosscite.json
668
669
  - spec/fixtures/crossref.bib
669
670
  - spec/fixtures/crossref.ris
@@ -958,6 +959,7 @@ files:
958
959
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/software.yml
959
960
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_citeproc/with_pages.yml
960
961
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite.yml
962
+ - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_codemeta/SoftwareSourceCode_DataCite_check_codemeta_v2.yml
961
963
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crosscite/datacite_database_attributes.yml
962
964
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crosscite/maremma.yml
963
965
  - spec/fixtures/vcr_cassettes/Bolognese_Metadata/write_metadata_as_crosscite/with_ORCID_ID.yml