diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index 17ec0c480..4702bdbf6 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -63,6 +63,7 @@ def index prefix: params[:prefix], user_id: params[:user_id], resource_type_id: params[:resource_type_id], + resource_type: params[:resource_type], schema_version: params[:schema_version], subject: params[:subject], has_citations: params[:has_citations], diff --git a/app/graphql/schema.graphql b/app/graphql/schema.graphql index eff53a521..570702e2b 100644 --- a/app/graphql/schema.graphql +++ b/app/graphql/schema.graphql @@ -4407,7 +4407,7 @@ type ImageEdge { node: Image } -type InteractiveResource implements DoiItem { +type Instrument implements DoiItem { """ The DOI registration agency for the resource """ @@ -4802,18 +4802,18 @@ type InteractiveResource implements DoiItem { } """ -The connection type for InteractiveResource. +The connection type for Instrument. """ -type InteractiveResourceConnection { +type InstrumentConnection { """ A list of edges. """ - edges: [InteractiveResourceEdge] + edges: [InstrumentEdge] """ A list of nodes. """ - nodes: [InteractiveResource] + nodes: [Instrument] """ Information to aid in pagination. @@ -4826,7 +4826,7 @@ type InteractiveResourceConnection { """ An edge in a connection. """ -type InteractiveResourceEdge { +type InstrumentEdge { """ A cursor for use in pagination. """ @@ -4835,10 +4835,10 @@ type InteractiveResourceEdge { """ The item at the end of the edge. """ - node: InteractiveResource + node: Instrument } -type Model implements DoiItem { +type InteractiveResource implements DoiItem { """ The DOI registration agency for the resource """ @@ -5233,18 +5233,18 @@ type Model implements DoiItem { } """ -The connection type for Model. +The connection type for InteractiveResource. """ -type ModelConnection { +type InteractiveResourceConnection { """ A list of edges. """ - edges: [ModelEdge] + edges: [InteractiveResourceEdge] """ A list of nodes. """ - nodes: [Model] + nodes: [InteractiveResource] """ Information to aid in pagination. @@ -5257,227 +5257,7 @@ type ModelConnection { """ An edge in a connection. """ -type ModelEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Model -} - -""" -Information about organizations -""" -type Organization { - """ - Physical address of the organization. - """ - address: Address - - """ - An alias for the organization. - """ - alternateName: [String!] - - """ - The number of citations. - """ - citationCount: Int - - """ - Datasets from this organization - """ - datasets( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - clientId: String - first: Int = 25 - funderId: String - hasCitations: Int - hasDownloads: Int - hasParts: Int - hasVersions: Int - hasViews: Int - ids: String - - """ - Returns the last _n_ elements from the list. - """ - last: Int - providerId: String - query: String - userId: String - ): DatasetConnection - - """ - The number of downloads according to the Counter Code of Practice. - """ - downloadCount: Int - - """ - ROR ID - """ - id: ID - - """ - The identifier(s) for the organization. - """ - identifiers: [Identifier!] - - """ - The name of the organization. - """ - name: String! - - """ - Publications from this organization - """ - publications( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - clientId: String - first: Int = 25 - funderId: String - hasCitations: Int - hasDownloads: Int - hasParts: Int - hasVersions: Int - hasViews: Int - ids: String - - """ - Returns the last _n_ elements from the list. - """ - last: Int - providerId: String - query: String - userId: String - ): PublicationConnection - - """ - Software from this organization - """ - softwares( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - clientId: String - first: Int = 25 - funderId: String - hasCitations: Int - hasDownloads: Int - hasParts: Int - hasVersions: Int - hasViews: Int - ids: String - - """ - Returns the last _n_ elements from the list. - """ - last: Int - providerId: String - query: String - userId: String - ): SoftwareConnection - - """ - The type of the item. - """ - type: String! - - """ - URL of the organization. - """ - url: [String!] - - """ - The number of views according to the Counter Code of Practice. - """ - viewCount: Int - - """ - Works from this organization - """ - works( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - clientId: String - first: Int = 25 - funderId: String - hasCitations: Int - hasDownloads: Int - hasParts: Int - hasVersions: Int - hasViews: Int - ids: String - - """ - Returns the last _n_ elements from the list. - """ - last: Int - providerId: String - query: String - userId: String - ): WorkConnection -} - -""" -The connection type for Organization. -""" -type OrganizationConnection { - """ - A list of edges. - """ - edges: [OrganizationEdge] - - """ - A list of nodes. - """ - nodes: [Organization] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - personConnectionCount: Int! - totalCount: Int! -} - -""" -An edge in a connection. -""" -type OrganizationEdge { +type InteractiveResourceEdge { """ A cursor for use in pagination. """ @@ -5486,10 +5266,10 @@ type OrganizationEdge { """ The item at the end of the edge. """ - node: Organization + node: InteractiveResource } -type Other implements DoiItem { +type Model implements DoiItem { """ The DOI registration agency for the resource """ @@ -5884,18 +5664,18 @@ type Other implements DoiItem { } """ -The connection type for Other. +The connection type for Model. """ -type OtherConnection { +type ModelConnection { """ A list of edges. """ - edges: [OtherEdge] + edges: [ModelEdge] """ A list of nodes. """ - nodes: [Other] + nodes: [Model] """ Information to aid in pagination. @@ -5908,7 +5688,7 @@ type OtherConnection { """ An edge in a connection. """ -type OtherEdge { +type ModelEdge { """ A cursor for use in pagination. """ @@ -5917,45 +5697,30 @@ type OtherEdge { """ The item at the end of the edge. """ - node: Other + node: Model } """ -Information about pagination in a connection. +Information about organizations """ -type PageInfo { - """ - When paginating forwards, the cursor to continue. - """ - endCursor: String - - """ - When paginating forwards, are there more items? - """ - hasNextPage: Boolean! - +type Organization { """ - When paginating backwards, are there more items? + Physical address of the organization. """ - hasPreviousPage: Boolean! + address: Address """ - When paginating backwards, the cursor to continue. + An alias for the organization. """ - startCursor: String -} + alternateName: [String!] -""" -A person. -""" -type Person { """ The number of citations. """ citationCount: Int """ - Authored datasets + Datasets from this organization """ datasets( """ @@ -5969,10 +5734,9 @@ type Person { before: String clientId: String first: Int = 25 + funderId: String hasCitations: Int hasDownloads: Int - hasFunder: Boolean - hasOrganization: Boolean hasParts: Int hasVersions: Int hasViews: Int @@ -5984,6 +5748,7 @@ type Person { last: Int providerId: String query: String + userId: String ): DatasetConnection """ @@ -5992,27 +5757,22 @@ type Person { downloadCount: Int """ - Family name. In the U.S., the last name of an Person. - """ - familyName: String - - """ - Given name. In the U.S., the first name of a Person. + ROR ID """ - givenName: String + id: ID """ - The ORCID ID of the person. + The identifier(s) for the organization. """ - id: ID + identifiers: [Identifier!] """ - The name of the person. + The name of the organization. """ - name: String + name: String! """ - Authored publications + Publications from this organization """ publications( """ @@ -6026,10 +5786,9 @@ type Person { before: String clientId: String first: Int = 25 + funderId: String hasCitations: Int hasDownloads: Int - hasFunder: Boolean - hasOrganization: Boolean hasParts: Int hasVersions: Int hasViews: Int @@ -6041,10 +5800,11 @@ type Person { last: Int providerId: String query: String + userId: String ): PublicationConnection """ - Authored software + Software from this organization """ softwares( """ @@ -6058,10 +5818,9 @@ type Person { before: String clientId: String first: Int = 25 + funderId: String hasCitations: Int hasDownloads: Int - hasFunder: Boolean - hasOrganization: Boolean hasParts: Int hasVersions: Int hasViews: Int @@ -6073,6 +5832,7 @@ type Person { last: Int providerId: String query: String + userId: String ): SoftwareConnection """ @@ -6080,17 +5840,20 @@ type Person { """ type: String! + """ + URL of the organization. + """ + url: [String!] + """ The number of views according to the Counter Code of Practice. """ viewCount: Int """ - Authored works + Works from this organization """ works( - affiliationId: String - """ Returns the elements in the list that come after the specified cursor. """ @@ -6102,10 +5865,9 @@ type Person { before: String clientId: String first: Int = 25 + funderId: String hasCitations: Int hasDownloads: Int - hasFunder: Boolean - hasOrganization: Boolean hasParts: Int hasVersions: Int hasViews: Int @@ -6117,39 +5879,36 @@ type Person { last: Int providerId: String query: String + userId: String ): WorkConnection } """ -The connection type for Person. +The connection type for Organization. """ -type PersonConnection { - datasetConnectionCount: Int! - +type OrganizationConnection { """ A list of edges. """ - edges: [PersonEdge] + edges: [OrganizationEdge] """ A list of nodes. """ - nodes: [Person] - organizationConnectionCount: Int! + nodes: [Organization] """ Information to aid in pagination. """ pageInfo: PageInfo! - publicationConnectionCount: Int! - softwareConnectionCount: Int! + personConnectionCount: Int! totalCount: Int! } """ An edge in a connection. """ -type PersonEdge { +type OrganizationEdge { """ A cursor for use in pagination. """ @@ -6158,10 +5917,10 @@ type PersonEdge { """ The item at the end of the edge. """ - node: Person + node: Organization } -type PhysicalObject implements DoiItem { +type Other implements DoiItem { """ The DOI registration agency for the resource """ @@ -6556,18 +6315,18 @@ type PhysicalObject implements DoiItem { } """ -The connection type for PhysicalObject. +The connection type for Other. """ -type PhysicalObjectConnection { +type OtherConnection { """ A list of edges. """ - edges: [PhysicalObjectEdge] + edges: [OtherEdge] """ A list of nodes. """ - nodes: [PhysicalObject] + nodes: [Other] """ Information to aid in pagination. @@ -6580,7 +6339,7 @@ type PhysicalObjectConnection { """ An edge in a connection. """ -type PhysicalObjectEdge { +type OtherEdge { """ A cursor for use in pagination. """ @@ -6589,106 +6348,47 @@ type PhysicalObjectEdge { """ The item at the end of the edge. """ - node: PhysicalObject -} - -""" -Information about prefixes -""" -type Prefix { - """ - Unique identifier for each prefix - """ - id: ID! - - """ - The type of the item. - """ - type: String! + node: Other } """ -The connection type for Prefix. +Information about pagination in a connection. """ -type PrefixConnection { - """ - A list of edges. - """ - edges: [PrefixEdge] - +type PageInfo { """ - A list of nodes. + When paginating forwards, the cursor to continue. """ - nodes: [Prefix] + endCursor: String """ - Information to aid in pagination. + When paginating forwards, are there more items? """ - pageInfo: PageInfo! - states: [Facet!]! - totalCount: Int! - years: [Facet!]! -} + hasNextPage: Boolean! -""" -An edge in a connection. -""" -type PrefixEdge { """ - A cursor for use in pagination. + When paginating backwards, are there more items? """ - cursor: String! + hasPreviousPage: Boolean! """ - The item at the end of the edge. + When paginating backwards, the cursor to continue. """ - node: Prefix + startCursor: String } """ -Information about providers +A person. """ -type Provider { +type Person { """ The number of citations. """ citationCount: Int """ - Clients associated with the provider - """ - clients( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - first: Int = 25 - - """ - Returns the last _n_ elements from the list. - """ - last: Int - query: String - software: String - year: String - ): ClientConnection - - """ - Country where the provider is located - """ - country: Country - - """ - Datasets by this provider. + Authored datasets """ datasets( - affiliationId: String - """ Returns the elements in the list that come after the specified cursor. """ @@ -6700,13 +6400,11 @@ type Provider { before: String clientId: String first: Int = 25 - funderId: String hasCitations: Int hasDownloads: Int hasFunder: Boolean hasOrganization: Boolean hasParts: Int - hasPerson: Boolean hasVersions: Int hasViews: Int ids: String @@ -6715,65 +6413,39 @@ type Provider { Returns the last _n_ elements from the list. """ last: Int + providerId: String query: String - resourceTypeId: String - userId: String ): DatasetConnection - """ - Description of the provider - """ - description: String - - """ - Provider display name - """ - displayName: String - """ The number of downloads according to the Counter Code of Practice. """ downloadCount: Int """ - Field of science covered by provider - """ - focusArea: String - - """ - Provider contact email - """ - groupEmail: String - - """ - Unique identifier for each provider - """ - id: ID! - - """ - Date provider joined DataCite + Family name. In the U.S., the last name of an Person. """ - joined: String + familyName: String """ - URL for the provider logo + Given name. In the U.S., the first name of a Person. """ - logoUrl: String + givenName: String """ - Provider name + The ORCID ID of the person. """ - name: String! + id: ID """ - Type of organization + The name of the person. """ - organizationType: String + name: String """ - Prefixes managed by the provider + Authored publications """ - prefixes( + publications( """ Returns the elements in the list that come after the specified cursor. """ @@ -6783,70 +6455,29 @@ type Provider { Returns the elements in the list that come before the specified cursor. """ before: String + clientId: String first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasVersions: Int + hasViews: Int + ids: String """ Returns the last _n_ elements from the list. """ last: Int + providerId: String query: String - state: String - year: String - ): ProviderPrefixConnection + ): PublicationConnection """ - Publications by this provider. - """ - publications( - affiliationId: String - - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String - - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - clientId: String - first: Int = 25 - funderId: String - hasCitations: Int - hasDownloads: Int - hasFunder: Boolean - hasOrganization: Boolean - hasParts: Int - hasPerson: Boolean - hasVersions: Int - hasViews: Int - ids: String - - """ - Returns the last _n_ elements from the list. - """ - last: Int - query: String - resourceTypeId: String - userId: String - ): PublicationConnection - - """ - Geographic region where the provider is located - """ - region: String - - """ - Research Organization Registry (ROR) identifier - """ - rorId: String! - - """ - Software by this provider. + Authored software """ softwares( - affiliationId: String - """ Returns the elements in the list that come after the specified cursor. """ @@ -6858,13 +6489,11 @@ type Provider { before: String clientId: String first: Int = 25 - funderId: String hasCitations: Int hasDownloads: Int hasFunder: Boolean hasOrganization: Boolean hasParts: Int - hasPerson: Boolean hasVersions: Int hasViews: Int ids: String @@ -6873,9 +6502,8 @@ type Provider { Returns the last _n_ elements from the list. """ last: Int + providerId: String query: String - resourceTypeId: String - userId: String ): SoftwareConnection """ @@ -6889,12 +6517,7 @@ type Provider { viewCount: Int """ - Website of the provider - """ - website: String - - """ - Works by this provider. + Authored works """ works( affiliationId: String @@ -6910,13 +6533,11 @@ type Provider { before: String clientId: String first: Int = 25 - funderId: String hasCitations: Int hasDownloads: Int hasFunder: Boolean hasOrganization: Boolean hasParts: Int - hasPerson: Boolean hasVersions: Int hasViews: Int ids: String @@ -6925,95 +6546,41 @@ type Provider { Returns the last _n_ elements from the list. """ last: Int + providerId: String query: String - resourceTypeId: String - userId: String ): WorkConnection } """ -The connection type for Provider. -""" -type ProviderConnection { - """ - A list of edges. - """ - edges: [ProviderEdge] - - """ - A list of nodes. - """ - nodes: [Provider] - - """ - Information to aid in pagination. - """ - pageInfo: PageInfo! - totalCount: Int! -} - -""" -An edge in a connection. -""" -type ProviderEdge { - """ - A cursor for use in pagination. - """ - cursor: String! - - """ - The item at the end of the edge. - """ - node: Provider -} - -""" -Information about provider prefixes +The connection type for Person. """ -type ProviderPrefix { - """ - Unique identifier for each provider prefix - """ - id: ID! - - """ - Provider prefix name - """ - name: String! - - """ - The type of the item. - """ - type: String! -} +type PersonConnection { + datasetConnectionCount: Int! -""" -The connection type for ProviderPrefix. -""" -type ProviderPrefixConnection { """ A list of edges. """ - edges: [ProviderPrefixEdge] + edges: [PersonEdge] """ A list of nodes. """ - nodes: [ProviderPrefix] + nodes: [Person] + organizationConnectionCount: Int! """ Information to aid in pagination. """ pageInfo: PageInfo! - states: [Facet!]! + publicationConnectionCount: Int! + softwareConnectionCount: Int! totalCount: Int! - years: [Facet!]! } """ An edge in a connection. """ -type ProviderPrefixEdge { +type PersonEdge { """ A cursor for use in pagination. """ @@ -7022,10 +6589,10 @@ type ProviderPrefixEdge { """ The item at the end of the edge. """ - node: ProviderPrefix + node: Person } -type Publication implements DoiItem { +type PhysicalObject implements DoiItem { """ The DOI registration agency for the resource """ @@ -7420,30 +6987,23 @@ type Publication implements DoiItem { } """ -The connection type for Publication. +The connection type for PhysicalObject. """ -type PublicationConnection { - datasetConnectionCount: Int! - +type PhysicalObjectConnection { """ A list of edges. """ - edges: [PublicationEdge] - funderConnectionCount: Int! + edges: [PhysicalObjectEdge] """ A list of nodes. """ - nodes: [Publication] - organizationConnectionCount: Int! + nodes: [PhysicalObject] """ Information to aid in pagination. """ pageInfo: PageInfo! - personConnectionCount: Int! - publicationConnectionCount: Int! - softwareConnectionCount: Int! totalCount: Int! years: [Facet!] } @@ -7451,7 +7011,7 @@ type PublicationConnection { """ An edge in a connection. """ -type PublicationEdge { +type PhysicalObjectEdge { """ A cursor for use in pagination. """ @@ -7460,42 +7020,74 @@ type PublicationEdge { """ The item at the end of the edge. """ - node: Publication + node: PhysicalObject } -type Query { - _service: _Service! - audiovisual(id: ID!): Audiovisual! - audiovisuals( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String +""" +Information about prefixes +""" +type Prefix { + """ + Unique identifier for each prefix + """ + id: ID! - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - clientId: String - first: Int = 25 - hasCitations: Int - hasDownloads: Int - hasFunder: Boolean - hasOrganization: Boolean - hasParts: Int - hasPerson: Boolean - hasVersions: Int - hasViews: Int + """ + The type of the item. + """ + type: String! +} - """ - Returns the last _n_ elements from the list. - """ - last: Int - providerId: String - query: String - userId: String - ): AudiovisualConnection! - client(id: ID!): Client! +""" +The connection type for Prefix. +""" +type PrefixConnection { + """ + A list of edges. + """ + edges: [PrefixEdge] + + """ + A list of nodes. + """ + nodes: [Prefix] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + states: [Facet!]! + totalCount: Int! + years: [Facet!]! +} + +""" +An edge in a connection. +""" +type PrefixEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Prefix +} + +""" +Information about providers +""" +type Provider { + """ + The number of citations. + """ + citationCount: Int + + """ + Clients associated with the provider + """ clients( """ Returns the elements in the list that come after the specified cursor. @@ -7515,7 +7107,846 @@ type Query { query: String software: String year: String - ): ClientConnection! + ): ClientConnection + + """ + Country where the provider is located + """ + country: Country + + """ + Datasets by this provider. + """ + datasets( + affiliationId: String + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + funderId: String + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + resourceTypeId: String + userId: String + ): DatasetConnection + + """ + Description of the provider + """ + description: String + + """ + Provider display name + """ + displayName: String + + """ + The number of downloads according to the Counter Code of Practice. + """ + downloadCount: Int + + """ + Field of science covered by provider + """ + focusArea: String + + """ + Provider contact email + """ + groupEmail: String + + """ + Unique identifier for each provider + """ + id: ID! + + """ + Date provider joined DataCite + """ + joined: String + + """ + URL for the provider logo + """ + logoUrl: String + + """ + Provider name + """ + name: String! + + """ + Type of organization + """ + organizationType: String + + """ + Prefixes managed by the provider + """ + prefixes( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + first: Int = 25 + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + state: String + year: String + ): ProviderPrefixConnection + + """ + Publications by this provider. + """ + publications( + affiliationId: String + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + funderId: String + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + resourceTypeId: String + userId: String + ): PublicationConnection + + """ + Geographic region where the provider is located + """ + region: String + + """ + Research Organization Registry (ROR) identifier + """ + rorId: String! + + """ + Software by this provider. + """ + softwares( + affiliationId: String + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + funderId: String + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + resourceTypeId: String + userId: String + ): SoftwareConnection + + """ + The type of the item. + """ + type: String! + + """ + The number of views according to the Counter Code of Practice. + """ + viewCount: Int + + """ + Website of the provider + """ + website: String + + """ + Works by this provider. + """ + works( + affiliationId: String + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + funderId: String + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + resourceTypeId: String + userId: String + ): WorkConnection +} + +""" +The connection type for Provider. +""" +type ProviderConnection { + """ + A list of edges. + """ + edges: [ProviderEdge] + + """ + A list of nodes. + """ + nodes: [Provider] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + totalCount: Int! +} + +""" +An edge in a connection. +""" +type ProviderEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Provider +} + +""" +Information about provider prefixes +""" +type ProviderPrefix { + """ + Unique identifier for each provider prefix + """ + id: ID! + + """ + Provider prefix name + """ + name: String! + + """ + The type of the item. + """ + type: String! +} + +""" +The connection type for ProviderPrefix. +""" +type ProviderPrefixConnection { + """ + A list of edges. + """ + edges: [ProviderPrefixEdge] + + """ + A list of nodes. + """ + nodes: [ProviderPrefix] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + states: [Facet!]! + totalCount: Int! + years: [Facet!]! +} + +""" +An edge in a connection. +""" +type ProviderPrefixEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: ProviderPrefix +} + +type Publication implements DoiItem { + """ + The DOI registration agency for the resource + """ + agency: String + + """ + Total number of citations + """ + citationCount: Int + + """ + Citations for this DOI. + """ + citations( + affiliationId: String + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + funderId: String + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): WorkConnection + + """ + Citations by year + """ + citationsOverTime: [YearTotal!] + + """ + The client account managing this resource + """ + client: Client + + """ + The main researchers involved in producing the data, or the authors of the publication, in priority order + """ + creators(first: Int = 20): [Creator!] + + """ + Different dates relevant to the work + """ + dates: [Date!] + + """ + All additional information that does not fit in any of the other categories + """ + descriptions(first: Int = 5): [Description!] + + """ + Total number of downloads + """ + downloadCount: Int + + """ + Downloads by month + """ + downloadsOverTime: [YearMonthTotal!] + + """ + Technical format of the resource + """ + formats: [String!] + + """ + Metadata as formatted citation + """ + formattedCitation(locale: String = "en-US", style: String = "apa"): String + + """ + Information about financial support (funding) for the resource being registered + """ + fundingReferences: [Funding!] + + """ + The persistent identifier for the resource + """ + id: ID! + + """ + An identifier or identifiers applied to the resource being registered + """ + identifiers: [Identifier!] + + """ + The primary language of the resource + """ + language: String + + """ + Total number of parts + """ + partCount: Int + + """ + The DOI is a part of this DOI. + """ + partOf( + affiliationId: String + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + funderId: String + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): WorkConnection + + """ + Total number of DOIs the resource is a part of + """ + partOfCount: Int + + """ + Parts of this DOI. + """ + parts( + affiliationId: String + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + funderId: String + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): WorkConnection + + """ + The provider account managing this resource + """ + provider: Provider + + """ + The year when the data was or will be made publicly available + """ + publicationYear: Int + + """ + The name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource + """ + publisher: String + + """ + Total number of references + """ + referenceCount: Int + + """ + References for this DOI + """ + references( + affiliationId: String + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + funderId: String + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): WorkConnection + + """ + Identifiers of related resources. These must be globally unique identifiers + """ + relatedIdentifiers: [RelatedIdentifier!] + + """ + Any rights information for this resource + """ + rights: [Rights!] + + """ + Size (e.g. bytes, pages, inches, etc.) or duration (extent), e.g. hours, minutes, days, etc., of a resource + """ + sizes: [String!] + + """ + Subject, keyword, classification code, or key phrase describing the resource + """ + subjects: [Subject!] + + """ + A name or title by which a resource is known + """ + titles(first: Int = 5): [Title!] + + """ + The type of the item. + """ + type: String! + + """ + The resource type + """ + types: ResourceType + + """ + The URL registered for the resource + """ + url: String + + """ + The version number of the resource + """ + version: String + + """ + Total number of versions + """ + versionCount: Int + + """ + The DOI is a version of this DOI. + """ + versionOf( + affiliationId: String + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + funderId: String + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): WorkConnection + + """ + Total number of DOIs the resource is a version of + """ + versionOfCount: Int + + """ + Versions of this DOI. + """ + versions( + affiliationId: String + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + funderId: String + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): WorkConnection + + """ + Total number of views + """ + viewCount: Int + + """ + Views by month + """ + viewsOverTime: [YearMonthTotal!] +} + +""" +The connection type for Publication. +""" +type PublicationConnection { + datasetConnectionCount: Int! + + """ + A list of edges. + """ + edges: [PublicationEdge] + funderConnectionCount: Int! + + """ + A list of nodes. + """ + nodes: [Publication] + organizationConnectionCount: Int! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + personConnectionCount: Int! + publicationConnectionCount: Int! + softwareConnectionCount: Int! + totalCount: Int! + years: [Facet!] +} + +""" +An edge in a connection. +""" +type PublicationEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Publication +} + +type Query { + _service: _Service! + audiovisual(id: ID!): Audiovisual! + audiovisuals( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): AudiovisualConnection! + client(id: ID!): Client! + clients( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + first: Int = 25 + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + software: String + year: String + ): ClientConnection! collection(id: ID!): Collection! collections( """ @@ -7545,9 +7976,118 @@ type Query { providerId: String query: String userId: String - ): CollectionConnection! - dataCatalog(id: ID!): DataCatalog! - dataCatalogs( + ): CollectionConnection! + dataCatalog(id: ID!): DataCatalog! + dataCatalogs( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + first: Int = 25 + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + ): DataCatalogConnection! + dataPaper(id: ID!): DataPaper! + dataPapers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): DataPaperConnection! + dataset(id: ID!): Dataset! + datasets( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): DatasetConnection! + event(id: ID!): Event! + events( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): EventConnection! + funder(id: ID!): Funder! + funders( """ Returns the elements in the list that come after the specified cursor. """ @@ -7564,9 +8104,9 @@ type Query { """ last: Int query: String - ): DataCatalogConnection! - dataPaper(id: ID!): DataPaper! - dataPapers( + ): FunderConnection! + image(id: ID!): Image! + images( """ Returns the elements in the list that come after the specified cursor. """ @@ -7594,9 +8134,9 @@ type Query { providerId: String query: String userId: String - ): DataPaperConnection! - dataset(id: ID!): Dataset! - datasets( + ): ImageConnection! + instrument(id: ID!): Other! + instruments( """ Returns the elements in the list that come after the specified cursor. """ @@ -7624,9 +8164,9 @@ type Query { providerId: String query: String userId: String - ): DatasetConnection! - event(id: ID!): Event! - events( + ): InstrumentConnection! + interactiveResource(id: ID!): InteractiveResource! + interactiveResources( """ Returns the elements in the list that come after the specified cursor. """ @@ -7654,9 +8194,9 @@ type Query { providerId: String query: String userId: String - ): EventConnection! - funder(id: ID!): Funder! - funders( + ): InteractiveResourceConnection! + model(id: ID!): Model! + models( """ Returns the elements in the list that come after the specified cursor. """ @@ -7666,16 +8206,50 @@ type Query { Returns the elements in the list that come before the specified cursor. """ before: String + clientId: String first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int """ Returns the last _n_ elements from the list. """ last: Int + providerId: String query: String - ): FunderConnection! - image(id: ID!): Image! - images( + userId: String + ): ModelConnection! + organization(id: ID!): Organization! + organizations( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + ): OrganizationConnection! + other(id: ID!): Other! + others( """ Returns the elements in the list that come after the specified cursor. """ @@ -7703,9 +8277,186 @@ type Query { providerId: String query: String userId: String - ): ImageConnection! - interactiveResource(id: ID!): InteractiveResource! - interactiveResources( + ): OtherConnection! + people( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + first: Int = 25 + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + ): PersonConnection! + person(id: ID!): Person! + physicalObject(id: ID!): PhysicalObject! + physicalObjects( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): PhysicalObjectConnection! + prefix(id: ID!): Prefix! + prefixes( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + first: Int = 25 + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + ): PrefixConnection! + provider(id: ID!): Provider! + providers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + first: Int = 25 + + """ + Returns the last _n_ elements from the list. + """ + last: Int + query: String + ): ProviderConnection! + publication(id: ID!): Publication! + publications( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): PublicationConnection! + service(id: ID!): Service! + services( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): ServiceConnection! + software(id: ID!): Software! + softwares( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + clientId: String + first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + providerId: String + query: String + userId: String + ): SoftwareConnection! + sound(id: ID!): Sound! + sounds( """ Returns the elements in the list that come after the specified cursor. """ @@ -7733,9 +8484,8 @@ type Query { providerId: String query: String userId: String - ): InteractiveResourceConnection! - model(id: ID!): Model! - models( + ): SoundConnection! + theses( """ Returns the elements in the list that come after the specified cursor. """ @@ -7763,9 +8513,10 @@ type Query { providerId: String query: String userId: String - ): ModelConnection! - organization(id: ID!): Organization! - organizations( + ): ThesisConnection! + thesis(id: ID!): Publication! + usageReport(id: ID!): UsageReport! + usageReports( """ Returns the elements in the list that come after the specified cursor. """ @@ -7775,20 +8526,16 @@ type Query { Returns the elements in the list that come before the specified cursor. """ before: String - - """ - Returns the first _n_ elements from the list. - """ - first: Int + first: Int = 25 """ Returns the last _n_ elements from the list. """ last: Int - query: String - ): OrganizationConnection! - other(id: ID!): Other! - others( + ): UsageReportConnection! + work(id: ID!): Work! + workflow(id: ID!): Workflow! + workflows( """ Returns the elements in the list that come after the specified cursor. """ @@ -7816,8 +8563,8 @@ type Query { providerId: String query: String userId: String - ): OtherConnection! - people( + ): WorkflowConnection! + works( """ Returns the elements in the list that come after the specified cursor. """ @@ -7827,17 +8574,156 @@ type Query { Returns the elements in the list that come before the specified cursor. """ before: String + clientId: String first: Int = 25 + hasCitations: Int + hasDownloads: Int + hasFunder: Boolean + hasOrganization: Boolean + hasParts: Int + hasPerson: Boolean + hasVersions: Int + hasViews: Int + ids: String """ Returns the last _n_ elements from the list. """ last: Int + providerId: String query: String - ): PersonConnection! - person(id: ID!): Person! - physicalObject(id: ID!): PhysicalObject! - physicalObjects( + resourceTypeId: String + userId: String + ): WorkConnection! +} + +""" +Information about related identifiers +""" +type RelatedIdentifier { + """ + Related identifier + """ + relatedIdentifier: String + + """ + Related identifier type + """ + relatedIdentifierType: String + + """ + Related metadata scheme + """ + relatedMetadataScheme: String + + """ + Relation type + """ + relationType: String + + """ + Resource type general + """ + resourceTypeGeneral: String + + """ + Scheme type + """ + schemeType: String + + """ + Scheme URI + """ + schemeUri: String +} + +""" +Information about reporting periods +""" +type ReportingPeriod { + """ + Begin reporting period + """ + beginDate: String + + """ + End reporting period + """ + endDate: String +} + +""" +Information about types +""" +type ResourceType { + """ + BibTex + """ + bibtex: String + + """ + Citeproc + """ + citeproc: String + + """ + Resource type + """ + resourceType: String + + """ + Resource type general + """ + resourceTypeGeneral: String + + """ + RIS + """ + ris: String + + """ + Schema.org + """ + schemaOrg: String +} + +""" +Information about rights +""" +type Rights { + """ + Language + """ + lang: String + + """ + Any rights information for this resource + """ + rights: String + + """ + The URI of the license + """ + rightsUri: String +} + +type Service implements DoiItem { + """ + The DOI registration agency for the resource + """ + agency: String + + """ + Total number of citations + """ + citationCount: Int + + """ + Citations for this DOI. + """ + citations( + affiliationId: String + """ Returns the elements in the list that come after the specified cursor. """ @@ -7849,6 +8735,7 @@ type Query { before: String clientId: String first: Int = 25 + funderId: String hasCitations: Int hasDownloads: Int hasFunder: Boolean @@ -7857,6 +8744,7 @@ type Query { hasPerson: Boolean hasVersions: Int hasViews: Int + ids: String """ Returns the last _n_ elements from the list. @@ -7865,47 +8753,84 @@ type Query { providerId: String query: String userId: String - ): PhysicalObjectConnection! - prefix(id: ID!): Prefix! - prefixes( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String + ): WorkConnection - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - first: Int = 25 + """ + Citations by year + """ + citationsOverTime: [YearTotal!] + + """ + The client account managing this resource + """ + client: Client + + """ + The main researchers involved in producing the data, or the authors of the publication, in priority order + """ + creators(first: Int = 20): [Creator!] + + """ + Different dates relevant to the work + """ + dates: [Date!] + + """ + All additional information that does not fit in any of the other categories + """ + descriptions(first: Int = 5): [Description!] + + """ + Total number of downloads + """ + downloadCount: Int + + """ + Downloads by month + """ + downloadsOverTime: [YearMonthTotal!] + + """ + Technical format of the resource + """ + formats: [String!] + + """ + Metadata as formatted citation + """ + formattedCitation(locale: String = "en-US", style: String = "apa"): String + + """ + Information about financial support (funding) for the resource being registered + """ + fundingReferences: [Funding!] + + """ + The persistent identifier for the resource + """ + id: ID! + + """ + An identifier or identifiers applied to the resource being registered + """ + identifiers: [Identifier!] + + """ + The primary language of the resource + """ + language: String - """ - Returns the last _n_ elements from the list. - """ - last: Int - query: String - ): PrefixConnection! - provider(id: ID!): Provider! - providers( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String + """ + Total number of parts + """ + partCount: Int - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - first: Int = 25 + """ + The DOI is a part of this DOI. + """ + partOf( + affiliationId: String - """ - Returns the last _n_ elements from the list. - """ - last: Int - query: String - ): ProviderConnection! - publication(id: ID!): Publication! - publications( """ Returns the elements in the list that come after the specified cursor. """ @@ -7917,6 +8842,7 @@ type Query { before: String clientId: String first: Int = 25 + funderId: String hasCitations: Int hasDownloads: Int hasFunder: Boolean @@ -7925,6 +8851,7 @@ type Query { hasPerson: Boolean hasVersions: Int hasViews: Int + ids: String """ Returns the last _n_ elements from the list. @@ -7933,39 +8860,19 @@ type Query { providerId: String query: String userId: String - ): PublicationConnection! - service(id: ID!): Service! - services( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String + ): WorkConnection - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - clientId: String - first: Int = 25 - hasCitations: Int - hasDownloads: Int - hasFunder: Boolean - hasOrganization: Boolean - hasParts: Int - hasPerson: Boolean - hasVersions: Int - hasViews: Int + """ + Total number of DOIs the resource is a part of + """ + partOfCount: Int + + """ + Parts of this DOI. + """ + parts( + affiliationId: String - """ - Returns the last _n_ elements from the list. - """ - last: Int - providerId: String - query: String - userId: String - ): ServiceConnection! - software(id: ID!): Software! - softwares( """ Returns the elements in the list that come after the specified cursor. """ @@ -7977,6 +8884,7 @@ type Query { before: String clientId: String first: Int = 25 + funderId: String hasCitations: Int hasDownloads: Int hasFunder: Boolean @@ -7985,6 +8893,7 @@ type Query { hasPerson: Boolean hasVersions: Int hasViews: Int + ids: String """ Returns the last _n_ elements from the list. @@ -7993,9 +8902,34 @@ type Query { providerId: String query: String userId: String - ): SoftwareConnection! - sound(id: ID!): Sound! - sounds( + ): WorkConnection + + """ + The provider account managing this resource + """ + provider: Provider + + """ + The year when the data was or will be made publicly available + """ + publicationYear: Int + + """ + The name of the entity that holds, archives, publishes prints, distributes, releases, issues, or produces the resource + """ + publisher: String + + """ + Total number of references + """ + referenceCount: Int + + """ + References for this DOI + """ + references( + affiliationId: String + """ Returns the elements in the list that come after the specified cursor. """ @@ -8007,6 +8941,7 @@ type Query { before: String clientId: String first: Int = 25 + funderId: String hasCitations: Int hasDownloads: Int hasFunder: Boolean @@ -8015,6 +8950,7 @@ type Query { hasPerson: Boolean hasVersions: Int hasViews: Int + ids: String """ Returns the last _n_ elements from the list. @@ -8023,28 +8959,64 @@ type Query { providerId: String query: String userId: String - ): SoundConnection! - usageReport(id: ID!): UsageReport! - usageReports( - """ - Returns the elements in the list that come after the specified cursor. - """ - after: String + ): WorkConnection - """ - Returns the elements in the list that come before the specified cursor. - """ - before: String - first: Int = 25 + """ + Identifiers of related resources. These must be globally unique identifiers + """ + relatedIdentifiers: [RelatedIdentifier!] + + """ + Any rights information for this resource + """ + rights: [Rights!] + + """ + Size (e.g. bytes, pages, inches, etc.) or duration (extent), e.g. hours, minutes, days, etc., of a resource + """ + sizes: [String!] + + """ + Subject, keyword, classification code, or key phrase describing the resource + """ + subjects: [Subject!] + + """ + A name or title by which a resource is known + """ + titles(first: Int = 5): [Title!] + + """ + The type of the item. + """ + type: String! + + """ + The resource type + """ + types: ResourceType + + """ + The URL registered for the resource + """ + url: String + + """ + The version number of the resource + """ + version: String + + """ + Total number of versions + """ + versionCount: Int + + """ + The DOI is a version of this DOI. + """ + versionOf( + affiliationId: String - """ - Returns the last _n_ elements from the list. - """ - last: Int - ): UsageReportConnection! - work(id: ID!): Work! - workflow(id: ID!): Workflow! - workflows( """ Returns the elements in the list that come after the specified cursor. """ @@ -8056,6 +9028,7 @@ type Query { before: String clientId: String first: Int = 25 + funderId: String hasCitations: Int hasDownloads: Int hasFunder: Boolean @@ -8064,6 +9037,7 @@ type Query { hasPerson: Boolean hasVersions: Int hasViews: Int + ids: String """ Returns the last _n_ elements from the list. @@ -8072,8 +9046,19 @@ type Query { providerId: String query: String userId: String - ): WorkflowConnection! - works( + ): WorkConnection + + """ + Total number of DOIs the resource is a version of + """ + versionOfCount: Int + + """ + Versions of this DOI. + """ + versions( + affiliationId: String + """ Returns the elements in the list that come after the specified cursor. """ @@ -8085,6 +9070,7 @@ type Query { before: String clientId: String first: Int = 25 + funderId: String hasCitations: Int hasDownloads: Int hasFunder: Boolean @@ -8101,122 +9087,58 @@ type Query { last: Int providerId: String query: String - resourceTypeId: String userId: String - ): WorkConnection! -} - -""" -Information about related identifiers -""" -type RelatedIdentifier { - """ - Related identifier - """ - relatedIdentifier: String - - """ - Related identifier type - """ - relatedIdentifierType: String - - """ - Related metadata scheme - """ - relatedMetadataScheme: String - - """ - Relation type - """ - relationType: String - - """ - Resource type general - """ - resourceTypeGeneral: String - - """ - Scheme type - """ - schemeType: String - - """ - Scheme URI - """ - schemeUri: String -} - -""" -Information about reporting periods -""" -type ReportingPeriod { + ): WorkConnection + """ - Begin reporting period + Total number of views """ - beginDate: String + viewCount: Int """ - End reporting period + Views by month """ - endDate: String + viewsOverTime: [YearMonthTotal!] } """ -Information about types +The connection type for Service. """ -type ResourceType { - """ - BibTex - """ - bibtex: String - - """ - Citeproc - """ - citeproc: String - - """ - Resource type - """ - resourceType: String - +type ServiceConnection { """ - Resource type general + A list of edges. """ - resourceTypeGeneral: String + edges: [ServiceEdge] """ - RIS + A list of nodes. """ - ris: String + nodes: [Service] """ - Schema.org + Information to aid in pagination. """ - schemaOrg: String + pageInfo: PageInfo! + totalCount: Int! + years: [Facet!] } """ -Information about rights +An edge in a connection. """ -type Rights { - """ - Language - """ - lang: String - +type ServiceEdge { """ - Any rights information for this resource + A cursor for use in pagination. """ - rights: String + cursor: String! """ - The URI of the license + The item at the end of the edge. """ - rightsUri: String + node: Service } -type Service implements DoiItem { +type Software implements DoiItem { """ The DOI registration agency for the resource """ @@ -8611,23 +9533,55 @@ type Service implements DoiItem { } """ -The connection type for Service. +A software application. """ -type ServiceConnection { +type SoftwareApplication { + """ + A description of the item. + """ + description: String + + """ + The name of the item. + """ + name: String + + """ + Version of the software instance. + """ + softwareVersion: String + + """ + URL of the item. + """ + url: String +} + +""" +The connection type for Software. +""" +type SoftwareConnection { + datasetConnectionCount: Int! + """ A list of edges. """ - edges: [ServiceEdge] + edges: [SoftwareEdge] + funderConnectionCount: Int! """ A list of nodes. """ - nodes: [Service] + nodes: [Software] + organizationConnectionCount: Int! """ Information to aid in pagination. """ pageInfo: PageInfo! + personConnectionCount: Int! + publicationConnectionCount: Int! + softwareConnectionCount: Int! totalCount: Int! years: [Facet!] } @@ -8635,7 +9589,7 @@ type ServiceConnection { """ An edge in a connection. """ -type ServiceEdge { +type SoftwareEdge { """ A cursor for use in pagination. """ @@ -8644,10 +9598,10 @@ type ServiceEdge { """ The item at the end of the edge. """ - node: Service + node: Software } -type Software implements DoiItem { +type Sound implements DoiItem { """ The DOI registration agency for the resource """ @@ -9042,75 +9996,98 @@ type Software implements DoiItem { } """ -A software application. +The connection type for Sound. """ -type SoftwareApplication { +type SoundConnection { """ - A description of the item. + A list of edges. """ - description: String + edges: [SoundEdge] """ - The name of the item. + A list of nodes. """ - name: String + nodes: [Sound] """ - Version of the software instance. + Information to aid in pagination. """ - softwareVersion: String + pageInfo: PageInfo! + totalCount: Int! + years: [Facet!] +} + +""" +An edge in a connection. +""" +type SoundEdge { + """ + A cursor for use in pagination. + """ + cursor: String! """ - URL of the item. + The item at the end of the edge. """ - url: String + node: Sound } """ -The connection type for Software. +Subject information """ -type SoftwareConnection { - datasetConnectionCount: Int! +type Subject { + """ + Language + """ + lang: ID """ - A list of edges. + The URI of the subject identifier scheme """ - edges: [SoftwareEdge] - funderConnectionCount: Int! + schemeUri: String """ - A list of nodes. + Subject, keyword, classification code, or key phrase describing the resource """ - nodes: [Software] - organizationConnectionCount: Int! + subject: String """ - Information to aid in pagination. + The name of the subject scheme or classification code or authority if one is used """ - pageInfo: PageInfo! - personConnectionCount: Int! - publicationConnectionCount: Int! - softwareConnectionCount: Int! - totalCount: Int! - years: [Facet!] + subjectScheme: String + + """ + The URI of the subject term + """ + valueUri: String } """ -An edge in a connection. +Information """ -type SoftwareEdge { +type Text { """ - A cursor for use in pagination. + Information """ - cursor: String! + text: String! +} +""" +Information +""" +type TextRestriction { """ - The item at the end of the edge. + Restriction """ - node: Software + restriction: [Text!] + + """ + Information + """ + text: String! } -type Sound implements DoiItem { +type Thesis implements DoiItem { """ The DOI registration agency for the resource """ @@ -9505,18 +10482,18 @@ type Sound implements DoiItem { } """ -The connection type for Sound. +The connection type for Thesis. """ -type SoundConnection { +type ThesisConnection { """ A list of edges. """ - edges: [SoundEdge] + edges: [ThesisEdge] """ A list of nodes. """ - nodes: [Sound] + nodes: [Thesis] """ Information to aid in pagination. @@ -9529,7 +10506,7 @@ type SoundConnection { """ An edge in a connection. """ -type SoundEdge { +type ThesisEdge { """ A cursor for use in pagination. """ @@ -9538,62 +10515,7 @@ type SoundEdge { """ The item at the end of the edge. """ - node: Sound -} - -""" -Subject information -""" -type Subject { - """ - Language - """ - lang: ID - - """ - The URI of the subject identifier scheme - """ - schemeUri: String - - """ - Subject, keyword, classification code, or key phrase describing the resource - """ - subject: String - - """ - The name of the subject scheme or classification code or authority if one is used - """ - subjectScheme: String - - """ - The URI of the subject term - """ - valueUri: String -} - -""" -Information -""" -type Text { - """ - Information - """ - text: String! -} - -""" -Information -""" -type TextRestriction { - """ - Restriction - """ - restriction: [Text!] - - """ - Information - """ - text: String! + node: Thesis } """ diff --git a/app/graphql/types/instrument_connection_type.rb b/app/graphql/types/instrument_connection_type.rb new file mode 100644 index 000000000..8c642ccd3 --- /dev/null +++ b/app/graphql/types/instrument_connection_type.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +class InstrumentConnectionType < BaseConnection + edge_type(InstrumentEdgeType) + field_class GraphQL::Cache::Field + + field :total_count, Integer, null: false, cache: true + field :years, [FacetType], null: true, cache: true + + def total_count + args = prepare_args(object.arguments) + + response(**args).results.total + end + + def years + args = prepare_args(object.arguments) + + res = response(**args) + res.results.total.positive? ? facet_by_year(res.response.aggregations.years.buckets) : nil + end + + def response(**args) + @response ||= Doi.query(args[:query], + ids: args[:ids], + user_id: args[:user_id], + client_id: args[:client_id], + provider_id: args[:provider_id], + funder_id: args[:funder_id], + affiliation_id: args[:affiliation_id], + re3data_id: args[:re3data_id], + year: args[:year], + resource_type_id: "Other", + resource_type: "Instrument", + has_person: args[:has_person], + has_funder: args[:has_funder], + has_organization: args[:has_organization], + has_citations: args[:has_citations], + has_parts: args[:has_parts], + has_versions: args[:has_versions], + has_views: args[:has_views], + has_downloads: args[:has_downloads], + page: { number: 1, size: 0 }) + end +end diff --git a/app/graphql/types/instrument_edge_type.rb b/app/graphql/types/instrument_edge_type.rb new file mode 100644 index 000000000..102ee2a13 --- /dev/null +++ b/app/graphql/types/instrument_edge_type.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class InstrumentEdgeType < GraphQL::Types::Relay::BaseEdge + node_type(InstrumentType) +end diff --git a/app/graphql/types/instrument_type.rb b/app/graphql/types/instrument_type.rb new file mode 100644 index 000000000..f38fd7caa --- /dev/null +++ b/app/graphql/types/instrument_type.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class InstrumentType < BaseObject + implements DoiItem +end diff --git a/app/graphql/types/query_type.rb b/app/graphql/types/query_type.rb index 1d0c1fe90..baec85075 100644 --- a/app/graphql/types/query_type.rb +++ b/app/graphql/types/query_type.rb @@ -571,6 +571,67 @@ def workflow(id:) set_doi(id) end + field :theses, ThesisConnectionType, null: false, connection: true, max_page_size: 1000 do + argument :query, String, required: false + argument :user_id, String, required: false + argument :client_id, String, required: false + argument :provider_id, String, required: false + argument :has_person, Boolean, required: false + argument :has_funder, Boolean, required: false + argument :has_organization, Boolean, required: false + argument :has_citations, Int, required: false + argument :has_parts, Int, required: false + argument :has_versions, Int, required: false + argument :has_views, Int, required: false + argument :has_downloads, Int, required: false + argument :first, Int, required: false, default_value: 25 + end + + def theses(**args) + args[:resource_type_id] = "Text" + args[:resource_type] = "thesis" + response(**args) + end + + field :thesis, PublicationType, null: false do + argument :id, ID, required: true + end + + def thesis(id:) + set_doi(id) + end + + field :instruments, InstrumentConnectionType, null: false, connection: true, max_page_size: 1000 do + argument :query, String, required: false + argument :user_id, String, required: false + argument :client_id, String, required: false + argument :provider_id, String, required: false + argument :has_person, Boolean, required: false + argument :has_funder, Boolean, required: false + argument :has_organization, Boolean, required: false + argument :has_citations, Int, required: false + argument :has_parts, Int, required: false + argument :has_versions, Int, required: false + argument :has_views, Int, required: false + argument :has_downloads, Int, required: false + argument :first, Int, required: false, default_value: 25 + end + + def instruments(**args) + args[:resource_type_id] = "Other" + args[:resource_type] = "Instrument" + + response(**args) + end + + field :instrument, OtherType, null: false do + argument :id, ID, required: true + end + + def instrument(id:) + set_doi(id) + end + field :others, OtherConnectionType, null: false, connection: true, max_page_size: 1000 do argument :query, String, required: false argument :user_id, String, required: false @@ -620,7 +681,7 @@ def usage_report(id:) end def response(**args) - @response ||= Doi.query(args[:query], ids: args[:ids], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], resource_type_id: args[:resource_type_id], has_person: args[:has_person], has_funder: args[:has_funder], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] }).results.to_a + @response ||= Doi.query(args[:query], ids: args[:ids], user_id: args[:user_id], client_id: args[:client_id], provider_id: args[:provider_id], resource_type_id: args[:resource_type_id], resource_type: args[:resource_type], has_person: args[:has_person], has_funder: args[:has_funder], has_organization: args[:has_organization], has_citations: args[:has_citations], has_parts: args[:has_parts], has_versions: args[:has_versions], has_views: args[:has_views], has_downloads: args[:has_downloads], state: "findable", page: { number: 1, size: args[:first] }).results.to_a end def set_doi(id) diff --git a/app/graphql/types/software_connection_type.rb b/app/graphql/types/software_connection_type.rb index 57ab0e6c0..9c9ae6321 100644 --- a/app/graphql/types/software_connection_type.rb +++ b/app/graphql/types/software_connection_type.rb @@ -14,17 +14,14 @@ class SoftwareConnectionType < BaseConnection field :organization_connection_count, Integer, null: false, cache: true def total_count - args = object.arguments - args[:user_id] ||= object.parent.try(:orcid).present? ? orcid_from_url(object.parent.orcid) : nil - args[:client_id] ||= object.parent.try(:client_type).present? ? object.parent.symbol.downcase : nil - args[:provider_id] ||= object.parent.try(:role_name).present? ? object.parent.symbol.downcase : nil - - response(**args).results.total + args = prepare_args(object.arguments) + + response(**args).results.total end def years args = object.arguments - args[:provider_id] ||= object.parent.try(:role_name).present? ? object.parent.symbol.downcase : nil + args = prepare_args(object.arguments) res = response(**args) res.results.total.positive? ? facet_by_year(res.response.aggregations.years.buckets) : nil diff --git a/app/graphql/types/thesis_connection_type.rb b/app/graphql/types/thesis_connection_type.rb new file mode 100644 index 000000000..2a6731065 --- /dev/null +++ b/app/graphql/types/thesis_connection_type.rb @@ -0,0 +1,44 @@ +# frozen_string_literal: true + +class ThesisConnectionType < BaseConnection + edge_type(ThesisEdgeType) + field_class GraphQL::Cache::Field + + field :total_count, Integer, null: false, cache: true + field :years, [FacetType], null: true, cache: true + + def total_count + args = prepare_args(object.arguments) + + response(**args).results.total + end + + def years + args = prepare_args(object.arguments) + + res = response(**args) + res.results.total.positive? ? facet_by_year(res.response.aggregations.years.buckets) : nil + end + + def response(**args) + @response ||= Doi.query(args[:query], + user_id: args[:user_id], + client_id: args[:client_id], + provider_id: args[:provider_id], + funder_id: args[:funder_id], + affiliation_id: args[:affiliation_id], + re3data_id: args[:re3data_id], + year: args[:year], + resource_type_id: "Text", + resource_type: "Thesis", + has_person: args[:has_person], + has_funder: args[:has_funder], + has_organization: args[:has_organization], + has_citations: args[:has_citations], + has_parts: args[:has_parts], + has_versions: args[:has_versions], + has_views: args[:has_views], + has_downloads: args[:has_downloads], + page: { number: 1, size: 0 }) + end +end diff --git a/app/graphql/types/thesis_edge_type.rb b/app/graphql/types/thesis_edge_type.rb new file mode 100644 index 000000000..5be6c8014 --- /dev/null +++ b/app/graphql/types/thesis_edge_type.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class ThesisEdgeType < GraphQL::Types::Relay::BaseEdge + node_type(ThesisType) +end diff --git a/app/graphql/types/thesis_type.rb b/app/graphql/types/thesis_type.rb new file mode 100644 index 000000000..5439cb72b --- /dev/null +++ b/app/graphql/types/thesis_type.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class ThesisType < BaseObject + implements DoiItem +end diff --git a/app/models/doi.rb b/app/models/doi.rb index a96307f87..a2f105e55 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -706,6 +706,7 @@ def self.query(query, options={}) must << { query_string: { query: query, fields: query_fields } } if query.present? must << { terms: { doi: options[:ids].map(&:upcase) }} if options[:ids].present? must << { term: { "types.resourceTypeGeneral": options[:resource_type_id].underscore.camelize }} if options[:resource_type_id].present? + must << { term: { "types.resourceType": options[:resource_type].humanize }} if options[:resource_type].present? must << { terms: { provider_id: options[:provider_id].split(",") } } if options[:provider_id].present? must << { terms: { client_id: options[:client_id].to_s.split(",") } } if options[:client_id].present? must << { terms: { prefix: options[:prefix].to_s.split(",") } } if options[:prefix].present? diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_for_instruments/filter_for_theses.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_for_instruments/filter_for_theses.yml new file mode 100644 index 000000000..c053fc651 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_for_instruments/filter_for_theses.yml @@ -0,0 +1,57 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.ror.org/organizations?query=%22https://ror.org/04wxnsj81%22 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.6.1; mailto:info@datacite.org) + Accept: + - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5 + Accept-Encoding: + - gzip,deflate + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json + Content-Length: + - '603' + Connection: + - keep-alive + Date: + - Tue, 07 Apr 2020 18:44:27 GMT + Status: + - 200 OK + X-Frame-Options: + - SAMEORIGIN + Allow: + - GET, HEAD, OPTIONS + X-Powered-By: + - Phusion Passenger 6.0.4 + Server: + - nginx/1.17.3 + Phusion Passenger 6.0.4 + Vary: + - Cookie,Origin + X-Cache: + - Hit from cloudfront + Via: + - 1.1 92eff4f17f8a434975f912a39f575296.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - DUS51-C1 + X-Amz-Cf-Id: + - fidi-9_ykmh2q6DG9U1TiGl3-PSSrXwe8yTTJl7Yk_8zcMu7z48NqA== + Age: + - '823' + body: + encoding: ASCII-8BIT + string: '{"number_of_results":1,"time_taken":16,"items":[{"id":"https://ror.org/04wxnsj81","name":"DataCite","types":["Nonprofit"],"links":["https://www.datacite.org"],"aliases":[],"acronyms":[],"status":"active","wikipedia_url":"https://en.wikipedia.org/wiki/DataCite","labels":[],"country":{"country_name":"Germany","country_code":"DE"},"external_ids":{"Wikidata":{"preferred":"Q821542","all":["Q821542"]},"GRID":{"preferred":"grid.475826.a","all":"grid.475826.a"}}}],"meta":{"types":[{"id":"nonprofit","title":"Nonprofit","count":1}],"countries":[{"id":"de","title":"Federal + Republic of Germany","count":1}]}}' + http_version: null + recorded_at: Tue, 07 Apr 2020 18:58:10 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/fixtures/vcr_cassettes/dois/GET_/dois_for_theses/filter_for_theses.yml b/spec/fixtures/vcr_cassettes/dois/GET_/dois_for_theses/filter_for_theses.yml new file mode 100644 index 000000000..1fc116b02 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/dois/GET_/dois_for_theses/filter_for_theses.yml @@ -0,0 +1,55 @@ +--- +http_interactions: +- request: + method: get + uri: https://api.ror.org/organizations?query=%22https://ror.org/04wxnsj81%22 + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Mozilla/5.0 (compatible; Maremma/4.6.1; mailto:info@datacite.org) + Accept: + - text/html,application/json,application/xml;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5 + Accept-Encoding: + - gzip,deflate + response: + status: + code: 200 + message: OK + headers: + Content-Type: + - application/json + Content-Length: + - '603' + Connection: + - keep-alive + Date: + - Tue, 07 Apr 2020 18:44:27 GMT + Status: + - 200 OK + X-Frame-Options: + - SAMEORIGIN + Allow: + - GET, HEAD, OPTIONS + X-Powered-By: + - Phusion Passenger 6.0.4 + Server: + - nginx/1.17.3 + Phusion Passenger 6.0.4 + Vary: + - Cookie,Origin + X-Cache: + - Miss from cloudfront + Via: + - 1.1 91528fdf97ef415d04fa66a0fbb562d7.cloudfront.net (CloudFront) + X-Amz-Cf-Pop: + - DUS51-C1 + X-Amz-Cf-Id: + - siInYmxiRU8T-PFvyQr-hGb_KSoxjpVG_51vO8GU611WcWlYi8oYbQ== + body: + encoding: ASCII-8BIT + string: '{"number_of_results":1,"time_taken":16,"items":[{"id":"https://ror.org/04wxnsj81","name":"DataCite","types":["Nonprofit"],"links":["https://www.datacite.org"],"aliases":[],"acronyms":[],"status":"active","wikipedia_url":"https://en.wikipedia.org/wiki/DataCite","labels":[],"country":{"country_name":"Germany","country_code":"DE"},"external_ids":{"Wikidata":{"preferred":"Q821542","all":["Q821542"]},"GRID":{"preferred":"grid.475826.a","all":"grid.475826.a"}}}],"meta":{"types":[{"id":"nonprofit","title":"Nonprofit","count":1}],"countries":[{"id":"de","title":"Federal + Republic of Germany","count":1}]}}' + http_version: null + recorded_at: Tue, 07 Apr 2020 18:44:27 GMT +recorded_with: VCR 5.1.0 diff --git a/spec/graphql/types/instrument_type_spec.rb b/spec/graphql/types/instrument_type_spec.rb new file mode 100644 index 000000000..20347326a --- /dev/null +++ b/spec/graphql/types/instrument_type_spec.rb @@ -0,0 +1,79 @@ +require "rails_helper" + +describe InstrumentType do + describe "fields" do + subject { described_class } + + it { is_expected.to have_field(:id).of_type(!types.ID) } + it { is_expected.to have_field(:type).of_type("String!") } + end + + describe "query instruments", elasticsearch: true do + let!(:instruments) { create_list(:doi, 3, types: { "resourceTypeGeneral" => "Other", "resourceType" => "Instrument" }, aasm_state: "findable") } + + before do + Doi.import + sleep 2 + end + + let(:query) do + %(query { + instruments { + totalCount + nodes { + id + } + } + }) + end + + it "returns all instruments" do + response = LupoSchema.execute(query).as_json + + expect(response.dig("data", "instruments", "totalCount")).to eq(3) + expect(response.dig("data", "instruments", "nodes").length).to eq(3) + expect(response.dig("data", "instruments", "nodes", 0, "id")).to eq(instruments.first.identifier) + end + end + + # describe "query datasets by person", elasticsearch: true do + # let!(:instruments) { create_list(:doi, 3, types: { "resourceTypeGeneral" => "Other", "resourceType" => "Instrument" }, aasm_state: "findable") } + # let!(:instruments) { create(:doi, types: { "resourceTypeGeneral" => "Other", "resourceType" => "Instrument" }, aasm_state: "findable", 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", + # }]) + # } + # before do + # Doi.import + # sleep 2 + # end + + # let(:query) do + # %(query { + # instruments(userId: "https://orcid.org/0000-0003-1419-2405") { + # totalCount + # years { + # id + # count + # } + # nodes { + # id + # } + # } + # }) + # end + + # it "returns instruments" do + # response = LupoSchema.execute(query).as_json + + # expect(response.dig("data", "instruments", "totalCount")).to eq(3) + # expect(response.dig("data", "instruments", "years")).to eq([{"count"=>3, "id"=>"2011"}]) + # expect(response.dig("data", "instruments", "nodes").length).to eq(3) + # expect(response.dig("data", "instruments", "nodes", 0, "id")).to eq(instruments.first.identifier) + # end + # end +end diff --git a/spec/graphql/types/thesis_type_spec.rb b/spec/graphql/types/thesis_type_spec.rb new file mode 100644 index 000000000..12d10805e --- /dev/null +++ b/spec/graphql/types/thesis_type_spec.rb @@ -0,0 +1,79 @@ +require "rails_helper" + +describe ThesisType do + describe "fields" do + subject { described_class } + + it { is_expected.to have_field(:id).of_type(!types.ID) } + it { is_expected.to have_field(:type).of_type("String!") } + end + + describe "query theses", elasticsearch: true do + let!(:theses) { create_list(:doi, 3, types: { "resourceTypeGeneral" => "Text", "resourceType" => "Thesis" }, aasm_state: "findable") } + + before do + Doi.import + sleep 2 + end + + let(:query) do + %(query { + theses { + totalCount + nodes { + id + } + } + }) + end + + it "returns all theses" do + response = LupoSchema.execute(query).as_json + + expect(response.dig("data", "theses", "totalCount")).to eq(3) + expect(response.dig("data", "theses", "nodes").length).to eq(3) + expect(response.dig("data", "theses", "nodes", 0, "id")).to eq(theses.first.identifier) + end + end + + describe "query theses by person", elasticsearch: true do + let!(:theses) { create_list(:doi, 3, types: { "resourceTypeGeneral" => "Text", "resourceType" => "Thesis" }, aasm_state: "findable") } + let!(:thesis) { create(:doi, types: { "resourceTypeGeneral" => "Text", "resourceType" => "Thesis" }, aasm_state: "findable", 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", + }]) + } + before do + Doi.import + sleep 2 + end + + let(:query) do + %(query { + theses(userId: "https://orcid.org/0000-0003-1419-2405") { + totalCount + years { + id + count + } + nodes { + id + } + } + }) + end + + it "returns theses" do + response = LupoSchema.execute(query).as_json + + expect(response.dig("data", "theses", "totalCount")).to eq(3) + expect(response.dig("data", "theses", "years")).to eq([{"count"=>3, "id"=>"2011"}]) + expect(response.dig("data", "theses", "nodes").length).to eq(3) + expect(response.dig("data", "theses", "nodes", 0, "id")).to eq(theses.first.identifier) + end + end +end diff --git a/spec/requests/dois_spec.rb b/spec/requests/dois_spec.rb index 85d515810..f536e11ef 100644 --- a/spec/requests/dois_spec.rb +++ b/spec/requests/dois_spec.rb @@ -231,6 +231,44 @@ end end + describe 'GET /dois for theses', elasticsearch: true, vcr: true do + let!(:dois) { create_list(:doi, 3, types: { "resourceTypeGeneral" => "Text", "resourceType" => "Thesis" }, client: client, aasm_state: "findable") } + + before do + Doi.import + sleep 3 + end + + it 'filter for theses' do + get "/dois?resource-type=thesis", nil, headers + + expect(last_response.status).to eq(200) + expect(json['data'].size).to eq(3) + expect(json.dig('meta', 'total')).to eq(3) + expect(json.dig('data', 0, 'attributes', 'publicationYear')).to eq(2011) + expect(json.dig('data', 0, 'attributes', 'types')).to eq("resourceType"=>"Thesis", "resourceTypeGeneral"=>"Text") + end + end + + describe 'GET /dois for instruments', elasticsearch: true, vcr: true do + let!(:dois) { create_list(:doi, 3, types: { "resourceTypeGeneral" => "Other", "resourceType" => "Instrument" }, client: client, aasm_state: "findable") } + + before do + Doi.import + sleep 3 + end + + it 'filter for theses' do + get "/dois?resource-type=instrument", nil, headers + + expect(last_response.status).to eq(200) + expect(json['data'].size).to eq(3) + expect(json.dig('meta', 'total')).to eq(3) + expect(json.dig('data', 0, 'attributes', 'publicationYear')).to eq(2011) + expect(json.dig('data', 0, 'attributes', 'types')).to eq("resourceType"=>"Instrument", "resourceTypeGeneral"=>"Other") + end + end + describe 'GET /dois with views and downloads', elasticsearch: true, vcr: true do let(:doi) { create(:doi, client: client, aasm_state: "findable") } let!(:views) { create_list(:event_for_datacite_investigations, 2, obj_id: doi.doi) }