Skip to content

Commit

Permalink
add query support for ROR ID as nameIdentifier for creators and contr…
Browse files Browse the repository at this point in the history
…ibutors. #628
  • Loading branch information
Martin Fenner committed Sep 16, 2020
1 parent a679a78 commit 124a497
Show file tree
Hide file tree
Showing 11 changed files with 393 additions and 235 deletions.
1 change: 1 addition & 0 deletions app/controllers/datacite_dois_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def index
has_downloads: params[:has_downloads],
has_person: params[:has_person],
has_affiliation: params[:has_affiliation],
has_organization: params[:has_organization],
has_funder: params[:has_funder],
link_check_status: params[:link_check_status],
link_check_has_schema_org: params[:link_check_has_schema_org],
Expand Down
412 changes: 206 additions & 206 deletions app/graphql/schema.graphql

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion app/graphql/types/doi_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ module DoiItem
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
Expand All @@ -110,13 +112,15 @@ module DoiItem
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
Expand All @@ -136,13 +140,15 @@ module DoiItem
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
Expand All @@ -162,13 +168,15 @@ module DoiItem
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
Expand All @@ -188,13 +196,15 @@ module DoiItem
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
Expand All @@ -214,13 +224,15 @@ module DoiItem
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
Expand Down Expand Up @@ -436,7 +448,7 @@ def response(**args)
# make sure no dois are returnded if there are no :ids
args[:ids] = "999" if args[:ids].blank?

Doi.gql_query(args[:query], ids: args[:ids], funder_id: args[:funder_id], user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], affiliation_id: args[:affiliation_id], has_person: args[:has_person], has_funder: args[:has_funder], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], field_of_science: args[:field_of_science], state: "findable", page: { cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : [], size: args[:first] })
Doi.gql_query(args[:query], ids: args[:ids], funder_id: args[:funder_id], user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], affiliation_id: args[:affiliation_id], organization_id: args[:organization_id], has_person: args[:has_person], has_funder: args[:has_funder], has_affiliation: args[:has_affiliation], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], field_of_science: args[:field_of_science], state: "findable", page: { cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : [], size: args[:first] })
end

def doi_link(url)
Expand Down
11 changes: 10 additions & 1 deletion app/graphql/types/funder_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ class FunderType < BaseObject
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :has_person, Boolean, required: false
argument :license, String, required: false
argument :resource_type, String, required: false
argument :language, String, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
Expand All @@ -42,12 +44,14 @@ class FunderType < BaseObject
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :has_person, Boolean, required: false
argument :license, String, required: false
argument :resource_type, String, required: false
argument :language, String, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
Expand All @@ -66,12 +70,14 @@ class FunderType < BaseObject
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :has_person, Boolean, required: false
argument :license, String, required: false
argument :resource_type, String, required: false
argument :language, String, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
Expand All @@ -88,6 +94,7 @@ class FunderType < BaseObject
argument :published, String, required: false
argument :user_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :registration_agency, String, required: false
Expand All @@ -112,13 +119,15 @@ class FunderType < BaseObject
argument :repository_id, String, required: false
argument :member_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type_id, String, required: false
argument :resource_type, String, required: false
argument :has_person, Boolean, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
argument :has_versions, Int, required: false
Expand Down Expand Up @@ -178,6 +187,6 @@ def citation_count
end

def response(**args)
Doi.gql_query(args[:query], ids: args[:ids], funder_id: object.id, user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], resource_type: args[:resource_type], agency: args[:registration_agency], language: args[:language], license: args[:license], has_person: args[:has_person], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], field_of_science: args[:field_of_science], published: args[:published], state: "findable", page: { cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : [], size: args[:first] })
Doi.gql_query(args[:query], ids: args[:ids], funder_id: object.id, user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], affiliation_id: args[:affiliation_id], organization_id: args[:organization_id], resource_type_id: args[:resource_type_id], resource_type: args[:resource_type], agency: args[:registration_agency], language: args[:language], license: args[:license], has_person: args[:has_person], has_organization: args[:has_organization], has_affiliation: args[:has_affiliation], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], field_of_science: args[:field_of_science], published: args[:published], state: "findable", page: { cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : [], size: args[:first] })
end
end
11 changes: 10 additions & 1 deletion app/graphql/types/member_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ class MemberType < BaseObject
argument :repository_id, String, required: false
argument :funder_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :license, String, required: false
argument :resource_type, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
Expand All @@ -52,11 +54,13 @@ class MemberType < BaseObject
argument :repository_id, String, required: false
argument :funder_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :license, String, required: false
argument :resource_type, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
Expand All @@ -76,11 +80,13 @@ class MemberType < BaseObject
argument :repository_id, String, required: false
argument :funder_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :license, String, required: false
argument :resource_type, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
Expand All @@ -100,6 +106,7 @@ class MemberType < BaseObject
argument :funder_id, String, required: false
argument :repository_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :registration_agency, String, required: false
argument :resource_type, String, required: false
argument :license, String, required: false
Expand All @@ -122,12 +129,14 @@ class MemberType < BaseObject
argument :repository_id, String, required: false
argument :funder_id, String, required: false
argument :affiliation_id, String, required: false
argument :organization_id, String, required: false
argument :resource_type_id, String, required: false
argument :resource_type, String, required: false
argument :license, String, required: false
argument :language, String, required: false
argument :has_person, Boolean, required: false
argument :has_organization, Boolean, required: false
argument :has_affiliation, Boolean, required: false
argument :has_funder, Boolean, required: false
argument :has_citations, Int, required: false
argument :has_parts, Int, required: false
Expand Down Expand Up @@ -221,6 +230,6 @@ def citation_count
end

def response(**args)
Doi.gql_query(args[:query], ids: args[:ids], user_id: args[:user_id], client_id: args[:repository_id], provider_id: object.member_type == "consortium" ? nil : object.uid, consortium_id: object.member_type == "consortium" ? object.uid : nil, funder_id: args[:funder_id], affiliation_id: args[:affiliation_id], resource_type_id: args[:resource_type_id], resource_type: args[:resource_type], has_person: args[:has_person], has_funder: args[:has_funder], has_affiliation: args[:has_affiliation], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], field_of_science: args[:field_of_science], published: args[:published], language: args[:language], license: args[:license], state: "findable", page: { cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : [], size: args[:first] })
Doi.gql_query(args[:query], ids: args[:ids], user_id: args[:user_id], client_id: args[:repository_id], provider_id: object.member_type == "consortium" ? nil : object.uid, consortium_id: object.member_type == "consortium" ? object.uid : nil, funder_id: args[:funder_id], affiliation_id: args[:affiliation_id], organization_id: args[:organization_id], resource_type_id: args[:resource_type_id], resource_type: args[:resource_type], has_person: args[:has_person], has_funder: args[:has_funder], has_affiliation: args[:has_affiliation], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], field_of_science: args[:field_of_science], published: args[:published], language: args[:language], license: args[:license], state: "findable", page: { cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : [], size: args[:first] })
end
end
2 changes: 1 addition & 1 deletion app/graphql/types/organization_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,6 @@ def citation_count
end

def response(**args)
Doi.gql_query(args[:query], ids: args[:ids], affiliation_id: object.id, user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], funder_id: args[:funder_id] || object.fundref.join(","), resource_type_id: args[:resource_type_id], resource_type: args[:resource_type], agency: args[:registration_agency], language: args[:language], license: args[:license], has_person: args[:has_person], has_funder: args[:has_funder], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], field_of_science: args[:field_of_science], published: args[:published], state: "findable", page: { cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : [], size: args[:first] })
Doi.gql_query(args[:query], ids: args[:ids], affiliation_id: object.id, organization_id: object.id, user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], funder_id: args[:funder_id] || object.fundref.join(","), resource_type_id: args[:resource_type_id], resource_type: args[:resource_type], agency: args[:registration_agency], language: args[:language], license: args[:license], has_person: args[:has_person], has_funder: args[:has_funder], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], field_of_science: args[:field_of_science], published: args[:published], state: "findable", page: { cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : [], size: args[:first] })
end
end
Loading

0 comments on commit 124a497

Please sign in to comment.