Class LlmDataQuery

java.lang.Object
io.jmix.reports.llm.LlmDataQuery

public class LlmDataQuery extends Object
A JPQL query generated from a natural-language prompt, together with everything needed to execute it and to show it to a report designer.

An instance is stored in the data set (see DataSet.getLlmGeneratedQuery()) and reused by subsequent report runs, so it carries no parameter values.

  • Field Details

    • jpql

      protected String jpql
    • resultProperties

      protected List<String> resultProperties
    • parameters

      protected List<LlmQueryParameter> parameters
    • explanation

      protected @Nullable String explanation
    • warnings

      protected List<String> warnings
    • maxResults

      protected @Nullable Integer maxResults
    • firstResult

      protected @Nullable Integer firstResult
  • Constructor Details

  • Method Details

    • positiveOrNull

      protected static @Nullable Integer positiveOrNull(@Nullable Integer count)
      Keeps a row count only if it is one. A zero or a negative number says nothing about how many rows to return — whether it comes from a model, from a document edited by hand, or from an application's own implementation of the seam — and a query without a count is a query that returns everything. Reading such a value as a count would empty a band instead.
    • getJpql

      public String getJpql()
      Returns:
      the JPQL select query; every select expression is aliased via AS
    • getResultProperties

      public List<String> getResultProperties()
      Returns the select aliases in select-clause order. They are the keys of the produced band rows, so a report template refers to band fields by these names.
      Returns:
      the select aliases in select-clause order
    • getParameters

      public List<LlmQueryParameter> getParameters()
      Returns:
      named parameters the query references, with their types but without values
    • getExplanation

      public @Nullable String getExplanation()
      Returns:
      human-readable description of what the query does, or null if none was produced
    • getWarnings

      public List<String> getWarnings()
      Returns:
      assumptions and approximations reported when the query was generated
    • getMaxResults

      public @Nullable Integer getMaxResults()
      Returns how many rows the query is meant to return, or null for all of them. A prompt asking for "the top 5 customers" says so here rather than in the text: JPQL has no limit, so the count is applied when the query is executed.
      Returns:
      the row count the query is limited to, or null if it is not limited
    • getFirstResult

      public @Nullable Integer getFirstResult()
      Returns how many rows the query skips, or null for none — the offset half of the same contract as getMaxResults().
      Returns:
      the number of rows to skip, or null if none are skipped