Skip to content

Commit

Permalink
support schemeURI for names. datacite/bolognese#56
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Mar 12, 2019
1 parent 730ec66 commit 7302710
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ GEM
latex-decode (~> 0.0)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bolognese (1.1.7)
bolognese (1.1.8)
activesupport (>= 4.2.5, < 6)
benchmark_methods (~> 0.7)
bibtex-ruby (~> 4.1)
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,9 @@ def safe_params
:should_validate,
:client,
:creators,
{ creators: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme] }, :name, :givenName, :familyName, :affiliation] },
{ creators: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme, :schemeUri] }, :name, :givenName, :familyName, :affiliation] },
:contributors,
{ contributors: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme] }, :name, :givenName, :familyName, :affiliation, :contributorType] },
{ contributors: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme, :schemeUri] }, :name, :givenName, :familyName, :affiliation, :contributorType] },
:identifiers,
{ identifiers: [:identifier, :identifierType] },
:relatedIdentifiers,
Expand Down
6 changes: 4 additions & 2 deletions app/models/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ def after_audit
nameType: { type: :keyword },
nameIdentifiers: { type: :object, properties: {
nameIdentifier: { type: :keyword },
nameIdentifierScheme: { type: :keyword }
nameIdentifierScheme: { type: :keyword },
schemeUri: { type: :keyword }
}},
name: { type: :text },
givenName: { type: :text },
Expand All @@ -45,7 +46,8 @@ def after_audit
nameType: { type: :keyword },
nameIdentifiers: { type: :object, properties: {
nameIdentifier: { type: :keyword },
nameIdentifierScheme: { type: :keyword }
nameIdentifierScheme: { type: :keyword },
schemeUri: { type: :keyword }
}},
name: { type: :text },
givenName: { type: :text },
Expand Down
6 changes: 4 additions & 2 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ class Doi < ActiveRecord::Base
nameType: { type: :keyword },
nameIdentifiers: { type: :object, properties: {
nameIdentifier: { type: :keyword },
nameIdentifierScheme: { type: :keyword }
nameIdentifierScheme: { type: :keyword },
schemeUri: { type: :keyword }
}},
name: { type: :text },
givenName: { type: :text },
Expand All @@ -116,7 +117,8 @@ class Doi < ActiveRecord::Base
nameType: { type: :keyword },
nameIdentifiers: { type: :object, properties: {
nameIdentifier: { type: :keyword },
nameIdentifierScheme: { type: :keyword }
nameIdentifierScheme: { type: :keyword },
schemeUri: { type: :keyword }
}},
name: { type: :text },
givenName: { type: :text },
Expand Down
6 changes: 5 additions & 1 deletion config/initializers/_version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
module Lupo
class Application
g = Git.open(Rails.root, :log => Logger.new(STDOUT))
VERSION = g.tags.map { |t| Gem::Version.new(t.name) }.sort.last.to_s
begin
VERSION = g.tags.map { |t| Gem::Version.new(t.name) }.sort.last.to_s
rescue ArgumentError
VERSION = "1.0"
end
REVISION = g.object('HEAD').sha
end
end
4 changes: 4 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,8 @@ components:
type: string
nameIdentifierScheme:
type: string
schemeUri:
type: string
name:
type: string
givenName:
Expand Down Expand Up @@ -973,6 +975,8 @@ components:
type: string
nameIdentifierScheme:
type: string
schemeUri:
type: string
name:
type: string
givenName:
Expand Down
10 changes: 5 additions & 5 deletions spec/concerns/crosscitable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
expect(meta["creators"]).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin","name"=>"Fenner, Martin",
"nameIdentifiers"=>
[{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405",
"nameIdentifierScheme"=>"ORCID"}],
"nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}],
"nameType"=>"Personal"}])
expect(meta["titles"]).to eq([{"title"=>"Eating your own Dog Food"}])
expect(meta["publication_year"]).to eq("2016")
Expand Down Expand Up @@ -297,7 +297,7 @@
"familyName" => "Jones",
"givenName" => "Matt",
"name" => "Jones, Matt",
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID"}],
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}],
"nameType" => "Personal")
expect(meta["titles"]).to eq([{"title"=>"R Interface to the DataONE REST API"}])
expect(meta["publication_year"]).to eq("2016")
Expand All @@ -313,7 +313,7 @@
expect(meta["doi"]).to eq("10.5438/4k3m-nyvg")
expect(meta["creators"].length).to eq(1)
expect(meta["creators"].first).to eq("familyName"=>"Fenner", "givenName"=>"Martin", "name" => "Fenner, Martin",
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID"}],
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}],
"nameType" => "Personal")
expect(meta["titles"]).to eq([{"title"=>"Eating your own Dog Food"}])
expect(meta["publication_year"]).to eq("2016")
Expand Down Expand Up @@ -431,7 +431,7 @@
"familyName" => "Jones",
"givenName" => "Matt",
"name" => "Jones, Matt",
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID"}],
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-0077-4738", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}],
"nameType" => "Personal")
expect(meta["titles"]).to eq([{"title"=>"R Interface to the DataONE REST API"}])
expect(meta["publication_year"]).to eq("2016")
Expand All @@ -445,7 +445,7 @@
expect(meta["doi"]).to eq("10.5438/4k3m-nyvg")
expect(meta["creators"].length).to eq(1)
expect(meta["creators"].first).to eq("familyName"=>"Fenner", "givenName"=>"Martin", "name" => "Fenner, Martin",
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID"}],
"nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}],
"nameType" => "Personal")
expect(meta["titles"]).to eq([{"title"=>"Eating your own Dog Food"}])
expect(meta["publication_year"]).to eq("2016")
Expand Down
3 changes: 2 additions & 1 deletion spec/factories/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
"nameIdentifiers": [
{
"nameIdentifier": "https://orcid.org/0000-0003-1419-2405",
"nameIdentifierScheme": "ORCID"
"nameIdentifierScheme": "ORCID",
"schemeUri": "https://orcid.org"
}
]
}
Expand Down
7 changes: 4 additions & 3 deletions spec/requests/dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,8 @@
"name"=>"Fenner, Martin",
"nameIdentifiers"=>
[{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405",
"nameIdentifierScheme"=>"ORCID"}],
"nameIdentifierScheme"=>"ORCID",
"schemeUri"=>"https://orcid.org"}],
"nameType"=>"Personal"}])
expect(json.dig('data', 'attributes', 'schemaVersion')).to eq("http://datacite.org/schema/kernel-4")
expect(json.dig('data', 'attributes', 'source')).to eq("test")
Expand Down Expand Up @@ -873,7 +874,7 @@
"titles" => [{"title"=>"Eating your own Dog Food"}],
"publisher" => "DataCite",
"publicationYear" => 2016,
"creators" => [{"familyName"=>"Fenner", "givenName"=>"Martin", "nameIdentifiers"=>[{ "nameIdentifier" => "https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme" => "ORCID" }], "name"=>"Fenner, Martin", "nameType"=>"Personal"}],
"creators" => [{"familyName"=>"Fenner", "givenName"=>"Martin", "nameIdentifiers"=>[{ "nameIdentifier" => "https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme" => "ORCID", "schemeUri"=>"https://orcid.org" }], "name"=>"Fenner, Martin", "nameType"=>"Personal"}],
"source" => "test",
"event" => "publish"
}
Expand All @@ -887,7 +888,7 @@
expect(json.dig('data', 'attributes', 'url')).to eq("http://www.bl.uk/pdf/patspec.pdf")
expect(json.dig('data', 'attributes', 'doi')).to eq("10.14454/10703")
expect(json.dig('data', 'attributes', 'titles')).to eq([{"title"=>"Eating your own Dog Food"}])
expect(json.dig('data', 'attributes', 'creators')).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "nameIdentifiers"=>[{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405","nameIdentifierScheme"=>"ORCID"}], "name"=>"Fenner, Martin", "nameType"=>"Personal"}])
expect(json.dig('data', 'attributes', 'creators')).to eq([{"familyName"=>"Fenner", "givenName"=>"Martin", "nameIdentifiers"=>[{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405","nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "name"=>"Fenner, Martin", "nameType"=>"Personal"}])
expect(json.dig('data', 'attributes', 'publisher')).to eq("DataCite")
expect(json.dig('data', 'attributes', 'publicationYear')).to eq(2016)
# expect(json.dig('data', 'attributes', 'schemaVersion')).to eq("http://datacite.org/schema/kernel-4")
Expand Down

0 comments on commit 7302710

Please sign in to comment.