bolognese 1.2.15 → 1.2.16

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: 5619a12eb377a73a9fef8e1d42e534da7151fad16c518d91292a319d0616b3eb
4
- data.tar.gz: da41ff0a1ffae9a6160fe7cb97ffaa67d8ea3bb412dd31bcc5517ade60b362bb
3
+ metadata.gz: 84b31aa209d784909a59c928b9dded98a3be2131fb3b44584d0a5d614cceb1d1
4
+ data.tar.gz: dea1bd892f19caf85b51f3cdc48347b4c442c1f3234717ba762e2b486fd12020
5
5
  SHA512:
6
- metadata.gz: 9f9b8994d7395f7c1d64d7287f83cc4e9571793c334ecb1372cc67b9353d0936dee003c235809fe1139dd1d275f2fd9f5a5988276a3de41ddbd785864cd47bba
7
- data.tar.gz: 00f205f17c7876b349d1fefbc837ef4b723ba8dbc2a3081f9b9ac910c5844ea549095366e385b7facebcc6cf13a208c70fd2cb34a156c171d1c954fcf44f7cf2
6
+ metadata.gz: 269272d04ba090da97d19d28bb0d1893786189093e2b3ff9a30571201626b4a8da3f788daba6e8de06e9422b08ffe6dfc0fa112bd12ed2374f1b39e2eaae9c7e
7
+ data.tar.gz: b0ab1ef360037acf936a7665a8bb35f1e09e76ecfec3238e523e8ae23b4d4f74d91599d01695dffcf8e3e631f91c9afb69ba21ddf5b14bcdd8d258bc141d191e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bolognese (1.2.15)
4
+ bolognese (1.2.16)
5
5
  activesupport (>= 4.2.5, < 6)
6
6
  benchmark_methods (~> 0.7)
7
7
  bibtex-ruby (~> 4.1)
@@ -677,6 +677,7 @@ module Bolognese
677
677
  def from_schema_org_creators(element)
678
678
  element = Array.wrap(element).map do |c|
679
679
  c["nameIdentifier"] = [{ "__content__" => c["@id"], "nameIdentifierScheme" => "ORCID", "schemeUri" => "https://orcid.org" }] if normalize_orcid(c["@id"])
680
+ c["@type"] = c["@type"].find { |t| %w(Person Organization).include?(t) } if c["@type"].is_a?(Array)
680
681
  c["creatorName"] = { "nameType" => c["@type"].present? ? c["@type"].titleize + "al" : nil, "__content__" => c["name"] }.compact
681
682
  c.except("@id", "@type", "name")
682
683
  end
@@ -1,3 +1,3 @@
1
1
  module Bolognese
2
- VERSION = "1.2.15"
2
+ VERSION = "1.2.16"
3
3
  end
@@ -0,0 +1,41 @@
1
+ {
2
+ "@context": "http://schema.org",
3
+ "@type": "BlogPosting",
4
+ "@id": "https://doi.org/10.5438/4k3m-nyvg",
5
+ "name": "Eating your own Dog Food",
6
+ "url": "https://blog.datacite.org/eating-your-own-dog-food/",
7
+ "author": [{
8
+ "@type": ["Person"],
9
+ "@id": "https://orcid.org/0000-0003-1419-2405",
10
+ "givenName": "Martin",
11
+ "familyName": "Fenner",
12
+ "name": "Martin Fenner",
13
+ "affiliation": "DataCite"
14
+ }],
15
+ "publisher": {
16
+ "@type": "Organization",
17
+ "name": "DataCite"
18
+ },
19
+ "dateCreated": "2016-12-20",
20
+ "datePublished": "2016-12-20",
21
+ "dateModified": "2016-12-20",
22
+ "keywords": "datacite, doi, metadata, featured",
23
+ "version": "1.0",
24
+ "description": "Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...",
25
+ "license": "https://creativecommons.org/licenses/by/4.0/",
26
+ "image": "/images/2016/12/230785.jpg",
27
+ "isPartOf": {
28
+ "@type": "Blog",
29
+ "@id": "https://doi.org/10.5438/0000-00SS",
30
+ "name": "DataCite Blog"
31
+ },
32
+ "citation": [{
33
+ "@type": "CreativeWork",
34
+ "@id": "https://doi.org/10.5438/0012"
35
+ },
36
+ {
37
+ "@type": "CreativeWork",
38
+ "@id": "https://doi.org/10.5438/55E5-T5C0"
39
+ }
40
+ ]
41
+ }
@@ -42,6 +42,24 @@ describe Bolognese::Metadata, vcr: true do
42
42
  expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
43
43
  end
44
44
 
45
+ it "BlogPosting with type as array" do
46
+ input = fixture_path + 'schema_org_type_as_array.json'
47
+ subject = Bolognese::Metadata.new(input: input)
48
+ #expect(subject.valid?).to be true
49
+ expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/4k3m-nyvg", "identifierType"=>"DOI"}])
50
+ expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
51
+ expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
52
+ expect(subject.creators).to eq([{"affiliation"=>"DataCite","familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin", "nameIdentifiers"=> [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "nameType"=>"Personal"}])
53
+ expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}])
54
+ expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food")
55
+ expect(subject.subjects).to eq([{"subject"=>"datacite"}, {"subject"=>"doi"}, {"subject"=>"metadata"}, {"subject"=>"featured"}])
56
+ expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Issued"}, {"date"=>"2016-12-20", "dateType"=>"Created"}, {"date"=>"2016-12-20", "dateType"=>"Updated"}])
57
+ expect(subject.publication_year).to eq("2016")
58
+ expect(subject.related_identifiers.length).to eq(3)
59
+ expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.5438/55e5-t5c0", "relatedIdentifierType"=>"DOI", "relationType"=>"References")
60
+ expect(subject.publisher).to eq("DataCite")
61
+ end
62
+
45
63
  it "zenodo" do
46
64
  input = "https://www.zenodo.org/record/1196821"
47
65
  subject = Bolognese::Metadata.new(input: input, from: "schema_org")
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.2.15
4
+ version: 1.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Fenner
@@ -739,6 +739,7 @@ files:
739
739
  - spec/fixtures/schema_org_list.json
740
740
  - spec/fixtures/schema_org_tdl_iodp_invalid_authors.json
741
741
  - spec/fixtures/schema_org_topmed.json
742
+ - spec/fixtures/schema_org_type_as_array.json
742
743
  - spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/default.yml
743
744
  - spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_bibtex.yml
744
745
  - spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_citation.yml