serrano 0.3.6 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +28 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +50 -0
- data/.rubocop_todo.yml +105 -0
- data/CHANGELOG.md +33 -0
- data/{CONDUCT.md → CODE_OF_CONDUCT.md} +2 -2
- data/Gemfile +2 -0
- data/Gemfile.lock +56 -38
- data/LICENSE +1 -1
- data/README.md +35 -7
- data/Rakefile +26 -18
- data/bin/serrano +96 -98
- data/lib/serrano.rb +194 -77
- data/lib/serrano/cn.rb +7 -9
- data/lib/serrano/cnrequest.rb +42 -28
- data/lib/serrano/error.rb +2 -0
- data/lib/serrano/faraday.rb +15 -14
- data/lib/serrano/filterhandler.rb +13 -15
- data/lib/serrano/filters.rb +91 -78
- data/lib/serrano/helpers/configuration.rb +2 -2
- data/lib/serrano/request.rb +46 -39
- data/lib/serrano/request_cursor.rb +66 -59
- data/lib/serrano/styles.rb +14 -9
- data/lib/serrano/utils.rb +21 -14
- data/lib/serrano/version.rb +3 -1
- data/serrano.gemspec +33 -20
- metadata +87 -69
- data/.travis.yml +0 -8
- data/lib/serrano/constants.rb +0 -36
- data/lib/serrano/cursor_testing.rb +0 -52
data/lib/serrano/cn.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'serrano/version'
|
4
|
+
require 'serrano/cnrequest'
|
3
5
|
|
4
6
|
##
|
5
7
|
# ContentNegotiation - Content Negotiation class
|
6
8
|
#
|
7
|
-
# @see
|
9
|
+
# @see https://citation.crosscite.org/docs.html for details
|
8
10
|
module Serrano
|
9
|
-
|
10
11
|
class ContentNegotiation
|
11
|
-
|
12
12
|
attr_accessor :ids
|
13
13
|
attr_accessor :format
|
14
14
|
attr_accessor :style
|
15
15
|
attr_accessor :locale
|
16
16
|
|
17
|
-
def initialize(ids, format =
|
17
|
+
def initialize(ids, format = 'bibtex', style = 'apa', locale = 'en-US')
|
18
18
|
self.ids = ids
|
19
19
|
self.format = format
|
20
20
|
self.style = style
|
@@ -22,9 +22,7 @@ module Serrano
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def cn
|
25
|
-
CNRequest.new(
|
25
|
+
CNRequest.new(ids, format, style, locale).perform
|
26
26
|
end
|
27
|
-
|
28
27
|
end
|
29
|
-
|
30
28
|
end
|
data/lib/serrano/cnrequest.rb
CHANGED
@@ -1,23 +1,39 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
require 'faraday_middleware'
|
5
|
+
require 'multi_json'
|
6
|
+
require 'serrano/error'
|
6
7
|
require 'serrano/utils'
|
7
8
|
require 'serrano/helpers/configuration'
|
8
9
|
|
10
|
+
CN_FORMAT_HEADERS = { 'rdf-xml' => 'application/rdf+xml',
|
11
|
+
'turtle' => 'text/turtle',
|
12
|
+
'citeproc-json' => 'transform/application/vnd.citationstyles.csl+json',
|
13
|
+
'text' => 'text/x-bibliography',
|
14
|
+
'ris' => 'application/x-research-info-systems',
|
15
|
+
'bibtex' => 'application/x-bibtex',
|
16
|
+
'crossref-xml' => 'application/vnd.crossref.unixref+xml',
|
17
|
+
'datacite-xml' => 'application/vnd.datacite.datacite+xml',
|
18
|
+
'bibentry' => 'application/x-bibtex',
|
19
|
+
'crossref-tdm' => 'application/vnd.crossref.unixsd+xml' }.freeze
|
20
|
+
|
9
21
|
##
|
10
22
|
# Serrano::CNRequest
|
11
23
|
#
|
12
24
|
# Class to perform HTTP requests to the Crossref API
|
13
25
|
module Serrano
|
14
26
|
class CNRequest #:nodoc:
|
15
|
-
|
16
27
|
attr_accessor :ids
|
17
28
|
attr_accessor :format
|
18
29
|
attr_accessor :style
|
19
30
|
attr_accessor :locale
|
20
31
|
|
32
|
+
CN_FORMATS = %w[rdf-xml turtle citeproc-json
|
33
|
+
citeproc-json-ish text ris bibtex
|
34
|
+
crossref-xml datacite-xml bibentry
|
35
|
+
crossref-tdm].freeze
|
36
|
+
|
21
37
|
def initialize(ids, format, style, locale)
|
22
38
|
self.ids = ids
|
23
39
|
self.format = format
|
@@ -26,54 +42,52 @@ module Serrano
|
|
26
42
|
end
|
27
43
|
|
28
44
|
def perform
|
29
|
-
|
30
|
-
raise
|
45
|
+
unless CN_FORMATS.include? format
|
46
|
+
raise 'format not one of accepted types'
|
31
47
|
end
|
32
48
|
|
33
|
-
|
49
|
+
conn = Faraday.new 'https://doi.org/' do |c|
|
34
50
|
c.use FaradayMiddleware::FollowRedirects
|
35
51
|
c.adapter :net_http
|
36
52
|
end
|
37
53
|
|
38
|
-
if
|
39
|
-
|
40
|
-
|
41
|
-
end
|
42
|
-
return make_request(self.ids, self.format, self.style, self.locale)
|
54
|
+
if ids.length == 1
|
55
|
+
self.ids = ids[0] if ids.class == Array
|
56
|
+
make_request(conn, ids, format, style, locale)
|
43
57
|
else
|
44
58
|
coll = []
|
45
|
-
Array(
|
46
|
-
coll << make_request(x,
|
59
|
+
Array(ids).each do |x|
|
60
|
+
coll << make_request(conn, x, format, style, locale)
|
47
61
|
end
|
48
|
-
|
62
|
+
coll
|
49
63
|
end
|
50
64
|
end
|
51
65
|
end
|
52
66
|
end
|
53
67
|
|
54
|
-
def make_request(ids, format, style, locale)
|
55
|
-
type =
|
68
|
+
def make_request(conn, ids, format, style, locale)
|
69
|
+
type = CN_FORMAT_HEADERS.select { |x, _| x.include? format }.values[0]
|
56
70
|
|
57
|
-
if format ==
|
58
|
-
endpt =
|
59
|
-
cr_works = Faraday.new(:
|
71
|
+
if format == 'citeproc-json'
|
72
|
+
endpt = 'https://api.crossref.org/works/' + ids + '/' + type
|
73
|
+
cr_works = Faraday.new(url: endpt)
|
60
74
|
cr_works.headers[:user_agent] = make_ua
|
61
|
-
cr_works.headers[
|
75
|
+
cr_works.headers['X-USER-AGENT'] = make_ua
|
62
76
|
res = cr_works.get
|
63
77
|
else
|
64
|
-
if format ==
|
65
|
-
type = type +
|
78
|
+
if format == 'text'
|
79
|
+
type = type + '; style = ' + style + '; locale = ' + locale
|
66
80
|
end
|
67
81
|
|
68
|
-
res =
|
82
|
+
res = conn.get do |req|
|
69
83
|
req.url ids
|
70
84
|
req.headers['Accept'] = type
|
71
85
|
req.headers[:user_agent] = make_ua
|
72
|
-
req.headers[
|
86
|
+
req.headers['X-USER-AGENT'] = make_ua
|
73
87
|
end
|
74
88
|
end
|
75
89
|
|
76
|
-
|
90
|
+
res.body
|
77
91
|
end
|
78
92
|
|
79
93
|
# parser <- cn_types[[self.format]]
|
data/lib/serrano/error.rb
CHANGED
data/lib/serrano/faraday.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'faraday'
|
2
4
|
require 'multi_json'
|
3
5
|
|
@@ -13,13 +15,13 @@ module FaradayMiddleware
|
|
13
15
|
when 404
|
14
16
|
raise Serrano::NotFound, error_message_400(response)
|
15
17
|
when 500
|
16
|
-
raise Serrano::InternalServerError, error_message_500(response,
|
18
|
+
raise Serrano::InternalServerError, error_message_500(response, 'Something is technically wrong.')
|
17
19
|
when 502
|
18
|
-
raise Serrano::BadGateway, error_message_500(response,
|
20
|
+
raise Serrano::BadGateway, error_message_500(response, 'The server returned an invalid or incomplete response.')
|
19
21
|
when 503
|
20
|
-
raise Serrano::ServiceUnavailable, error_message_500(response,
|
22
|
+
raise Serrano::ServiceUnavailable, error_message_500(response, 'Crossref is rate limiting your requests.')
|
21
23
|
when 504
|
22
|
-
raise Serrano::GatewayTimeout, error_message_500(response,
|
24
|
+
raise Serrano::GatewayTimeout, error_message_500(response, '504 Gateway Time-out')
|
23
25
|
end
|
24
26
|
end
|
25
27
|
end
|
@@ -32,16 +34,16 @@ module FaradayMiddleware
|
|
32
34
|
private
|
33
35
|
|
34
36
|
def error_message_400(response)
|
35
|
-
"\n #{response[:method].to_s.upcase} #{response[:url]
|
37
|
+
"\n #{response[:method].to_s.upcase} #{response[:url]}\n Status #{response[:status]}#{error_body(response[:body])}"
|
36
38
|
end
|
37
39
|
|
38
40
|
def error_body(body)
|
39
|
-
if
|
40
|
-
if
|
41
|
+
if !body.nil? && !body.empty? && body.is_a?(String)
|
42
|
+
if json?(body)
|
41
43
|
body = ::MultiJson.load(body)
|
42
44
|
if body['message'].nil?
|
43
45
|
body = nil
|
44
|
-
|
46
|
+
elseif body['message'].length == 1
|
45
47
|
body = body['message']
|
46
48
|
else
|
47
49
|
body = body['message'].collect { |x| x['message'] }.join('; ')
|
@@ -56,16 +58,15 @@ module FaradayMiddleware
|
|
56
58
|
end
|
57
59
|
end
|
58
60
|
|
59
|
-
def error_message_500(response, body=nil)
|
60
|
-
"#{response[:method].to_s.upcase} #{response[:url]
|
61
|
+
def error_message_500(response, body = nil)
|
62
|
+
"#{response[:method].to_s.upcase} #{response[:url]}: #{[response[:status].to_s + ':', body].compact.join(' ')}"
|
61
63
|
end
|
62
64
|
|
63
|
-
def
|
65
|
+
def json?(string)
|
64
66
|
MultiJson.load(string)
|
65
|
-
|
67
|
+
true
|
66
68
|
rescue MultiJson::ParseError
|
67
|
-
|
69
|
+
false
|
68
70
|
end
|
69
|
-
|
70
71
|
end
|
71
72
|
end
|
@@ -1,18 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# helper functions
|
2
4
|
module Helpers
|
3
|
-
|
4
|
-
$others = ['license_url','license_version','license_delay','full_text_version','full_text_type',
|
5
|
-
'award_number','award_funder']
|
6
|
-
|
7
5
|
def filter_handler(x = nil)
|
6
|
+
others = %w[license_url license_version license_delay full_text_version full_text_type
|
7
|
+
award_number award_funder]
|
8
8
|
if x.nil?
|
9
9
|
nil
|
10
10
|
else
|
11
11
|
x = stringify(x)
|
12
|
-
nn = x.keys.collect
|
13
|
-
if nn.collect{ |w|
|
14
|
-
nn = nn.collect
|
15
|
-
if
|
12
|
+
nn = x.keys.collect(&:to_s)
|
13
|
+
if nn.collect { |w| others.include? w }.any?
|
14
|
+
nn = nn.collect do |b|
|
15
|
+
if others.include? b
|
16
16
|
case b
|
17
17
|
when 'license_url'
|
18
18
|
'license.url'
|
@@ -32,24 +32,23 @@ module Helpers
|
|
32
32
|
else
|
33
33
|
b
|
34
34
|
end
|
35
|
-
|
35
|
+
end
|
36
36
|
end
|
37
37
|
|
38
|
-
newnn = nn.collect{ |m| m.
|
38
|
+
newnn = nn.collect { |m| m.tr('_', '-') }
|
39
39
|
x = rename_keys(x, newnn)
|
40
|
-
x = x.collect{ |k,v| [k, v].join(
|
41
|
-
|
40
|
+
x = x.collect { |k, v| [k, v].join(':') }.join(',')
|
41
|
+
x
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
def stringify(x)
|
46
|
-
(x.keys.map{ |k,
|
46
|
+
(x.keys.map { |k, _v| k.to_s }.zip x.values).to_h
|
47
47
|
end
|
48
48
|
|
49
49
|
def rename_keys(x, y)
|
50
50
|
(y.zip x.values).to_h
|
51
51
|
end
|
52
|
-
|
53
52
|
end
|
54
53
|
|
55
54
|
module Serrano
|
@@ -61,4 +60,3 @@ module Serrano
|
|
61
60
|
include Helpers
|
62
61
|
end
|
63
62
|
end
|
64
|
-
|
data/lib/serrano/filters.rb
CHANGED
@@ -1,87 +1,100 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#
|
4
|
-
# Information on Crossref API filters
|
5
|
-
#
|
6
|
-
# @example
|
7
|
-
# # List filter names
|
8
|
-
# Serrano::Filters.names
|
9
|
-
# # List filter values and description
|
10
|
-
# Serrano::Filters.filters
|
11
|
-
# Serrano::Filters.filters['has_funder']
|
12
|
-
# Serrano::Filters.filters['has_funder']['description']
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
13
3
|
module Serrano
|
4
|
+
def self.filters
|
5
|
+
Filters
|
6
|
+
end
|
7
|
+
|
8
|
+
##
|
9
|
+
# Serrano::Filters
|
10
|
+
#
|
11
|
+
# Information on Crossref API filters
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# require 'serrano'
|
15
|
+
# # List filter names
|
16
|
+
# Serrano::Filters.names
|
17
|
+
# # List filter values and description
|
18
|
+
# Serrano::Filters.filters
|
19
|
+
# Serrano::Filters.filters['has_funder']
|
20
|
+
# Serrano::Filters.filters['has_funder']['description']
|
14
21
|
module Filters
|
15
22
|
def self.names
|
16
|
-
|
23
|
+
FILTER_DETAILS.keys
|
17
24
|
end
|
18
25
|
|
19
26
|
def self.filters
|
20
|
-
|
27
|
+
FILTER_DETAILS
|
21
28
|
end
|
29
|
+
|
30
|
+
FILTER_DETAILS = {
|
31
|
+
'has_funder' => { 'possible_values' => nil, 'description' => 'metadata which includes one or more funder entry' },
|
32
|
+
'funder' => { 'possible_values' => '{funder_id}', 'description' => 'metadata which include the {funder_id} in FundRef data' },
|
33
|
+
'location' => { 'possible_values' => '{country_name}', 'description' => 'funder records where location = {country name}. Only works on /funders route' },
|
34
|
+
'prefix' => { 'possible_values' => '{owner_prefix}', 'description' => "metadata belonging to a DOI owner prefix {owner_prefix} (e.g. '10.1016' )" },
|
35
|
+
'member' => { 'possible_values' => '{member_id}', 'description' => 'metadata belonging to a CrossRef member' },
|
36
|
+
'from_index_date' => { 'possible_values' => '{date}', 'description' => 'metadata indexed since (inclusive) {date}' },
|
37
|
+
'until_index_date' => { 'possible_values' => '{date}', 'description' => 'metadata indexed before (inclusive) {date}' },
|
38
|
+
'from_deposit_date' => { 'possible_values' => '{date}', 'description' => 'metadata last (re)deposited since (inclusive) {date}' },
|
39
|
+
'until_deposit_date' => { 'possible_values' => '{date}', 'description' => 'metadata last (re)deposited before (inclusive) {date}' },
|
40
|
+
'from_update_date' => { 'possible_values' => '{date}', 'description' => "Metadata updated since (inclusive) {date} Currently the same as 'from_deposit_date'" },
|
41
|
+
'until_update_date' => { 'possible_values' => '{date}', 'description' => "Metadata updated before (inclusive) {date} Currently the same as 'until_deposit_date'" },
|
42
|
+
'from_created_date' => { 'possible_values' => '{date}', 'description' => 'metadata first deposited since (inclusive) {date}' },
|
43
|
+
'until_created_date' => { 'possible_values' => '{date}', 'description' => 'metadata first deposited before (inclusive) {date}' },
|
44
|
+
'from_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where published date is since (inclusive) {date}' },
|
45
|
+
'until_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where published date is before (inclusive) {date}' },
|
46
|
+
'from_online_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where online published date is since (inclusive) {date}' },
|
47
|
+
'until_online_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where online published date is before (inclusive) {date}' },
|
48
|
+
'from_print_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where print published date is since (inclusive) {date}' },
|
49
|
+
'until_print_pub_date' => { 'possible_values' => '{date}', 'description' => 'metadata where print published date is before (inclusive) {date}' },
|
50
|
+
'from_posted_date' => { 'possible_values' => '{date}', 'description' => 'metadata where posted date is since (inclusive) {date}' },
|
51
|
+
'until_posted_date' => { 'possible_values' => '{date}', 'description' => 'metadata where posted date is before (inclusive) {date}' },
|
52
|
+
'from_accepted_date' => { 'possible_values' => '{date}', 'description' => 'metadata where accepted date is since (inclusive) {date}' },
|
53
|
+
'until_accepted_date' => { 'possible_values' => '{date}', 'description' => 'metadata where accepted date is before (inclusive) {date}' },
|
54
|
+
'has_license' => { 'possible_values' => nil, 'description' => "metadata that includes any '<license_ref>' elements" },
|
55
|
+
'license_url' => { 'possible_values' => '{url}', 'description' => "metadata where '<license_ref>' value equals {url}" },
|
56
|
+
'license_version' => { 'possible_values' => '{string}', 'description' => "metadata where the '<license_ref>''s 'applies_to' attribute is '{string}'" },
|
57
|
+
'license_delay' => { 'possible_values' => '{integer}', 'description' => "metadata where difference between publication date and the '<license_ref>''s 'start_date' attribute is <= '{integer}' (in days" },
|
58
|
+
'has_full_text' => { 'possible_values' => nil, 'description' => "metadata that includes any full text '<resource>' elements_" },
|
59
|
+
'full_text_version' => { 'possible_values' => '{string}', 'description' => "metadata where '<resource>' element's 'content_version' attribute is '{string}'" },
|
60
|
+
'full_text_type' => { 'possible_values' => '{mime_type}', 'description' => "metadata where '<resource>' element's 'content_type' attribute is '{mime_type}' (e.g. 'application/pdf')" },
|
61
|
+
'full_text_application' => { 'possible_values' => '{string}', 'description' => 'metadata where <resource> link has one of the following intended applications: text-mining, similarity-checking or unspecified' },
|
62
|
+
'has_references' => { 'possible_values' => nil, 'description' => 'metadata for works that have a list of references' },
|
63
|
+
'has_archive' => { 'possible_values' => nil, 'description' => 'metadata which include name of archive partner' },
|
64
|
+
'archive' => { 'possible_values' => '{string}', 'description' => "metadata which where value of archive partner is '{string}'" },
|
65
|
+
'has_orcid' => { 'possible_values' => nil, 'description' => 'metadata which includes one or more ORCIDs' },
|
66
|
+
'has_authenticated_orcid' => { 'possible_values' => nil, 'description' => 'metadata which includes one or more ORCIDs where the depositing publisher claims to have witness the ORCID owner authenticate with ORCID' },
|
67
|
+
'orcid' => { 'possible_values' => '{orcid}', 'description' => "metadata where '<orcid>' element's value = '{orcid}'" },
|
68
|
+
'issn' => { 'possible_values' => '{issn}', 'description' => "metadata where record has an ISSN = '{issn}' Format is 'xxxx_xxxx'." },
|
69
|
+
'directory' => { 'possible_values' => '{directory}', 'description' => "metadata records whose article or serial are mentioned in the given '{directory}'. Currently the only supported value is 'doaj'" },
|
70
|
+
'doi' => { 'possible_values' => '{doi}', 'description' => "metadata describing the DOI '{doi}'" },
|
71
|
+
'updates' => { 'possible_values' => '{doi}', 'description' => "metadata for records that represent editorial updates to the DOI '{doi}'" },
|
72
|
+
'is_update' => { 'possible_values' => nil, 'description' => 'metadata for records that represent editorial updates' },
|
73
|
+
'has_update_policy' => { 'possible_values' => nil, 'description' => 'metadata for records that include a link to an editorial update policy' },
|
74
|
+
'container_title' => { 'possible_values' => nil, 'description' => 'metadata for records with a publication title exactly with an exact match' },
|
75
|
+
'category_name' => { 'possible_values' => nil, 'description' => 'metadata for records with an exact matching category label' },
|
76
|
+
'type' => { 'possible_values' => '{type}', 'description' => "metadata records whose type = '{type}' Type must be an ID value from the list of types returned by the '/types' resource" },
|
77
|
+
'type_name' => { 'possible_values' => nil, 'description' => 'metadata for records with an exacty matching type label' },
|
78
|
+
'award_number' => { 'possible_values' => '{award_number}', 'description' => "metadata for records with a matching award nunber_ Optionally combine with 'award_funder'" },
|
79
|
+
'award_funder' => { 'possible_values' => '{funder doi or id}', 'description' => "metadata for records with an award with matching funder. Optionally combine with 'award_number'" },
|
80
|
+
'has_assertion' => { 'possible_values' => nil, 'description' => 'metadata for records with any assertions' },
|
81
|
+
'assertion_group' => { 'possible_values' => nil, 'description' => 'metadata for records with an assertion in a particular group' },
|
82
|
+
'assertion' => { 'possible_values' => nil, 'description' => 'metadata for records with a particular named assertion' },
|
83
|
+
'has_affiliation' => { 'possible_values' => nil, 'description' => 'metadata for records that have any affiliation information' },
|
84
|
+
'alternative_id' => { 'possible_values' => nil, 'description' => 'metadata for records with the given alternative ID, which may be a publisher_specific ID, or any other identifier a publisher may have provided' },
|
85
|
+
'article_number' => { 'possible_values' => nil, 'description' => 'metadata for records with a given article number' },
|
86
|
+
'has_abstract' => { 'possible_values' => nil, 'description' => 'metadata for records which include an abstract' },
|
87
|
+
'has_clinical_trial_number' => { 'possible_values' => nil, 'description' => 'metadata for records which include a clinical trial number' },
|
88
|
+
'content_domain' => { 'possible_values' => nil, 'description' => 'metadata where the publisher records a particular domain name as the location Crossmark content will appear' },
|
89
|
+
'has_content_domain' => { 'possible_values' => nil, 'description' => 'metadata where the publisher records a domain name location for Crossmark content' },
|
90
|
+
'has_crossmark_restriction' => { 'possible_values' => nil, 'description' => 'metadata where the publisher restricts Crossmark usage to content domains' },
|
91
|
+
'has_relation' => { 'possible_values' => nil, 'description' => 'metadata for records that either assert or are the object of a relation' },
|
92
|
+
'relation_type' => { 'possible_values' => nil, 'description' => 'One of the relation types from the Crossref relations schema (e.g. is-referenced-by, is-parent-of, is-preprint-of)' },
|
93
|
+
'relation_object' => { 'possible_values' => nil, 'description' => 'Relations where the object identifier matches the identifier provided' },
|
94
|
+
'relation_object_type' => { 'possible_values' => nil, 'description' => 'One of the identifier types from the Crossref relations schema (e.g. doi, issn)' },
|
95
|
+
'public_references' => { 'possible_values' => nil, 'description' => 'metadata where publishers allow references to be distributed publically' },
|
96
|
+
'publisher_name' => { 'possible_values' => nil, 'description' => 'metadata for records with an exact matching publisher name' },
|
97
|
+
'affiliation' => { 'possible_values' => nil, 'description' => 'metadata for records with at least one contributor with the given affiliation' }
|
98
|
+
}.freeze
|
22
99
|
end
|
23
100
|
end
|
24
|
-
|
25
|
-
$filter_list = [
|
26
|
-
'has_funder','funder','prefix','member','from_index_date','until_index_date',
|
27
|
-
'from_deposit_date','until_deposit_date','from_update_date','until_update_date',
|
28
|
-
'from_first_deposit_date','until_first_deposit_date','from_pub_date','until_pub_date',
|
29
|
-
'has_license','license_url','license_version','license_delay','has_full_text',
|
30
|
-
'full_text_version','full_text_type','public_references','has_references','has_archive',
|
31
|
-
'archive','has_orcid','orcid','issn','type','directory','doi','updates','is_update',
|
32
|
-
'has_update_policy','container_title','publisher_name','category_name','type_name',
|
33
|
-
'from_created_date', 'until_created_date', 'affiliation', 'has_affiliation',
|
34
|
-
'assertion_group', 'assertion', 'article_number', 'alternative_id',
|
35
|
-
'has_clinical_trial_number', 'has_abstract'
|
36
|
-
]
|
37
|
-
|
38
|
-
$filter_details = {
|
39
|
-
"has_funder" => { "possible_values" => nil, "description" => "metadata which includes one or more funder entry" },
|
40
|
-
"funder" => { "possible_values" => "{funder_id}", "description" => "metadata which include the {funder_id} in FundRef data" },
|
41
|
-
"prefix" => { "possible_values" => "{owner_prefix}", "description" => "metadata belonging to a DOI owner prefix {owner_prefix} (e.g. '10.1016' )" },
|
42
|
-
"member" => { "possible_values" => "{member_id}", "description" => "metadata belonging to a CrossRef member" },
|
43
|
-
"from_index_date" => { "possible_values" => '{date}', "description" => "metadata indexed since (inclusive) {date}" },
|
44
|
-
"until_index_date" => { "possible_values" => '{date}', "description" => "metadata indexed before (inclusive) {date}" },
|
45
|
-
"from_deposit_date" => { "possible_values" => '{date}', "description" => "metadata last (re)deposited since (inclusive) {date}" },
|
46
|
-
"until_deposit_date" => { "possible_values" => '{date}', "description" => "metadata last (re)deposited before (inclusive) {date}" },
|
47
|
-
"from_update_date" => { "possible_values" => '{date}', "description" => "Metadata updated since (inclusive) {date} Currently the same as 'from_deposit_date'" },
|
48
|
-
"until_update_date" => { "possible_values" => '{date}', "description" => "Metadata updated before (inclusive) {date} Currently the same as 'until_deposit_date'" },
|
49
|
-
"from_created_date" => { "possible_values" => '{date}', "description" => "metadata first deposited since (inclusive) {date}" },
|
50
|
-
"until_created_date" => { "possible_values" => '{date}', "description" => "metadata first deposited before (inclusive) {date}" },
|
51
|
-
"from_pub_date" => { "possible_values" => '{date}', "description" => "metadata where published date is since (inclusive) {date}" },
|
52
|
-
"until_pub_date" => { "possible_values" => '{date}', "description" => "metadata where published date is before (inclusive) {date}" },
|
53
|
-
"has_license" => { "possible_values" => nil, "description" => "metadata that includes any '<license_ref>' elements" },
|
54
|
-
"license_url" => { "possible_values" => '{url}', "description" => "metadata where '<license_ref>' value equals {url}" },
|
55
|
-
"license_version" => { "possible_values" => '{string}', "description" => "metadata where the '<license_ref>''s 'applies_to' attribute is '{string}'"},
|
56
|
-
"license_delay" => { "possible_values" => "{integer}", "description" => "metadata where difference between publication date and the '<license_ref>''s 'start_date' attribute is <= '{integer}' (in days"},
|
57
|
-
"has_full_text" => { "possible_values" => nil, "description" => "metadata that includes any full text '<resource>' elements_" },
|
58
|
-
"full_text_version" => { "possible_values" => '{string}' , "description" => "metadata where '<resource>' element's 'content_version' attribute is '{string}'" },
|
59
|
-
"full_text_type" => { "possible_values" => '{mime_type}' , "description" => "metadata where '<resource>' element's 'content_type' attribute is '{mime_type}' (e.g. 'application/pdf')" },
|
60
|
-
"public_references" => { "possible_values" => nil, "description" => "metadata where publishers allow references to be distributed publically" },
|
61
|
-
"has_references" => { "possible_values" => nil , "description" => "metadata for works that have a list of references" },
|
62
|
-
"has_archive" => { "possible_values" => nil , "description" => "metadata which include name of archive partner" },
|
63
|
-
"archive" => { "possible_values" => '{string}', "description" => "metadata which where value of archive partner is '{string}'" },
|
64
|
-
"has_orcid" => { "possible_values" => nil, "description" => "metadata which includes one or more ORCIDs" },
|
65
|
-
"orcid" => { "possible_values" => '{orcid}', "description" => "metadata where '<orcid>' element's value = '{orcid}'" },
|
66
|
-
"issn" => { "possible_values" => '{issn}', "description" => "metadata where record has an ISSN = '{issn}' Format is 'xxxx_xxxx'." },
|
67
|
-
"type" => { "possible_values" => '{type}', "description" => "metadata records whose type = '{type}' Type must be an ID value from the list of types returned by the '/types' resource" },
|
68
|
-
"directory" => { "possible_values" => "{directory}", "description" => "metadata records whose article or serial are mentioned in the given '{directory}'. Currently the only supported value is 'doaj'" },
|
69
|
-
"doi" => { "possible_values" => '{doi}', "description" => "metadata describing the DOI '{doi}'" },
|
70
|
-
"updates" => { "possible_values" => '{doi}', "description" => "metadata for records that represent editorial updates to the DOI '{doi}'" },
|
71
|
-
"is_update" => { "possible_values" => nil, "description" => "metadata for records that represent editorial updates" },
|
72
|
-
"has_update_policy" => { "possible_values" => nil, "description" => "metadata for records that include a link to an editorial update policy" },
|
73
|
-
"container_title" => { "possible_values" => nil, "description" => "metadata for records with a publication title exactly with an exact match" },
|
74
|
-
"publisher_name" => { "possible_values" => nil, "description" => "metadata for records with an exact matching publisher name" },
|
75
|
-
"category_name" => { "possible_values" => nil, "description" => "metadata for records with an exact matching category label" },
|
76
|
-
"type_name" => { "possible_values" => nil, "description" => "metadata for records with an exacty matching type label" },
|
77
|
-
"award_number" => { "possible_values" => "{award_number}", "description" => "metadata for records with a matching award nunber_ Optionally combine with 'award_funder'" },
|
78
|
-
"award_funder" => { "possible_values" => '{funder doi or id}', "description" => "metadata for records with an award with matching funder. Optionally combine with 'award_number'" },
|
79
|
-
"assertion_group" => { "possible_values" => nil, "description" => "metadata for records with an assertion in a particular group" },
|
80
|
-
"assertion" => { "possible_values" => nil, "description" => "metadata for records with a particular named assertion" },
|
81
|
-
"affiliation" => { "possible_values" => nil, "description" => "metadata for records with at least one contributor with the given affiliation" },
|
82
|
-
"has_affiliation" => { "possible_values" => nil, "description" => "metadata for records that have any affiliation information" },
|
83
|
-
"alternative_id" => { "possible_values" => nil, "description" => "metadata for records with the given alternative ID, which may be a publisher_specific ID, or any other identifier a publisher may have provided" },
|
84
|
-
"article_number" => { "possible_values" => nil, "description" => "metadata for records with a given article number" },
|
85
|
-
"has_clinical_trial_number" => { "possible_values" => nil, "description" => "metadata for records which include a clinical trial number" },
|
86
|
-
"has_abstract" => { "possible_values" => nil, "description" => "metadata for records which include an abstract" }
|
87
|
-
}
|