diff --git a/app/controllers/datacite_dois_controller.rb b/app/controllers/datacite_dois_controller.rb index 3d09dc1ce..6d0b6213b 100644 --- a/app/controllers/datacite_dois_controller.rb +++ b/app/controllers/datacite_dois_controller.rb @@ -228,7 +228,7 @@ def index # sources = total.positive? ? facet_by_key(response.aggregations.sources.buckets) : nil subjects = facet_by_key(response.aggregations.subjects.buckets) fields_of_science = facet_by_fos( - response.aggregations.fields_of_science.subject.buckets, + response.aggregations.fields_of_science.buckets, ) certificates = facet_by_key(response.aggregations.certificates.buckets) licenses = facet_by_license(response.aggregations.licenses.buckets) diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql index 29fb47266..048162db7 100644 --- a/app/graphql/schema.graphql +++ b/app/graphql/schema.graphql @@ -186,6 +186,16 @@ type Audiovisual implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -345,7 +355,7 @@ type Audiovisual implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -495,6 +505,16 @@ type Book implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -654,7 +674,7 @@ type Book implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -759,6 +779,16 @@ type BookChapter implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -918,7 +948,7 @@ type BookChapter implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -1153,6 +1183,16 @@ type Collection implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -1312,7 +1352,7 @@ type Collection implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -1461,6 +1501,16 @@ type ConferencePaper implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -1620,7 +1670,7 @@ type ConferencePaper implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -2062,6 +2112,16 @@ type DataManagementPlan implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -2221,7 +2281,7 @@ type DataManagementPlan implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -2371,6 +2431,16 @@ type DataPaper implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -2530,7 +2600,7 @@ type DataPaper implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -2679,6 +2749,16 @@ type Dataset implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -2859,7 +2939,7 @@ type Dataset implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -3106,6 +3186,16 @@ type Dissertation implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -3265,7 +3355,7 @@ type Dissertation implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -3418,6 +3508,16 @@ interface DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -3577,7 +3677,7 @@ interface DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -3732,6 +3832,16 @@ type Event implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -3891,7 +4001,7 @@ type Event implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -4025,6 +4135,16 @@ type EventData implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -4184,7 +4304,7 @@ type EventData implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -4614,6 +4734,16 @@ type Image implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -4773,7 +4903,7 @@ type Image implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -4921,6 +5051,16 @@ type Instrument implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -5080,7 +5220,7 @@ type Instrument implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -5228,6 +5368,16 @@ type InteractiveResource implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -5387,7 +5537,7 @@ type InteractiveResource implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -5541,6 +5691,16 @@ type JournalArticle implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -5700,7 +5860,7 @@ type JournalArticle implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -6145,6 +6305,16 @@ type Model implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -6304,7 +6474,7 @@ type Model implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -6625,6 +6795,16 @@ type Other implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -6784,7 +6964,7 @@ type Other implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -6958,6 +7138,16 @@ type PeerReview implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -7117,7 +7307,7 @@ type PeerReview implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -7403,6 +7593,16 @@ type PhysicalObject implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -7562,7 +7762,7 @@ type PhysicalObject implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -7764,6 +7964,16 @@ type Preprint implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -7923,7 +8133,7 @@ type Preprint implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -8072,6 +8282,16 @@ type Publication implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -8231,7 +8451,7 @@ type Publication implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -8395,7 +8615,7 @@ type Query { work(id: ID!): Work! workflow(id: ID!): Workflow! workflows(after: String, facetCount: Int = 10, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasMember: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): WorkflowConnectionWithTotal! - works(after: String, facetCount: Int = 10, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasMember: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal! + works(after: String, facetCount: Int = 10, fieldOfScience: String, fieldOfScienceCombined: String, fieldOfScienceRepository: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasMember: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal! } """ @@ -9025,6 +9245,16 @@ type Service implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -9184,7 +9414,7 @@ type Service implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -9334,6 +9564,16 @@ type Software implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -9493,7 +9733,7 @@ type Software implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -9673,6 +9913,16 @@ type Sound implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -9832,7 +10082,7 @@ type Sound implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -10192,6 +10442,16 @@ type Work implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -10351,7 +10611,7 @@ type Work implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of @@ -10391,6 +10651,8 @@ type WorkConnectionWithTotal { """ edges: [WorkEdge] fieldsOfScience: [Facet!] + fieldsOfScienceCombined: [Facet!] + fieldsOfScienceRepository: [Facet!] languages: [Facet!] licenses: [Facet!] @@ -10506,6 +10768,16 @@ type Workflow implements DoiItem { """ fieldsOfScience: [FieldOfScience!] + """ + OECD Fields of Science of the resource and containing repository + """ + fieldsOfScienceCombined: [FieldOfScience!] + + """ + OECD Fields of Science of the containing repository + """ + fieldsOfScienceRepository: [FieldOfScience!] + """ Technical format of the resource """ @@ -10665,7 +10937,7 @@ type Workflow implements DoiItem { """ The DOI is a version of this DOI. """ - versionOf(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + versionOf(affiliationId: String, after: String, fieldOfScience: String, fieldOfScienceRepository: String, first: Int = 25, funderId: String, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasFunder: Boolean, hasOrganization: Boolean, hasParts: Int, hasPerson: Boolean, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal """ Total number of DOIs the resource is a version of diff --git a/app/graphql/types/audiovisual_connection_with_total_type.rb b/app/graphql/types/audiovisual_connection_with_total_type.rb index f8b3e4f04..778ff0019 100644 --- a/app/graphql/types/audiovisual_connection_with_total_type.rb +++ b/app/graphql/types/audiovisual_connection_with_total_type.rb @@ -75,4 +75,12 @@ def languages [] end end + + def fields_of_science + if object.aggregations.fields_of_science + facet_by_fos(object.aggregations.fields_of_science.buckets) + else + [] + end + end end diff --git a/app/graphql/types/book_chapter_connection_with_total_type.rb b/app/graphql/types/book_chapter_connection_with_total_type.rb index 33f549366..3510c0cd2 100644 --- a/app/graphql/types/book_chapter_connection_with_total_type.rb +++ b/app/graphql/types/book_chapter_connection_with_total_type.rb @@ -70,7 +70,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/book_connection_with_total_type.rb b/app/graphql/types/book_connection_with_total_type.rb index c0ffb7c90..9a0767ac6 100644 --- a/app/graphql/types/book_connection_with_total_type.rb +++ b/app/graphql/types/book_connection_with_total_type.rb @@ -62,7 +62,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/collection_connection_with_total_type.rb b/app/graphql/types/collection_connection_with_total_type.rb index 47a528e78..2d001a5ee 100644 --- a/app/graphql/types/collection_connection_with_total_type.rb +++ b/app/graphql/types/collection_connection_with_total_type.rb @@ -69,7 +69,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/conference_paper_connection_with_total_type.rb b/app/graphql/types/conference_paper_connection_with_total_type.rb index 9e1928b30..c3c5da6ed 100644 --- a/app/graphql/types/conference_paper_connection_with_total_type.rb +++ b/app/graphql/types/conference_paper_connection_with_total_type.rb @@ -70,7 +70,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/data_management_plan_connection_with_total_type.rb b/app/graphql/types/data_management_plan_connection_with_total_type.rb index 2a8c755d9..566c682cd 100644 --- a/app/graphql/types/data_management_plan_connection_with_total_type.rb +++ b/app/graphql/types/data_management_plan_connection_with_total_type.rb @@ -70,7 +70,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/data_paper_connection_with_total_type.rb b/app/graphql/types/data_paper_connection_with_total_type.rb index d100ca57b..31adc911f 100644 --- a/app/graphql/types/data_paper_connection_with_total_type.rb +++ b/app/graphql/types/data_paper_connection_with_total_type.rb @@ -42,4 +42,12 @@ def licenses def languages facet_by_language(object.aggregations.languages.buckets) end + + def fields_of_science + if object.aggregations.fields_of_science + facet_by_fos(object.aggregations.fields_of_science.buckets) + else + [] + end + end end diff --git a/app/graphql/types/dataset_connection_with_total_type.rb b/app/graphql/types/dataset_connection_with_total_type.rb index 6fc42ac1f..cb0159c83 100644 --- a/app/graphql/types/dataset_connection_with_total_type.rb +++ b/app/graphql/types/dataset_connection_with_total_type.rb @@ -77,7 +77,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/dissertation_connection_with_total_type.rb b/app/graphql/types/dissertation_connection_with_total_type.rb index 892ffe1e3..5fbd75945 100644 --- a/app/graphql/types/dissertation_connection_with_total_type.rb +++ b/app/graphql/types/dissertation_connection_with_total_type.rb @@ -70,7 +70,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/doi_item.rb b/app/graphql/types/doi_item.rb index b4134356e..bb599bf95 100644 --- a/app/graphql/types/doi_item.rb +++ b/app/graphql/types/doi_item.rb @@ -66,6 +66,15 @@ module DoiItem field :fields_of_science, [FieldOfScienceType], null: true, description: "OECD Fields of Science of the resource" + + field :fields_of_science_combined, + [FieldOfScienceType], + null: true, description: "OECD Fields of Science of the resource and containing repository" + + field :fields_of_science_repository, + [FieldOfScienceType], + null: true, description: "OECD Fields of Science of the containing repository" + field :dates, [DateType], null: true, description: "Different dates relevant to the work" @@ -382,6 +391,7 @@ module DoiItem argument :has_views, Int, required: false argument :has_downloads, Int, required: false argument :field_of_science, String, required: false + argument :field_of_science_repository, String, required: false argument :first, Int, required: false, default_value: 25 argument :after, String, required: false end @@ -418,15 +428,27 @@ def registration_agency { id: object.agency, name: REGISTRATION_AGENCIES[object.agency] }.compact end - def fields_of_science - Array.wrap(object.subjects).select do |s| - s["subjectScheme"] == "Fields of Science and Technology (FOS)" - end.map do |s| - name = s["subject"].gsub("FOS: ", "") + def _fos_to_facet(fos_list) + Array.wrap(fos_list).map do |name| { "id" => name.parameterize(separator: "_"), "name" => name } end.uniq end + def fields_of_science_repository + if object.client.blank? + return [] + end + _fos_to_facet(object.fields_of_science_repository) + end + + def fields_of_science_combined + _fos_to_facet(object.fields_of_science_combined) + end + + def fields_of_science + _fos_to_facet(object.fields_of_science) + end + def creators(**args) Array.wrap(object.creators)[0...args[:first]].map do |c| Hashie::Mash.new( diff --git a/app/graphql/types/event_connection_with_total_type.rb b/app/graphql/types/event_connection_with_total_type.rb index 2e4ca6be0..b1d368693 100644 --- a/app/graphql/types/event_connection_with_total_type.rb +++ b/app/graphql/types/event_connection_with_total_type.rb @@ -61,7 +61,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/instrument_connection_with_total_type.rb b/app/graphql/types/instrument_connection_with_total_type.rb index 38af30287..7a368775c 100644 --- a/app/graphql/types/instrument_connection_with_total_type.rb +++ b/app/graphql/types/instrument_connection_with_total_type.rb @@ -65,4 +65,12 @@ def languages [] end end + + def fields_of_science + if object.aggregations.fields_of_science + facet_by_fos(object.aggregations.fields_of_science.buckets) + else + [] + end + end end diff --git a/app/graphql/types/interactive_resource_connection_with_total_type.rb b/app/graphql/types/interactive_resource_connection_with_total_type.rb index 592495b11..bc71ff328 100644 --- a/app/graphql/types/interactive_resource_connection_with_total_type.rb +++ b/app/graphql/types/interactive_resource_connection_with_total_type.rb @@ -66,4 +66,12 @@ def languages [] end end + + def fields_of_science + if object.aggregations.fields_of_science + facet_by_fos(object.aggregations.fields_of_science.buckets) + else + [] + end + end end diff --git a/app/graphql/types/journal_article_connection_with_total_type.rb b/app/graphql/types/journal_article_connection_with_total_type.rb index cef302b19..b627a973b 100644 --- a/app/graphql/types/journal_article_connection_with_total_type.rb +++ b/app/graphql/types/journal_article_connection_with_total_type.rb @@ -66,4 +66,12 @@ def languages [] end end + + def fields_of_science + if object.aggregations.fields_of_science + facet_by_fos(object.aggregations.fields_of_science.buckets) + else + [] + end + end end diff --git a/app/graphql/types/model_connection_with_total_type.rb b/app/graphql/types/model_connection_with_total_type.rb index 167d27322..ee3c59d48 100644 --- a/app/graphql/types/model_connection_with_total_type.rb +++ b/app/graphql/types/model_connection_with_total_type.rb @@ -61,7 +61,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/other_connection_with_total_type.rb b/app/graphql/types/other_connection_with_total_type.rb index f7dc416d3..203dc702d 100644 --- a/app/graphql/types/other_connection_with_total_type.rb +++ b/app/graphql/types/other_connection_with_total_type.rb @@ -61,7 +61,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/peer_review_connection_with_total_type.rb b/app/graphql/types/peer_review_connection_with_total_type.rb index 6bf2c777b..5f850de78 100644 --- a/app/graphql/types/peer_review_connection_with_total_type.rb +++ b/app/graphql/types/peer_review_connection_with_total_type.rb @@ -61,7 +61,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/physical_object_connection_with_total_type.rb b/app/graphql/types/physical_object_connection_with_total_type.rb index f13ec3a36..b5e886fed 100644 --- a/app/graphql/types/physical_object_connection_with_total_type.rb +++ b/app/graphql/types/physical_object_connection_with_total_type.rb @@ -61,7 +61,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/preprint_connection_with_total_type.rb b/app/graphql/types/preprint_connection_with_total_type.rb index 85c7b88f1..3e294d202 100644 --- a/app/graphql/types/preprint_connection_with_total_type.rb +++ b/app/graphql/types/preprint_connection_with_total_type.rb @@ -61,7 +61,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/publication_connection_with_total_type.rb b/app/graphql/types/publication_connection_with_total_type.rb index d1e0656f6..8eb476f2c 100644 --- a/app/graphql/types/publication_connection_with_total_type.rb +++ b/app/graphql/types/publication_connection_with_total_type.rb @@ -68,7 +68,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 22f2d2d76..8e88ec927 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -271,13 +271,20 @@ def actor(id:) argument :has_views, Int, required: false argument :has_downloads, Int, required: false argument :field_of_science, String, required: false + argument :field_of_science_repository, String, required: false + argument :field_of_science_combined, String, required: false argument :facet_count, Int, required: false, default_value: 10 argument :first, Int, required: false, default_value: 25 argument :after, String, required: false end def works(**args) - ElasticsearchModelResponseConnection.new(response(args), context: context, first: args[:first], after: args[:after]) + ElasticsearchModelResponseConnection.new( + response(args), { + context: context, + first: args[:first], + after: args[:after] + }) end field :work, WorkType, null: false do @@ -1253,7 +1260,39 @@ def usage_report(id:) end def response(**args) - Doi.gql_query(args[:query], ids: args[:ids], user_id: args[:user_id], client_id: args[:repository_id], provider_id: args[:member_id], resource_type_id: args[:resource_type_id], resource_type: args[:resource_type], published: args[:published], agency: args[:registration_agency], language: args[:language], license: args[:license], has_person: args[:has_person], has_funder: args[:has_funder], has_organization: args[:has_organization], has_affiliation: args[:has_affiliation], has_member: args[:has_member], 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], facet_count: args[:facet_count], pid_entity: args[:pid_entity], 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: args[:member_id], + resource_type_id: args[:resource_type_id], + resource_type: args[:resource_type], + published: args[:published], + agency: args[:registration_agency], + language: args[:language], + license: args[:license], + has_person: args[:has_person], + has_funder: args[:has_funder], + has_organization: args[:has_organization], + has_affiliation: args[:has_affiliation], + has_member: args[:has_member], + 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], + field_of_science_repository: args[:field_of_science_repository], + field_of_science_combined: args[:field_of_science_combined], + facet_count: args[:facet_count], + pid_entity: args[:pid_entity], + state: "findable", + page: { + cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : [], + size: args[:first] + } + ) end def set_doi(id) diff --git a/app/graphql/types/service_connection_with_total_type.rb b/app/graphql/types/service_connection_with_total_type.rb index a9366626a..96a49f007 100644 --- a/app/graphql/types/service_connection_with_total_type.rb +++ b/app/graphql/types/service_connection_with_total_type.rb @@ -70,7 +70,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/software_connection_with_total_type.rb b/app/graphql/types/software_connection_with_total_type.rb index 31f93b0a3..850877a73 100644 --- a/app/graphql/types/software_connection_with_total_type.rb +++ b/app/graphql/types/software_connection_with_total_type.rb @@ -68,7 +68,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/sound_connection_with_total_type.rb b/app/graphql/types/sound_connection_with_total_type.rb index 9fbb9441c..2057c139d 100644 --- a/app/graphql/types/sound_connection_with_total_type.rb +++ b/app/graphql/types/sound_connection_with_total_type.rb @@ -61,7 +61,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/graphql/types/work_connection_with_total_type.rb b/app/graphql/types/work_connection_with_total_type.rb index b0c5b58d4..31da87097 100644 --- a/app/graphql/types/work_connection_with_total_type.rb +++ b/app/graphql/types/work_connection_with_total_type.rb @@ -17,6 +17,8 @@ class WorkConnectionWithTotalType < BaseConnection field :affiliations, [FacetType], null: true, cache: true field :authors, [FacetType], null: true, cache: true field :fields_of_science, [FacetType], null: true, cache: true + field :fields_of_science_combined, [FacetType], null: true, cache: true + field :fields_of_science_repository, [FacetType], null: true, cache: true field :licenses, [FacetType], null: true, cache: true field :languages, [FacetType], null: true, cache: true @@ -100,7 +102,23 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) + else + [] + end + end + + def fields_of_science_combined + if object.aggregations.fields_of_science_combined + facet_by_fos(object.aggregations.fields_of_science_combined.buckets) + else + [] + end + end + + def fields_of_science_repository + if object.aggregations.fields_of_science_repository + facet_by_fos(object.aggregations.fields_of_science_repository.buckets) else [] end diff --git a/app/graphql/types/workflow_connection_with_total_type.rb b/app/graphql/types/workflow_connection_with_total_type.rb index d08db5ef9..2dec549d8 100644 --- a/app/graphql/types/workflow_connection_with_total_type.rb +++ b/app/graphql/types/workflow_connection_with_total_type.rb @@ -70,7 +70,7 @@ def licenses def fields_of_science if object.aggregations.fields_of_science - facet_by_fos(object.aggregations.fields_of_science.subject.buckets) + facet_by_fos(object.aggregations.fields_of_science.buckets) else [] end diff --git a/app/models/client.rb b/app/models/client.rb index cb7631f73..13926bbe0 100644 --- a/app/models/client.rb +++ b/app/models/client.rb @@ -52,6 +52,7 @@ class Client < ApplicationRecord attr_accessor :password_input, :target_id attr_reader :from_salesforce + validate :subjects_only_for_disciplinary_repos validates :subjects, if: :subjects?, json: { message: ->(errors) { errors }, @@ -96,12 +97,16 @@ class Client < ApplicationRecord has_many :activities, as: :auditable, dependent: :destroy before_validation :set_defaults + before_validation :convert_subject_hashes_to_camelcase before_create { self.created = Time.zone.now.utc.iso8601 } before_save { self.updated = Time.zone.now.utc.iso8601 } after_create :assign_prefix after_create_commit :create_reference_repository after_update_commit :update_reference_repository after_destroy_commit :destroy_reference_repository + after_commit on: %i[create update] do + ::Client.import_dois(self.symbol) + end # use different index for testing if Rails.env.test? @@ -198,7 +203,7 @@ class Client < ApplicationRecord indexes :analytics_dashboard_url, type: :text indexes :analytics_tracking_id, type: :text indexes :cumulative_years, type: :integer, index: "false" - indexes :subjects, type: :object, properties: { + indexes :subjects, type: :object, properties: { subjectScheme: { type: :keyword }, subject: { type: :keyword }, schemeUri: { type: :keyword }, @@ -396,6 +401,7 @@ def as_indexed_json(options = {}) end, "analytics_dashboard_url" => analytics_dashboard_url, "analytics_tracking_id" => analytics_tracking_id, + "subjects" => Array.wrap(subjects), } end @@ -504,7 +510,7 @@ def re3data=(value) end def subjects=(value) - write_attribute(:subjects, Array.wrap(value)) + write_attribute(:subjects, Array.wrap(value).uniq) end def opendoar=(value) @@ -910,6 +916,15 @@ def freeze_symbol errors.add(:symbol, "cannot be changed") if symbol_changed? end + def subjects_only_for_disciplinary_repos + if Array.wrap(subjects).any? && Array.wrap(repository_type).exclude?("disciplinary") + errors.add( + :subjects, + "Subjects are only allowed for disciplinary repositories. This repository_type is: #{repository_type}", + ) + end + end + def check_id if symbol && symbol.split(".").first != provider.symbol errors.add( @@ -980,6 +995,18 @@ def set_defaults self.doi_quota_allowed = -1 unless doi_quota_allowed.to_i > 0 end + def convert_subject_hashes_to_camelcase + if self.subjects? + self.subjects = Array.wrap(self.subjects).map { |subject| + subject.transform_keys! do |key| + key.to_s.camelcase(:lower) + end + } + else + [] + end + end + def create_reference_repository ReferenceRepository.create_from_client(self) end diff --git a/app/models/doi.rb b/app/models/doi.rb index e5c0cb729..c8c986cf6 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -141,6 +141,8 @@ class Doi < ApplicationRecord before_save :set_defaults, :save_metadata before_create { self.created = Time.zone.now.utc.iso8601 } + FIELD_OF_SCIENCE_SCHEME = "Fields of Science and Technology (FOS)" + scope :q, ->(query) { where("dataset.doi = ?", query) } # use different index for testing @@ -408,6 +410,14 @@ class Doi < ApplicationRecord updated: { type: :date }, deleted_at: { type: :date }, cumulative_years: { type: :integer, index: "false" }, + subjects: { type: :object, properties: { + subjectScheme: { type: :keyword }, + subject: { type: :keyword }, + schemeUri: { type: :keyword }, + valueUri: { type: :keyword }, + lang: { type: :keyword }, + classificationCode: { type: :keyword }, + } } } indexes :provider, type: :object, properties: { id: { type: :keyword }, @@ -512,6 +522,9 @@ class Doi < ApplicationRecord titleType: { type: :keyword }, lang: { type: :keyword }, } + indexes :fields_of_science, type: :keyword + indexes :fields_of_science_combined, type: :keyword + indexes :fields_of_science_repository, type: :keyword end end @@ -567,6 +580,9 @@ def as_indexed_json(_options = {}) "sizes" => Array.wrap(sizes), "language" => language, "subjects" => Array.wrap(subjects), + "fields_of_science" => fields_of_science, + "fields_of_science_repository" => fields_of_science_repository, + "fields_of_science_combined" => fields_of_science_combined, "xml" => xml, "is_active" => is_active, "landing_page" => landing_page, @@ -642,11 +658,13 @@ def self.gql_query_aggregations(facet_count: 10) }, }, fields_of_science: { - filter: { term: { "subjects.subjectScheme": "Fields of Science and Technology (FOS)" } }, - aggs: { - subject: { terms: { field: "subjects.subject", size: facet_count, min_doc_count: 1, - include: "FOS:.*" } }, - }, + terms: { field: "fields_of_science", size: facet_count, min_doc_count: 1 } + }, + fields_of_science_combined: { + terms: { field: "fields_of_science_combined", size: facet_count, min_doc_count: 1 } + }, + fields_of_science_repository: { + terms: { field: "fields_of_science_repository", size: facet_count, min_doc_count: 1 } }, licenses: { terms: { field: "rights_list.rightsIdentifier", size: facet_count, min_doc_count: 1 } }, languages: { terms: { field: "language", size: facet_count, min_doc_count: 1 } }, @@ -701,11 +719,7 @@ def self.query_aggregations(disable_facets: false) }, }, fields_of_science: { - filter: { term: { "subjects.subjectScheme": "Fields of Science and Technology (FOS)" } }, - aggs: { - subject: { terms: { field: "subjects.subject", size: 10, min_doc_count: 1, - include: "FOS:.*" } }, - }, + terms: { field: "fields_of_science", size: 10, min_doc_count: 1 } }, licenses: { terms: { field: "rights_list.rightsIdentifier", size: 10, min_doc_count: 1 } }, languages: { terms: { field: "language", size: 10, min_doc_count: 1 } }, @@ -903,8 +917,13 @@ def self.gql_query(query, options = {}) filter << { terms: { "subjects.subject": options[:pid_entity].split(",").map(&:humanize) } } end if options[:field_of_science].present? - filter << { term: { "subjects.subjectScheme": "Fields of Science and Technology (FOS)" } } - filter << { terms: { "subjects.subject": options[:field_of_science].split(",").map { |s| "FOS: " + s.humanize } } } + filter << { terms: { "fields_of_science": options[:field_of_science].split(",").map { |s| s.humanize } } } + end + if options[:field_of_science_repository].present? + filter << { terms: { "fields_of_science_repository": options[:field_of_science_repository].split(",").map { |s| s.humanize } } } + end + if options[:field_of_science_combined].present? + filter << { terms: { "fields_of_science_combined": options[:field_of_science_combined].split(",").map { |s| s.humanize } } } end filter << { terms: { "rights_list.rightsIdentifier" => options[:license].split(",") } } if options[:license].present? filter << { term: { source: options[:source] } } if options[:source].present? @@ -1103,8 +1122,13 @@ def self.query(query, options = {}) filter << { terms: { "subjects.subject": options[:pid_entity].split(",").map(&:humanize) } } end if options[:field_of_science].present? - filter << { term: { "subjects.subjectScheme": "Fields of Science and Technology (FOS)" } } - filter << { terms: { "subjects.subject": options[:field_of_science].split(",").map { |s| "FOS: " + s.humanize } } } + filter << { terms: { "fields_of_science": options[:field_of_science].split(",").map { |s| s.humanize } } } + end + if options[:field_of_science_repository].present? + filter << { terms: { "fields_of_science_repository": options[:field_of_science_repository].split(",").map { |s| s.humanize } } } + end + if options[:field_of_science_combined].present? + filter << { terms: { "fields_of_science_combined": options[:field_of_science_combined].split(",").map { |s| s.humanize } } } end filter << { terms: { "rights_list.rightsIdentifier" => options[:license].split(",") } } if options[:license].present? filter << { term: { source: options[:source] } } if options[:source].present? @@ -1701,6 +1725,26 @@ def client_id client.symbol.downcase if client.present? end + def _fos_filter(subject_array) + Array.wrap(subject_array).select { |sub| + sub.dig("subjectScheme") == FIELD_OF_SCIENCE_SCHEME + }.map do |fos| + fos["subject"].gsub("FOS: ", "") + end + end + + def fields_of_science + _fos_filter(subjects).uniq + end + + def fields_of_science_repository + _fos_filter(client&.subjects).uniq + end + + def fields_of_science_combined + fields_of_science | fields_of_science_repository + end + def client_id_and_name "#{client_id}:#{client.name}" if client.present? end diff --git a/app/models/schemas/client/subjects.json b/app/models/schemas/client/subjects.json index 7179c2243..8ece1f194 100644 --- a/app/models/schemas/client/subjects.json +++ b/app/models/schemas/client/subjects.json @@ -5,34 +5,18 @@ "items": { "type": "object", "properties": { - "classification_code": { "type": "string" }, "classificationCode": { "type": "string" }, - "scheme_uri": { "type": "string" }, "schemeUri": { "type": "string" }, - "value_uri": { "type": "string" }, "valueUri": { "type": "string" }, "lang": { "type": "string" }, "subject": { "type": "string" }, - "subject_scheme": { "type": "string" }, "subjectScheme": { "type": "string" } }, - "oneOf": [ - { - "required": [ - "classification_code", - "scheme_uri", - "subject", - "subject_scheme" - ] - }, - { - "required": [ - "classificationCode", - "schemeUri", - "subject", - "subjectScheme" - ] - } + "required": [ + "classificationCode", + "schemeUri", + "subject", + "subjectScheme" ], "additionalProperties": false } diff --git a/db/seeds/development/base.seeds.rb b/db/seeds/development/base.seeds.rb index 4a32778aa..f9725fcfe 100644 --- a/db/seeds/development/base.seeds.rb +++ b/db/seeds/development/base.seeds.rb @@ -24,11 +24,19 @@ client = Client.where(symbol: "DATACITE.TEST").first || FactoryBot.create( - :client, + :client_with_fos, provider: provider, symbol: ENV["MDS_USERNAME"], password_input: ENV["MDS_PASSWORD"], ) +if Prefix.where(uid: "10.14454").blank? + prefix = FactoryBot.create(:prefix, uid: "10.14454") + ### This creates both the client_prefix and the provider association + FactoryBot.create( + :client_prefix, + client_id: client.symbol, prefix_id: prefix.uid, + ) +end dois = FactoryBot.create_list(:doi, 10, client: client, state: "findable") FactoryBot.create_list(:event_for_datacite_related, 3, obj_id: dois.first.doi) FactoryBot.create_list(:event_for_datacite_usage, 2, obj_id: dois.first.doi) diff --git a/lib/tasks/enrich.rake b/lib/tasks/enrich.rake new file mode 100644 index 000000000..91ec75f4e --- /dev/null +++ b/lib/tasks/enrich.rake @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +namespace :enrich do + desc "Enrich Clients with Subjects from re3data and converted to Field Of Science subjectScheme" + task client_subjects: :environment do + def enrich_client(client) + re3data = DataCatalog.find_by_id(client.re3data_id).fetch(:data, []).first + if re3data + subs = re3data.subjects + dfg_ids = subs.select { |subject| + subject.scheme == "DFG" + }.map { |subject| + subject.text.split.first + } + fos_subjects = Bolognese::Utils.dfg_ids_to_fos(dfg_ids) + client.subjects = fos_subjects.uniq + client.save + end + end + + puts "Searching for disciplinary repositories with re3data_ids without subjects" + search_results = Client.search("re3data_id:* AND -subjects:* AND repository_type:disciplinary") + puts "Found #{search_results.records.count} repostitories. Enriching now..." + search_results.records.map do |c| + enrich_client(c) + end + puts "Enrichment complete" + end +end diff --git a/spec/factories/client.rb b/spec/factories/client.rb index 16b82fe80..c5a40efe6 100644 --- a/spec/factories/client.rb +++ b/spec/factories/client.rb @@ -19,6 +19,21 @@ password_input { "12345" } is_active { true } + factory :client_with_fos do + repository_type { "disciplinary" } + subjects do + [ + { + subject: "Physical sciences", + valueUri: "", + schemeUri: "http://www.oecd.org/science/inno/38235147.pdf", + subjectScheme: "Fields of Science and Technology (FOS)", + classificationCode: "1001", + }, + ] + end + end + initialize_with { Client.where(symbol: symbol).first_or_initialize } end end diff --git a/spec/graphql/types/doi_item_spec.rb b/spec/graphql/types/doi_item_spec.rb index 2db00a772..e88ef3ff3 100644 --- a/spec/graphql/types/doi_item_spec.rb +++ b/spec/graphql/types/doi_item_spec.rb @@ -13,6 +13,9 @@ it { is_expected.to have_field(:publicationYear).of_type("Int") } it { is_expected.to have_field(:publisher).of_type("String") } it { is_expected.to have_field(:subjects).of_type("[Subject!]") } + it { is_expected.to have_field(:fieldsOfScience).of_type("[FieldOfScience!]") } + it { is_expected.to have_field(:fieldsOfScienceRepository).of_type("[FieldOfScience!]") } + it { is_expected.to have_field(:fieldsOfScienceCombined).of_type("[FieldOfScience!]") } it { is_expected.to have_field(:dates).of_type("[Date!]") } it { is_expected.to have_field(:registered).of_type("ISO8601DateTime") } it { is_expected.to have_field(:language).of_type("Language") } diff --git a/spec/graphql/types/work_type_spec.rb b/spec/graphql/types/work_type_spec.rb index 30e5b63f2..6f5473628 100644 --- a/spec/graphql/types/work_type_spec.rb +++ b/spec/graphql/types/work_type_spec.rb @@ -1201,4 +1201,87 @@ ) end end + + describe "query works with repository subjects" do + before :all do + SLEEP_TIME = 2 + WORK_COUNT = 10 + + DataciteDoi.import(force: true) + Client.import(force: true) + Prefix.import(force: true) + ClientPrefix.import(force: true) + ReferenceRepository.import(force: true) + Event.import(force: true) + + search_query = ' + fragment facetFields on Facet { + id + title + count + } + query{ + works(query:"*"){ + totalCount + fieldsOfScience { ...facetFields } + fieldsOfScienceRepository { ...facetFields } + fieldsOfScienceCombined{ ...facetFields } + } + } + ' + + create(:prefix) + client = create(:client_with_fos) + create_list(:doi, WORK_COUNT, + aasm_state: "findable", + client: client + ) + Doi.import + sleep SLEEP_TIME + @facet_response = LupoSchema.execute(search_query).as_json + Rails.logger.level = :fatal + DataciteDoi.destroy_all + ReferenceRepository.destroy_all + Client.destroy_all + Provider.destroy_all + Prefix.destroy_all + ClientPrefix.destroy_all + ProviderPrefix.destroy_all + Event.destroy_all + end + + let (:fos_facet) do + { + "id" => "physical_sciences", + "title" => "Physical sciences", + "count" => WORK_COUNT + } + end + + it "has all dois in the search results" do + response = @facet_response + expect(response.dig("data", "works", "totalCount")).to eq(WORK_COUNT) + end + + it "returns Field of Science Facets" do + response = @facet_response + expect( + response.dig("data", "works", "fieldsOfScience") + ).to match_array([]) + end + + it "returns Field of Science Facets from the repository" do + response = @facet_response + expect( + response.dig("data", "works", "fieldsOfScienceRepository") + ).to match_array([ fos_facet ]) + end + + it "returns combined Field of Science Facets" do + response = @facet_response + expect( + response.dig("data", "works", "fieldsOfScienceCombined") + ).to match_array([ fos_facet ]) + end + end end diff --git a/spec/models/client_spec.rb b/spec/models/client_spec.rb index 4f26310ee..bfd1a49e3 100644 --- a/spec/models/client_spec.rb +++ b/spec/models/client_spec.rb @@ -15,7 +15,11 @@ end describe "subjects" do - let(:client) { build(:client, provider: provider) } + let(:client) { build(:client, + provider: provider, + repository_type: "disciplinary" + ) + } let(:valid_subjects) do { classificationCode: "6.1", @@ -25,6 +29,12 @@ } end + it "are invalid if the repository_type is not disciplinary" do + client.repository_type = nil + client.subjects = [valid_subjects] + expect(client).to_not be_valid + end + it "valid hash" do client.subjects = [valid_subjects] expect(client).to be_valid diff --git a/spec/requests/repositories_spec.rb b/spec/requests/repositories_spec.rb index 3f2512696..374841395 100644 --- a/spec/requests/repositories_spec.rb +++ b/spec/requests/repositories_spec.rb @@ -413,6 +413,7 @@ "type" => "repositories", "attributes" => { "subjects" => subjects, + "repositoryType" => "disciplinary", }, }, }