Understanding GraphQL Default Queries

  • Queries

    • Entity1: returns a list of one or more instances of entity Entity1.

    • getEntity1Connection: returns a paginated, sortable and filterable list of Entity1 instances.

      Example:

                    query {
                      getEntity1Connection (paginationRequest: {scenarioId: "001", page: 0, size: 100, sort: []}, geneContext: {scenarioIds: ["001"]}) {
                        totalElements
                        totalPages
                        content {
                            dbGeneInternalScenarioId
                            field1
                            resource {
                               day
                               numberOfHours
                               dbGeneInternalId
                            }
                        }
                        scenarioId
                      }
                    }
    • getEntity1Aggregation: returns the result of one or more aggregation queries. Each numeric aggregation query can aggregate values through one or multiple nested levels.

      Also, aggregation can be computed to compare values between distinct scenarios. For that, "reference" scenarios should be defined in the context. In a composite data model, the "reference" scenarios must be of the same type.

      Example:

                                                  query {
            getEntity1Aggregations (
                aggregationRequest: [{
                    aggregationName: "New Series 1", aggregationKind: "count", fieldName: "numberOfHours", groupByFieldsNames: ["day", "numberOfHours"]
                }],
                geneContext: {
                    scenarioIds: ["scenario1"],
                    referenceScenarioIds: ["scenario2", "scenario3"]
                }
            ) {
                aggregations {
                    name
                    bucketDefinitions {
                        name
                        parents
                    }
                    buckets {
                        buckets
                        values
                    }
                }
            }
        }
                                             

      The result of a numeric aggregation query can be computed using one of the following operators:

      • COUNT: Returns the total number of items in a collection or list. Useful for determining the size of a dataset or subset based on filters.

      • DISTINCT: Returns the unique values within a field across items in the collection. This is used to remove duplicates and find the number of unique entries.

      • MIN: Returns the minimum (smallest) value of a field in the collection. Typically used with numeric or date fields to identify the lowest entry.

      • MAX: Returns the maximum (largest) value of a field in the collection. Useful for identifying the highest value in numeric or date fields.

      • AVG: Calculates the average value of a numeric field across all items in the collection. Useful for finding the mean value, such as an average rating or price.

      • SUM: Adds up the values in a numeric field for all items in the collection. Useful for totals, such as total revenue, quantity, or distance.

      The result of an aggregation is represented in the form of a list of buckets, and a hierarchy definition to define how these buckets are related.

      This allows us to configure Charts using series related to multiple fields (categories), using the chart configuration wizard.

      Chart Configurator

      It is important to note that there is no specific GraphQL configuration, required by the application designer, to connect the Platform components to Data Service entities. When the user selects the related entity(ies)/field(s) via the web client wizards, the arguments and results of GraphQL queries are automatically connected to the web client components.

      For more details, please refer to Chapter Understanding the Platform Web Client.