-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bring person, data_catalog and funder into lupo graphql api
- Loading branch information
Martin Fenner
committed
Oct 11, 2019
1 parent
cd0abbf
commit 228b22a
Showing
32 changed files
with
1,299 additions
and
55 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
app/graphql/types/data_catalog_connection_with_meta_type.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class DataCatalogConnectionWithMetaType < BaseConnection | ||
edge_type(DataCatalogEdgeType) | ||
field_class GraphQL::Cache::Field | ||
|
||
field :total_count, Integer, null: true, cache: true | ||
|
||
def total_count | ||
args = object.arguments | ||
DataCatalog.query(args[:query], limit: 0).dig(:meta, "total").to_i | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class DataCatalogEdgeType < GraphQL::Types::Relay::BaseEdge | ||
node_type(DataCatalogType) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
class DefinedTermType < BaseObject | ||
description "A word, name, acronym, phrase, etc. with a formal definition. Often used in the context of category or subject classification, glossaries or dictionaries, product or creative work types, etc." | ||
|
||
field :term_code, String, null: true, description: "A code that identifies this DefinedTerm within a DefinedTermSet." | ||
field :name, String, null: true, description: "The name of the item." | ||
field :description, String, null: true, description: "A description of the item." | ||
field :in_defined_term_set, String, null: true, description: "A DefinedTermSet that contains this term." | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
# class FunderConnectionWithMetaType < BaseConnection | ||
class FunderConnectionWithMetaType < BaseConnection | ||
|
||
# edge_type(FunderEdgeType) | ||
# field_class GraphQL::Cache::Field | ||
edge_type(FunderEdgeType) | ||
field_class GraphQL::Cache::Field | ||
|
||
# field :publication_connection_count, Integer, null: false, cache: true | ||
# field :dataset_connection_count, Integer, null: false, cache: true | ||
# field :software_connection_count, Integer, null: false, cache: true | ||
field :total_count, Integer, null: false, cache: true | ||
field :publication_connection_count, Integer, null: false, cache: true | ||
field :dataset_connection_count, Integer, null: false, cache: true | ||
field :software_connection_count, Integer, null: false, cache: true | ||
|
||
# def publication_connection_count | ||
# Event.query(nil, citation_type: "Funder-ScholarlyArticle").results.total | ||
# end | ||
def total_count | ||
args = object.arguments | ||
|
||
# def dataset_connection_count | ||
# Event.query(nil, citation_type: "Dataset-Funder").results.total | ||
# end | ||
Funder.query(args[:query], limit: 0).dig(:meta, "total").to_i | ||
end | ||
|
||
def publication_connection_count | ||
Event.query(nil, citation_type: "Funder-ScholarlyArticle").results.total | ||
end | ||
|
||
def dataset_connection_count | ||
Event.query(nil, citation_type: "Dataset-Funder").results.total | ||
end | ||
|
||
# def software_connection_count | ||
# Event.query(nil, citation_type: "Funder-SoftwareSourceCode").results.total | ||
# end | ||
# end | ||
def software_connection_count | ||
Event.query(nil, citation_type: "Funder-SoftwareSourceCode").results.total | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
# frozen_string_literal: true | ||
|
||
# class PersonConnectionWithMetaType < BaseConnection | ||
# edge_type(PersonEdgeType) | ||
# field_class GraphQL::Cache::Field | ||
class PersonConnectionWithMetaType < BaseConnection | ||
edge_type(PersonEdgeType) | ||
field_class GraphQL::Cache::Field | ||
|
||
# field :publication_connection_count, Integer, null: false, cache: true | ||
# field :dataset_connection_count, Integer, null: false, cache: true | ||
# field :software_connection_count, Integer, null: false, cache: true | ||
# field :organization_connection_count, Integer, null: false, cache: true | ||
field :total_count, Integer, null: false, cache: true | ||
field :publication_connection_count, Integer, null: false, cache: true | ||
field :dataset_connection_count, Integer, null: false, cache: true | ||
field :software_connection_count, Integer, null: false, cache: true | ||
field :organization_connection_count, Integer, null: false, cache: true | ||
|
||
# def publication_connection_count | ||
# Event.query(nil, citation_type: "Person-ScholarlyArticle").results.total | ||
# end | ||
def total_count | ||
args = object.arguments | ||
|
||
# def dataset_connection_count | ||
# Event.query(nil, citation_type: "Dataset-Person").results.total | ||
# end | ||
Person.query(args[:query], limit: 0).dig(:meta, "total").to_i | ||
end | ||
|
||
# def software_connection_count | ||
# Event.query(nil, citation_type: "Person-SoftwareSourceCode").results.total | ||
# end | ||
def publication_connection_count | ||
Event.query(nil, citation_type: "Person-ScholarlyArticle").results.total | ||
end | ||
|
||
# def organization_connection_count | ||
# Event.query(nil, citation_type: "Organization-Person").results.total | ||
# end | ||
# end | ||
def dataset_connection_count | ||
Event.query(nil, citation_type: "Dataset-Person").results.total | ||
end | ||
|
||
def software_connection_count | ||
Event.query(nil, citation_type: "Person-SoftwareSourceCode").results.total | ||
end | ||
|
||
def organization_connection_count | ||
Event.query(nil, citation_type: "Organization-Person").results.total | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
class SoftwareApplicationType < BaseObject | ||
description "A software application." | ||
|
||
field :name, String, null: true, description: "The name of the item." | ||
field :description, String, null: true, description: "A description of the item." | ||
field :software_version, String, null: true, description: "Version of the software instance." | ||
field :url, String, null: true, description: "URL of the item." | ||
end |
Oops, something went wrong.