Skip to main content
diagram

Query Properties

EntityQuery does not support a select clause for projecting specific properties. All properties defined for the entity type in the data model are returned automatically.

The from Clause

The from clause specifies the root entity type for the query. The value must exactly match an entity type name defined in the domainModelTypes section of the data model YAML. Entity type names use PascalCase.
The server resolves the from value against the metadata system to locate the entity type definition, including its mapped Polarion work item type, properties, and available navigation properties. If the entity type is not found in the metadata registry, the query fails with a validation error. Common entity types (using the standard RTM example model): For the complete list of entity type properties and Polarion type mappings, see Data Model Types and Polarion Type Mapping.

The where Clause

The where clause defines filter predicates that restrict the result set. Predicates are split during execution into two categories:
  • Lucene-compatible predicates — translated to Polarion Lucene queries and executed server-side for performance
  • In-memory post-filters — complex predicates that cannot be expressed in Lucene, applied after the initial fetch
This splitting is transparent to the query author. See Predicates for the full predicate syntax and Query Splitting for details on how predicates are categorized.
Filtering entities by null presence (using eq: null or ne: null to find entities where a property is or is not null) is not currently supported. The null check predicate is not functional in the current release and should not be used in production sheet configurations. To filter on field presence, use an explicit value comparison (for example, ne: "" for non-empty strings) or apply the filter via a downstream post-processing step. This limitation will be addressed in a future release.
For composite filtering with AND/OR logic, see the Predicates reference.

The expand Clause

The expand clause specifies which navigation properties to load inline with the query results. Navigation properties represent relationships between entity types defined in the data model. The expand syntax differs based on the relationship cardinality.

Many-to-One (N:1) Expansion

For many-to-one relationships, the expand loads a single related entity. Uses the direct navigation property name from the relationship definition.
This loads the parent Chapter for each UserNeed. In the data model, the relationship defines direct.name: chapter on the many side.

One-to-Many (1:N) Expansion

For one-to-many relationships (the reverse of N:1), the expand loads a collection of child entities. Uses the back navigation property name.
This loads all child UserNeed entities for each Chapter. In the sheet, these appear as expandable child rows creating a new hierarchy level.

Many-to-Many (M:N) Expansion

Many-to-many relationships require a two-level expand that traverses through an association entity to reach the target entity.
The first level (systemRequirements) navigates to the association entities. The second level (systemRequirement) navigates from each association to the actual target SystemRequirement entity. This two-level pattern is required because the data model represents M:N links through an intermediate association. For complete expand syntax including nested multi-level expansion, see Expand Clause.

The orderBy Clause

The orderBy clause defines the sort order for query results. Each item specifies a property path and an optional sort direction.
Property path syntax supports both direct properties and navigation paths using dot notation. The path is validated against the entity type metadata to ensure it references a valid property. The orderBy clause in the source configuration maps to the sortBy property in the sheet configuration, which uses a slightly different format:
All property paths in the orderBy clause are validated against the entity type metadata during query construction. If a property path references a non-existent property, the query returns a validation error. Use property names exactly as defined in the data model.

Query Execution Flow

The server API processes an EntityQuery through the following stages:
  1. Metadata resolution — The from clause is resolved against the metadata registry to identify the target entity type, its Polarion work item type mapping, and available properties.
  2. Security enforcement — The server verifies the current user has read permission for the entity type. If the entity type is not readable, the query fails immediately.
  3. Predicate splitting — The where clause predicates are analyzed and split into Lucene-compatible server queries and in-memory post-filters.
  4. Document pre-filtering — If document-level predicates exist in the where clause, documents are pre-resolved to narrow the work item query scope.
  5. Lucene query execution — Lucene-compatible predicates are translated and executed against Polarion to fetch matching work items.
  6. Post-filtering — In-memory filters are applied to the fetched results to handle predicates that cannot be expressed in Lucene.
  7. Constraint application — Data model constraints and project scoping rules are enforced on the result set.
  8. Navigation property expansion — Properties specified in the expand clause are loaded for each result entity, following the relationship paths defined in the data model.
  9. Sorting — Results are ordered per the orderBy clause.
  10. Result assembly — The final result set is returned with entity metadata.

Query Result Structure

Each entity returned by an EntityQuery includes standard metadata fields alongside the data model properties: Additional fields depend on the properties defined for the entity type in the data model. Custom fields, enum properties, and computed (server-rendered) properties are included when defined.
Properties backed by Velocity templates are evaluated server-side during query execution. The Velocity context includes variables item, tx, context, and pObject for template evaluation. See Velocity Templates and Context Variables.

Primitive Field Type Mapping

When entity properties are returned in query results, Polarion custom field types are mapped to their runtime equivalents:

Enum Property Resolution

When the metadata system discovers enum properties on an entity type, Powersheet automatically creates data sources for loading the available enum options. This powers dropdown pickers in the sheet without manual source configuration. The auto-generated enum source uses the following resolution pattern:
  • Source ID: system.enums.<enumId> (e.g., system.enums.severity)
  • Query construction: Filters by polarionProto, polarionType, projectId, and enumId from the entity metadata
  • Display mapping: Each enum option provides a display label and internal value for the picker
This process is triggered during metadata initialization and completes before any user queries execute.

Complete YAML Example

A complete source configuration demonstrating all EntityQuery properties within a sheet configuration:
This configuration demonstrates:
  • Root query with from, where, and orderBy on UserNeed
  • N:1 expansion via chapter (direct navigation property)
  • M:N expansion via systemRequirements.systemRequirement (two-level association traversal)
  • Deep nesting continuing through designRequirements.designRequirement for a full traceability chain
  • Column bindings using dot-notation matching the expansion path structure
  • Picker configuration with list.search and list.createNew on reference columns

Cardinality and Query Pattern Summary


Last modified on July 10, 2026