From d1cb8c0b44c1f313d3ca6ab8f4b9a1096978b9f0 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sat, 19 Sep 2020 13:03:12 +0200 Subject: [PATCH] fix has_member #635 --- app/graphql/schema.graphql | 80 +++++++------- app/graphql/types/funder_type.rb | 18 +++- app/graphql/types/organization_type.rb | 25 +++++ app/graphql/types/query_type.rb | 27 ++++- app/graphql/types/repository_type.rb | 11 +- app/models/doi.rb | 7 +- spec/graphql/types/organization_type_spec.rb | 2 +- spec/graphql/types/work_type_spec.rb | 106 +++++++++++++++++-- 8 files changed, 219 insertions(+), 57 deletions(-) diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql index 308b4592f..5eaf5f16b 100644 --- a/app/graphql/schema.graphql +++ b/app/graphql/schema.graphql @@ -4102,12 +4102,12 @@ type Funder implements ActorItem { """ Data management plans from this organization """ - dataManagementPlans(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, hasCitations: Int, hasDownloads: Int, hasParts: Int, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, organizationId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, userId: String): DataManagementPlanConnectionWithTotal + dataManagementPlans(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasMember: 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, resourceType: String, userId: String): DataManagementPlanConnectionWithTotal """ Funded datasets """ - datasets(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, 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, resourceType: String, userId: String): DatasetConnectionWithTotal + datasets(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasMember: 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, resourceType: String, userId: String): DatasetConnectionWithTotal """ The number of downloads according to the Counter Code of Practice. @@ -4127,12 +4127,12 @@ type Funder implements ActorItem { """ Funded publications """ - publications(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, 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, resourceType: String, userId: String): PublicationConnectionWithTotal + publications(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasMember: 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, resourceType: String, userId: String): PublicationConnectionWithTotal """ Funded software """ - softwares(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, 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, resourceType: String, userId: String): SoftwareConnectionWithTotal + softwares(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasMember: 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, resourceType: String, userId: String): SoftwareConnectionWithTotal """ The type of the actor. @@ -4147,7 +4147,7 @@ type Funder implements ActorItem { """ Funded works """ - works(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, 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, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + works(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, hasAffiliation: Boolean, hasCitations: Int, hasDownloads: Int, hasMember: 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, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal } """ @@ -6137,12 +6137,12 @@ type Organization implements ActorItem { """ Data management plans from this organization """ - dataManagementPlans(after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasCitations: Int, hasDownloads: Int, hasParts: Int, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, userId: String): DataManagementPlanConnectionWithTotal + dataManagementPlans(after: String, fieldOfScience: String, first: Int = 25, funderId: String, 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, userId: String): DataManagementPlanConnectionWithTotal """ Datasets from this organization """ - datasets(after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasCitations: Int, hasDownloads: Int, hasParts: Int, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, userId: String): DatasetConnectionWithTotal + datasets(after: String, fieldOfScience: String, first: Int = 25, funderId: String, 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, userId: String): DatasetConnectionWithTotal """ The number of downloads according to the Counter Code of Practice. @@ -6197,12 +6197,12 @@ type Organization implements ActorItem { """ Publications from this organization """ - publications(after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasCitations: Int, hasDownloads: Int, hasParts: Int, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, userId: String): PublicationConnectionWithTotal + publications(after: String, fieldOfScience: String, first: Int = 25, funderId: String, 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, userId: String): PublicationConnectionWithTotal """ Software from this organization """ - softwares(after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasCitations: Int, hasDownloads: Int, hasParts: Int, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, memberId: String, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, userId: String): SoftwareConnectionWithTotal + softwares(after: String, fieldOfScience: String, first: Int = 25, funderId: String, 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, userId: String): SoftwareConnectionWithTotal """ Twitter username of the organization. @@ -6237,7 +6237,7 @@ type Organization implements ActorItem { """ Works from this organization """ - works(after: String, fieldOfScience: String, first: Int = 2, funderId: String, hasCitations: Int, hasDownloads: Int, hasParts: Int, 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, fieldOfScience: String, first: Int = 2, funderId: String, 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, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal } """ @@ -7988,66 +7988,66 @@ type Query { actor(id: ID!): ActorItem! actors(after: String, first: Int = 25, query: String): ActorConnection! audiovisual(id: ID!): Audiovisual! - audiovisuals(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): AudiovisualConnectionWithTotal! + audiovisuals(after: String, 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): AudiovisualConnectionWithTotal! book(id: ID!): Book! bookChapter(id: ID!): BookChapter! - bookChapters(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): BookChapterConnectionWithTotal! - books(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): BookConnectionWithTotal! + bookChapters(after: String, 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): BookChapterConnectionWithTotal! + books(after: String, 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): BookConnectionWithTotal! collection(id: ID!): Collection! - collections(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): CollectionConnectionWithTotal! + collections(after: String, 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): CollectionConnectionWithTotal! conferencePaper(id: ID!): ConferencePaper! - conferencePapers(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): ConferencePaperConnectionWithTotal! + conferencePapers(after: String, 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): ConferencePaperConnectionWithTotal! dataCatalog(id: ID!): DataCatalog! dataCatalogs(after: String, first: Int = 25, query: String): DataCatalogConnectionWithTotal! dataManagementPlan(id: ID!): DataManagementPlan! - dataManagementPlans(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): DataManagementPlanConnectionWithTotal! + dataManagementPlans(after: String, 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): DataManagementPlanConnectionWithTotal! dataPaper(id: ID!): DataPaper! - dataPapers(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): DataPaperConnectionWithTotal! + dataPapers(after: String, 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): DataPaperConnectionWithTotal! dataset(id: ID!): Dataset! - datasets(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): DatasetConnectionWithTotal! + datasets(after: String, 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): DatasetConnectionWithTotal! dissertation(id: ID!): Dissertation! - dissertations(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): DissertationConnectionWithTotal! + dissertations(after: String, 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): DissertationConnectionWithTotal! event(id: ID!): Event! - events(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): EventConnectionWithTotal! + events(after: String, 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): EventConnectionWithTotal! funder(id: ID!): Funder! funders(after: String, first: Int = 25, query: String): FunderConnectionWithTotal! image(id: ID!): Image! - images(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): ImageConnectionWithTotal! + images(after: String, 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): ImageConnectionWithTotal! instrument(id: ID!): Instrument! - instruments(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): InstrumentConnectionWithTotal! + instruments(after: String, 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): InstrumentConnectionWithTotal! interactiveResource(id: ID!): InteractiveResource! - interactiveResources(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): InteractiveResourceConnectionWithTotal! + interactiveResources(after: String, 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): InteractiveResourceConnectionWithTotal! journalArticle(id: ID!): JournalArticle! - journalArticles(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): JournalArticleConnectionWithTotal! + journalArticles(after: String, 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): JournalArticleConnectionWithTotal! me: Me member(id: ID!): Member! members(after: String, first: Int = 25, query: String, year: String): MemberConnectionWithTotal! model(id: ID!): Model! - models(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): ModelConnectionWithTotal! + models(after: String, 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): ModelConnectionWithTotal! organization(crossrefFunderId: ID, gridId: ID, id: ID): Organization! organizations(after: String, country: String, query: String, types: String): OrganizationConnectionWithTotal! other(id: ID!): Other! - others(after: String, fieldOfScience: String, first: Int = 25, 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, query: String, registrationAgency: String, repositoryId: String, userId: String): OtherConnectionWithTotal! + others(after: String, 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, query: String, registrationAgency: String, repositoryId: String, userId: String): OtherConnectionWithTotal! peerReview(id: ID!): PeerReview! - peerReviews(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): PeerReviewConnectionWithTotal! + peerReviews(after: String, 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): PeerReviewConnectionWithTotal! people(after: String, first: Int = 25, query: String): PersonConnectionWithTotal! person(id: ID!): Person! physicalObject(id: ID!): PhysicalObject! - physicalObjects(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): PhysicalObjectConnectionWithTotal! + physicalObjects(after: String, 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): PhysicalObjectConnectionWithTotal! prefix(id: ID!): Prefix! prefixes(after: String, first: Int = 25, query: String): PrefixConnectionWithTotal! preprint(id: ID!): Preprint! - preprints(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): PreprintConnectionWithTotal! + preprints(after: String, 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): PreprintConnectionWithTotal! publication(id: ID!): Publication! - publications(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): PublicationConnectionWithTotal! + publications(after: String, 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): PublicationConnectionWithTotal! repositories(after: String, first: Int = 25, query: String, software: String, year: String): RepositoryConnectionWithTotal! repository(id: ID!): Repository! service(id: ID!): Service! - services(after: String, fieldOfScience: String, first: Int = 25, 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, pidEntity: String, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): ServiceConnectionWithTotal! + services(after: String, 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, pidEntity: String, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): ServiceConnectionWithTotal! software(id: ID!): Software! - softwares(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): SoftwareConnectionWithTotal! + softwares(after: String, 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): SoftwareConnectionWithTotal! sound(id: ID!): Sound! - sounds(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): SoundConnectionWithTotal! + sounds(after: String, 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): SoundConnectionWithTotal! usageReport(id: ID!): UsageReport! usageReports( """ @@ -8068,8 +8068,8 @@ type Query { ): UsageReportConnectionWithTotal! work(id: ID!): Work! workflow(id: ID!): Workflow! - workflows(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, userId: String): WorkflowConnectionWithTotal! - works(after: String, fieldOfScience: String, first: Int = 25, 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, published: String, query: String, registrationAgency: String, repositoryId: String, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal! + workflows(after: String, 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, 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! } """ @@ -8169,12 +8169,12 @@ type Repository { """ Data management plans from this organization """ - dataManagementPlans(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, hasCitations: Int, hasDownloads: Int, hasParts: Int, hasVersions: Int, hasViews: Int, ids: [String!], language: String, license: String, organizationId: String, published: String, query: String, registrationAgency: String, resourceType: String, userId: String): DataManagementPlanConnectionWithTotal + dataManagementPlans(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, 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, organizationId: String, published: String, query: String, registrationAgency: String, resourceType: String, userId: String): DataManagementPlanConnectionWithTotal """ Datasets managed by the repository """ - datasets(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, resourceType: String, userId: String): DatasetConnectionWithTotal + datasets(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, 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, organizationId: String, published: String, query: String, registrationAgency: String, resourceType: String, userId: String): DatasetConnectionWithTotal """ Description of the repository @@ -8214,7 +8214,7 @@ type Repository { """ Publications managed by the repository """ - publications(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, resourceType: String, userId: String): PublicationConnectionWithTotal + publications(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, 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, organizationId: String, published: String, query: String, registrationAgency: String, resourceType: String, userId: String): PublicationConnectionWithTotal """ The re3data identifier for the repository @@ -8234,7 +8234,7 @@ type Repository { """ Software managed by the repository """ - softwares(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, resourceType: String, userId: String): SoftwareConnectionWithTotal + softwares(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, 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, organizationId: String, published: String, query: String, registrationAgency: String, resourceType: String, userId: String): SoftwareConnectionWithTotal """ The type of the item. @@ -8254,7 +8254,7 @@ type Repository { """ Works managed by the repository """ - works(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, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal + works(affiliationId: String, after: String, fieldOfScience: String, first: Int = 25, funderId: String, 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, organizationId: String, published: String, query: String, registrationAgency: String, resourceType: String, resourceTypeId: String, userId: String): WorkConnectionWithTotal } """ diff --git a/app/graphql/types/funder_type.rb b/app/graphql/types/funder_type.rb index 148c6ec2f..88406f46f 100644 --- a/app/graphql/types/funder_type.rb +++ b/app/graphql/types/funder_type.rb @@ -20,12 +20,13 @@ class FunderType < BaseObject 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_person, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -46,12 +47,13 @@ class FunderType < BaseObject 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_person, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -72,12 +74,13 @@ class FunderType < BaseObject 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_person, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -101,6 +104,10 @@ class FunderType < BaseObject 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_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -123,11 +130,12 @@ class FunderType < BaseObject 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_person, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -187,6 +195,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], 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] }) + 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_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], published: args[:published], state: "findable", page: { cursor: args[:after].present? ? Base64.urlsafe_decode64(args[:after]) : [], size: args[:first] }) end end diff --git a/app/graphql/types/organization_type.rb b/app/graphql/types/organization_type.rb index 5b41b4969..065725e42 100644 --- a/app/graphql/types/organization_type.rb +++ b/app/graphql/types/organization_type.rb @@ -39,6 +39,11 @@ class OrganizationType < BaseObject argument :license, String, required: false argument :resource_type, 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_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -61,6 +66,11 @@ class OrganizationType < BaseObject argument :license, String, required: false argument :resource_type, 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_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -83,6 +93,11 @@ class OrganizationType < BaseObject argument :resource_type, 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_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -105,6 +120,11 @@ class OrganizationType < BaseObject argument :resource_type, 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_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -127,6 +147,11 @@ class OrganizationType < BaseObject argument :resource_type, 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_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index a7d5a0505..212848b68 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -222,6 +222,7 @@ def actor(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -258,6 +259,7 @@ def work(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -295,6 +297,7 @@ def dataset(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -332,6 +335,7 @@ def publication(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -369,6 +373,7 @@ def audiovisual(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -406,6 +411,7 @@ def collection(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -443,6 +449,7 @@ def data_paper(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -480,6 +487,7 @@ def event(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -517,6 +525,7 @@ def image(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -554,6 +563,7 @@ def interactive_resource(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -591,6 +601,7 @@ def model(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -628,6 +639,7 @@ def physical_object(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -666,6 +678,7 @@ def service(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -703,6 +716,7 @@ def software(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -740,6 +754,7 @@ def sound(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -777,6 +792,7 @@ def workflow(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -815,6 +831,7 @@ def dissertation(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -853,6 +870,7 @@ def data_management_plan(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -891,6 +909,7 @@ def preprint(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -929,6 +948,7 @@ def peer_review(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -967,6 +987,7 @@ def conference_paper(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -1005,6 +1026,7 @@ def book_chapter(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -1043,6 +1065,7 @@ def book(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -1081,6 +1104,7 @@ def journal_article(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -1118,6 +1142,7 @@ def instrument(id:) argument :has_funder, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -1161,7 +1186,7 @@ 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_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], 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], 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/repository_type.rb b/app/graphql/types/repository_type.rb index 48a22a165..841a67a97 100644 --- a/app/graphql/types/repository_type.rb +++ b/app/graphql/types/repository_type.rb @@ -37,6 +37,7 @@ class RepositoryType < BaseObject argument :has_person, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_funder, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false @@ -64,6 +65,7 @@ class RepositoryType < BaseObject argument :has_person, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_funder, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false @@ -91,6 +93,7 @@ class RepositoryType < BaseObject argument :has_person, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_funder, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false @@ -114,6 +117,11 @@ class RepositoryType < BaseObject 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_member, Boolean, required: false + argument :has_funder, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false argument :has_versions, Int, required: false @@ -141,6 +149,7 @@ class RepositoryType < BaseObject argument :has_person, Boolean, required: false argument :has_organization, Boolean, required: false argument :has_affiliation, Boolean, required: false + argument :has_member, Boolean, required: false argument :has_funder, Boolean, required: false argument :has_citations, Int, required: false argument :has_parts, Int, required: false @@ -213,6 +222,6 @@ def citation_count end def response(**args) - Doi.gql_query(args[:query], funder_id: args[:funder_id], user_id: args[:user_id], client_id: object.uid, 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_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], funder_id: args[:funder_id], user_id: args[:user_id], client_id: object.uid, 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_member: args[:has_member], 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 diff --git a/app/models/doi.rb b/app/models/doi.rb index 6b4aa5b8e..9fa208905 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -882,7 +882,7 @@ def self.gql_query(query, options={}) minimum_should_match = 1 end if options[:has_funder].present? - filter << { term: { "funding_references.funderIdentifierType" => "Crossref Funder ID" }} + should << { term: { "funding_references.funderIdentifierType" => "Crossref Funder ID" }} minimum_should_match = 1 end if options[:has_member].present? @@ -1000,6 +1000,9 @@ def self.query(query, options={}) query = query.gsub(/geoLocations/, "geo_locations") query = query.gsub(/landingPage/, "landing_page") query = query.gsub(/contentUrl/, "content_url") + query = query.gsub(/citationCount/, "citation_count") + query = query.gsub(/viewCount/, "view_count") + query = query.gsub(/downloadCount/, "download_count") query = query.gsub("/", '\/') end @@ -1078,7 +1081,7 @@ def self.query(query, options={}) minimum_should_match = 1 end if options[:has_funder].present? - filter << { term: { "funding_references.funderIdentifierType" => "Crossref Funder ID" }} + should << { term: { "funding_references.funderIdentifierType" => "Crossref Funder ID" }} minimum_should_match = 1 end if options[:has_member].present? diff --git a/spec/graphql/types/organization_type_spec.rb b/spec/graphql/types/organization_type_spec.rb index 7f5c1fd5c..8ec3eec5a 100644 --- a/spec/graphql/types/organization_type_spec.rb +++ b/spec/graphql/types/organization_type_spec.rb @@ -130,7 +130,7 @@ expect(response.dig("data", "organization", "works", "nodes").length).to eq(2) work = response.dig("data", "organization", "works", "nodes", 0) - expect(work.dig("titles", 0, "title")).to eq("Data from: A new malaria agent in African hominids.") + expect(work.dig("titles", 0, "title")).to eq("Data from: A new malaria agent in African hominids.") end end diff --git a/spec/graphql/types/work_type_spec.rb b/spec/graphql/types/work_type_spec.rb index d29d699b6..4389c3591 100644 --- a/spec/graphql/types/work_type_spec.rb +++ b/spec/graphql/types/work_type_spec.rb @@ -160,21 +160,102 @@ doi } } + associated: works(hasAffiliation: true, hasFunder: true, hasOrganization: true, hasMember: true) { + totalCount + published { + id + title + count + } + } + contributed: works(hasOrganization: true) { + totalCount + published { + id + title + count + } + } + affiliated: works(hasAffiliation: true) { + totalCount + published { + id + title + count + } + } + funded: works(hasFunder: true) { + totalCount + published { + id + title + count + } + } + hosted: works(hasMember: true) { + totalCount + published { + id + title + count + } + } }) end - let!(:works) { create_list(:doi, 10, aasm_state: "findable") } + let(:provider) { create(:provider, symbol: "LPSW", ror_id: "https://ror.org/013meh722") } + let(:provider_without_ror) { create(:provider, ror_id: nil) } + let(:client) { create(:client, provider: provider) } + let(:client_without_ror) { create(:client, provider: provider_without_ror) } + let!(:works) { create_list(:doi, 10, aasm_state: "findable", client: client_without_ror, creators: + [{ + "familyName" => "Garza", + "givenName" => "Kristian", + "name" => "Garza, Kristian", + "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-3484-6875", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], + "nameType" => "Personal" }]) } + let!(:doi) { create(:doi, aasm_state: "findable", client: client_without_ror, creators: + [{ + "familyName" => "Garza", + "givenName" => "Kristian", + "name" => "Garza, Kristian", + "nameIdentifiers" => [{"nameIdentifier"=>"https://orcid.org/0000-0003-3484-6875", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], + "nameType" => "Personal", + "affiliation": [ + { + "name": "University of Cambridge", + "affiliationIdentifier": "https://ror.org/013meh722", + "affiliationIdentifierScheme": "ROR" + }, + ] + }]) + } + let!(:organization_doi) { create(:doi, aasm_state: "findable", client: client_without_ror, creators: + [{ + "name" => "Department of Psychoceramics, University of Cambridge", + "nameIdentifiers" => [{"nameIdentifier"=>"https://ror.org/013meh722", "nameIdentifierScheme"=>"ROR", "schemeUri"=>"https://ror.org"}], + "nameType" => "Organizational" + }]) + } + let!(:funder_doi) { create(:doi, aasm_state: "findable", client: client_without_ror, funding_references: + [{ + "funderIdentifier" => "https://doi.org/10.13039/501100000735", + "funderIdentifierType" => "Crossref Funder ID", + "funderName" => "University of Cambridge" + }]) + } + let!(:member_doi) { create(:doi, aasm_state: "findable", client: client) } before do Doi.import sleep 2 - @works = Doi.gql_query(nil, page: { cursor: [], size: 10 }).results.to_a + @works = Doi.gql_query(nil, page: { cursor: [], size: 15 }).results.to_a end it "returns all works" do response = LupoSchema.execute(query, variables: { first: 4, cursor: nil }).as_json - expect(response.dig("data", "works", "totalCount")).to eq(10) + expect(response.dig("data", "works", "totalCount")).to eq(14) expect(response.dig("data", "works", "totalCountFromCrossref")).to eq(116990655) expect(Base64.urlsafe_decode64(response.dig("data", "works", "pageInfo", "endCursor")).split(",", 2).last).to eq(@works[3].uid) expect(response.dig("data", "works", "pageInfo", "hasNextPage")).to be true @@ -184,7 +265,7 @@ response = LupoSchema.execute(query, variables: { first: 4, cursor: end_cursor }).as_json - expect(response.dig("data", "works", "totalCount")).to eq(10) + expect(response.dig("data", "works", "totalCount")).to eq(14) expect(Base64.urlsafe_decode64(response.dig("data", "works", "pageInfo", "endCursor")).split(",", 2).last).to eq(@works[7].uid) expect(response.dig("data", "works", "pageInfo", "hasNextPage")).to be true expect(response.dig("data", "works", "nodes").length).to eq(4) @@ -193,12 +274,23 @@ response = LupoSchema.execute(query, variables: { first: 4, cursor: end_cursor }).as_json - expect(response.dig("data", "works", "totalCount")).to eq(10) - expect(Base64.urlsafe_decode64(response.dig("data", "works", "pageInfo", "endCursor")).split(",", 2).last).to eq(@works[9].uid) + expect(response.dig("data", "works", "totalCount")).to eq(14) + expect(Base64.urlsafe_decode64(response.dig("data", "works", "pageInfo", "endCursor")).split(",", 2).last).to eq(@works[11].uid) expect(response.dig("data", "works", "pageInfo", "hasNextPage")).to be true - expect(response.dig("data", "works", "nodes").length).to eq(2) + expect(response.dig("data", "works", "nodes").length).to eq(4) expect(response.dig("data", "works", "nodes", 0, "id")).to eq(@works[8].identifier) end_cursor = response.dig("data", "works", "pageInfo", "endCursor") + + expect(response.dig("data", "associated", "totalCount")).to eq(4) + expect(response.dig("data", "associated", "published")).to eq([{"count"=>4, "id"=>"2011", "title"=>"2011"}]) + expect(response.dig("data", "contributed", "totalCount")).to eq(1) + expect(response.dig("data", "contributed", "published")).to eq([{"count"=>1, "id"=>"2011", "title"=>"2011"}]) + expect(response.dig("data", "affiliated", "totalCount")).to eq(3) + expect(response.dig("data", "affiliated", "published")).to eq([{"count"=>3, "id"=>"2011", "title"=>"2011"}]) + expect(response.dig("data", "funded", "totalCount")).to eq(1) + expect(response.dig("data", "funded", "published")).to eq([{"count"=>1, "id"=>"2011", "title"=>"2011"}]) + expect(response.dig("data", "hosted", "totalCount")).to eq(1) + expect(response.dig("data", "hosted", "published")).to eq([{"count"=>1, "id"=>"2011", "title"=>"2011"}]) end end