> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nextedy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Query API Reference

> The Nextedy POWERSHEET query API controls how data is retrieved from Siemens Polarion ALM.

export const LastReviewed = ({date}) => {
  if (!date) return null;
  const formatted = new Date(`${date}T00:00:00Z`).toLocaleDateString("en-US", {
    year: "numeric",
    month: "long",
    day: "numeric",
    timeZone: "UTC"
  });
  return <p className="mt-10 text-sm text-gray-400 dark:text-zinc-500 not-prose">
      Last reviewed on {formatted}
    </p>;
};

<Columns cols={3}>
  <Card title="EntityQuery" icon="file" href="/powersheet/reference/query-api/entity-query">
    Top-level query object that combines a resource type, predicates, expand clauses, and ordering into a single data request against the server API.
  </Card>

  <Card title="Predicates" icon="file" href="/powersheet/reference/query-api/predicates">
    Filter conditions for the `where` clause including equality, comparison, null checks, and composite AND/OR logic with support for property paths.
  </Card>

  <Card title="Expand Clause" icon="file" href="/powersheet/reference/query-api/expand-clause">
    Load related entities inline via expansion paths, supporting one-to-many, many-to-one, and many-to-many relationships through navigation properties.
  </Card>

  <Card title="Query Context" icon="file" href="/powersheet/reference/query-api/query-context" />

  <Card title="Document Filtering" icon="file" href="/powersheet/reference/query-api/document-filtering">
    Scope query results to items within a specific Polarion LiveDoc using `applyCurrentDocumentTo` constraints in the data model.
  </Card>

  <Card title="Baseline and Revision Queries" icon="file" href="/powersheet/reference/query-api/baseline-and-revision-queries">
    Query historical data at specific project baselines or revisions to view the state of entities at a point in time.
  </Card>
</Columns>

<Tip title="Configuration vs. API">
  Most query behavior is configured declaratively through the `sources` section of your sheet configuration YAML. You rarely need to write queries directly -- Powersheet translates your YAML sources into the query structures described here. See [Sources](/powersheet/reference/sheet-config/sources) for the configuration reference.
</Tip>

## How Queries Flow

```
┌─────────────────────────────────────┐
│        Sheet Configuration          │
│  sources:                           │
│    - type: UserNeed                 │
│      expand:                        │
│        - systemRequirements         │
│      where:                         │
│        status: { ne: deleted }      │
└──────────────┬──────────────────────┘
               │
               ▼
┌─────────────────────────────────────┐
│          EntityQuery                │
│  from: UserNeed                     │
│  where: Predicates                  │
│  expand: Expand Clause              │
│  context: Query Context             │
└──────────────┬──────────────────────┘
               │
               ▼
┌─────────────────────────────────────┐
│     Server API (Lucene)             │
│  Translates predicates to Lucene    │
│  Resolves expansion paths           │
│  Applies project + document scope   │
└──────────────┬──────────────────────┘
               │
               ▼
┌─────────────────────────────────────┐
│       Polarion Data Service         │
│  Executes Lucene search             │
│  Returns work items + linked items  │
└─────────────────────────────────────┘
```

The query engine translates your YAML `sources` configuration into `EntityQuery` objects. Predicates from the `where` clause are split into Lucene-compatible server queries and in-memory post-filters where needed. Expansion paths resolve navigation properties defined in your data model to load related entities in a single request.

## Related References

| Topic                                     | Where to look                                                              |
| ----------------------------------------- | -------------------------------------------------------------------------- |
| Configuring data sources in YAML          | [Sources](/powersheet/reference/sheet-config/sources)                      |
| Data model entity types and relationships | [Data Model Reference](/powersheet/reference/data-model/index)             |
| Column binding paths that drive queries   | [Binding Syntax](/powersheet/reference/sheet-config/binding-syntax)        |
| Server-rendered computed properties       | [Server Rendering Reference](/powersheet/reference/server-rendering/index) |

<LastReviewed date="2026-06-08" />
