---
title: GET
summary: The projection clause — which features a query returns, arithmetic over them, aliases, aggregates and nested queries over related objects.
order: 20
terms: [qid, oid]
see-also: [reference/bql/where, reference/bql/group-by, reference/bql/unit, reference/bql/sub-features]
---

# GET

`GET` lists what a query returns for each selected object. Each item is a feature path, an arithmetic expression over features, or an aggregate function, optionally followed by `UNIT <unit>` and `AS <alias>`. Items are separated by commas.

## Syntax {#syntax}

```text {#get-syntax}
GET <item> [, <item> ...]
<item> := <feature> [UNIT <unit>] [AS <alias>]
        | <expression> [UNIT <unit>] [AS <alias>]
        | <aggregate>(<feature or expression>) [AS <alias>]
```

`GET` is optional: a query without it is a bare selection that returns the matching objects. `GET` is required before `WHERE` — `WHERE type = IFCWALL` alone is a syntax error; write `type = IFCWALL`.

```bql {#get-basic}
GET qid, type, attribute.Name WHERE type = IFCDOOR
```

## Features {#features}

A feature is a dot path. The first segment names the family, the rest addresses a member; every family has its own page:

| Path | Returns | Page |
|---|---|---|
| `qid`, `oid` | The object's [[term:qid|Qid]]; the [[term:oid|Oid]] alone (`oid` is `GET`-only and mainly for debugging). | [[page:reference/bql#conventions]] |
| `type`, `niceType`, `suggestedType`, `suggestion.<facet>` | The IFC class, a readable name, the suggested class. | [[bql:types]] |
| `attribute.<Name>`, `attribute.*` | IFC attributes. | [[bql:attributes]] |
| `property.<Pset>.<Name>`, `property.*.<Name>`, `property.*` | Properties, with wildcards and fields. | [[bql:properties]] |
| `quantity.<Qset>.<Name>`, `quantity.*` | Quantities. | [[bql:quantities]] |
| `classification.<field>`, `classification.system.<field>` | Classification references. | [[bql:classifications]] |
| `calculated.<group>.<name>`, `aabb.<side>` | Values BIM.works derives from the geometry and structure. | [[bql:calculated-values]] |
| `layer.name`, `material.<field>` | Presentation layers and materials. | [[bql:layers]], [[bql:materials]] |
| `model.<field>` | The model the object belongs to. | [[bql:model]] |
| `<relation>.<feature>`, `<relation>(<feature>, …)` | Features of related objects. | [[bql:sub-features]], [[bql:building-storeys]], [[bql:type-objects]], [[bql:openings-and-fillings]] |
| `<family>.meta` | Which members exist, instead of their values. | [[bql:meta]] |

The wildcard `*` selects every member of a family or set: `attribute.*`, `property.*`, `property.Pset_WallCommon.*`, `quantity.*`, `classification.*`, `layer.*`, `material.*`, `calculated.*`, `model.*`.

```bql {#get-everything}
GET qid, niceType, attribute.*, property.*, quantity.*, classification.*, layer.*, material.*, calculated.*, model.*
WHERE attribute.GlobalId = "25xnmjtXDBEeYnceWKw7hY"
```

## Features a workspace hides {#visible-features}

A published workspace can limit which features its visitors see (its *Visible features* tab, [[page:how-to/using-bimworks/limit-the-visible-features-of-a-workspace]]). For a visitor, a plain `GET` of a hidden feature is left out of the result, as if the object did not carry it, and the response lists it under `hiddenFeatures`; a wildcard such as `property.*` expands to the visible members only. A hidden feature in a `WHERE`, `GROUP BY`, `ORDER BY`, an aggregate or an expression is refused with `FEATURE_NOT_VISIBLE`, because a condition would give the value away. `qid`, `type` and `niceType` are never hidden.

## Arithmetic {#arithmetic}

A `GET` item can be an expression over numeric features and literals with `+`, `-`, `*`, `/`, parentheses and `ABS(...)`. Units are carried through the arithmetic, so a volume divided by an area is a length, and a literal may carry a unit (`2 m`, `1 m3`). Write subtractions with spaces around the minus: `a - 3` (in `a -3` the sign belongs to the literal).

```bql {#get-arithmetic}
GET qid, ABS(quantity.Qto_WallBaseQuantities.NetVolume - calculated.quantity.volume) UNIT m3 AS Deviation
WHERE type = IFCWALL
```

```bql {#get-density}
GET qid, calculated.geometry.counts.triangles / calculated.quantity.volume AS Density
WHERE type = IFCWALL AND calculated.quantity.volume > 0 m3
```

A feature that never has a numeric value (a string attribute, a type) is rejected in arithmetic; division by a constant zero is rejected at validation.

## Aliases {#alias}

`AS` names a column. The name is the `alias` and the `label` of the item in the answer's columns ([[bql:output#columns]]) and the header of its column in a table export ([[bql:output#tables]]). It moves no value: a record is the same with or without aliases. The alias is an identifier or a quoted string, it cannot be a keyword, and it follows the `UNIT` clause when both are present.

Where a value is follows from the item's own text:

- A stored feature is under its path: `attribute.Name AS Name` is `"attribute": {"Name": …}`, and the same holds for properties, quantities, calculated values, relations and model fields.
- A computed column is under its text: an arithmetic expression (`"quantity.*.NetVolume / 2"`), `eval(...)`, a shape, `BOX` and the other columns of [[bql:spatial-and-advanced]], and an aggregate as described under [[bql:output#values]] (`COUNT`, `SUM(quantity.*.NetVolume)`).
- A column with `UNIT` is under its whole text, unit included: `"quantity.Qto_WallBaseQuantities.NetSideArea UNIT m2"`, so the same feature in two units is two columns.
- Two different items that would still share a key fail the query with `DUPLICATE_COLUMN`, naming both: two calls of one relation with different `WHERE` clauses, for instance, which both write the relation's name.

Read a value by its alias through the columns: [[js:@bimworks/jssdk/QueryColumns]] in JavaScript (`QueryColumns.get(record, "Name", records.columns)`, or `QueryColumns.byLabel(records)` for records keyed by label), the `columns` of `queryWithColumns` in Java, or `"columns": true` on [[openapi:Query]].

Before 3.0 an alias moved values: an aliased computed column was written under its alias, and from the first 3.0 builds an aliased stored feature too. A client written against that placement keeps it with `"alias_keys": true` on [[openapi:Query]], `aliasKeys: true` on `Query2`, the `aliasKeys` option or `setAliasKeys(true)` of the JavaScript SDK, and `setAliasKeys(true)` of the Java SDK ([[page:changelog/v3-0/bql#results]]).

```bql {#get-alias}
GET attribute.Name AS Name, quantity.Qto_WallBaseQuantities.NetSideArea UNIT m2 AS "Side area (m2)"
WHERE type = IFCWALL
```

## Aggregates {#aggregates}

`COUNT`, `SUM`, `MIN`, `MAX`, `AVG`, `MEDIAN`, `MODE`, `RANGE`, `STDDEV`, `COLLECT` and `FIRST` aggregate over the whole result, or per group with [[bql:group-by]]. The numeric ones take an expression; `COUNT`, `COLLECT` and `FIRST` take a feature. `UNIT` cannot follow an aggregate. The functions are described under [[bql:group-by#aggregates]].

```bql {#get-aggregate}
GET COUNT(qid) AS Walls, SUM(quantity.Qto_WallBaseQuantities.NetSideArea) AS TotalSideArea
WHERE type = IFCWALL
```

## Nested queries over relations {#nested}

A relation with several targets (`children`, `spaceBoundary`, `system`, `zone`, `port`, `hasOpenings`, …) can carry its own feature list in parentheses, with an optional `WHERE`, `GROUP BY`, `ORDER BY` and `LIMIT` that apply to the related objects. The result is nested under the relation's key. A single-target relation (`buildingStorey`, `typeObject`, `parent`, …) takes the same parenthesised list without the clauses.

```bql {#get-nested}
GET
    attribute.Name,
    children(qid, type, attribute.Name WHERE type = IFCDOOR ORDER BY attribute.Name LIMIT 5)
WHERE type = IFCBUILDINGSTOREY
```

A relation call can aggregate over the related set instead: a numeric aggregate (`SUM`, `MAX`, …), `COUNT`, `FIRST` or `COLLECT`, one or more, each giving one value per object. `WHERE` filters the related set, and `ORDER BY` and `LIMIT` shape it before it is aggregated, so `FIRST` with `ORDER BY` is the arg-min ([[bql:sub-features#aggregates]]). One numeric aggregate with an optional `WHERE` is also a `WHERE` operand ([[bql:where#relation-aggregates]]):

```bql {#get-relation-aggregate}
GET qid, spaceBoundary(SUM(quantity.*.Area) WHERE type = IFCWINDOW)
WHERE type = IFCSPACE
```

The values are written under the relation's name, each under its text: `"spaceBoundary": {"SUM(quantity.*.Area)": {…}}` here, also for `spaceBoundary(SUM(quantity.*.Area) AS WindowArea WHERE …)`, whose alias names the column in the answer's columns. A relation call lists either sub-features or aggregates, not both, and `GROUP BY` does not combine with an aggregate over a relation. The relations and their meaning are on [[bql:sub-features]].

## Special GET features {#special}

- `COUNT(children)` — the number of direct children of each object, as a per-object value (not an aggregate).
- `decomposition` — the object's decomposition tree (`qid`, `niceType`, `Name` of each level).
- `eval(<boolean expression>)` — `true` or `false` per object; the expression uses the [[bql:where]] vocabulary.
- `BIN(<feature>, <size>)` — buckets a numeric feature (`BIN(aabb.height, 500 mm)`), usable in `GROUP BY` as well.
- `viewPoint`, `gis:convertGeoReference(<epsg>)`, the virtual geometries `BOX`, `CYLINDER`, `CONE`, `SPHERE`, the inscribed-shape and usable-area functions: [[bql:spatial-and-advanced]].

```bql {#get-eval}
GET qid, eval(property.Pset_WallCommon.IsExternal = true) AS External, COUNT(children) AS Children
WHERE type = IFCWALL
```

## Used in {#used-in}

- [[page:tutorials/bql/your-first-query]] — `GET` with `qid`, `type` and attributes.
- [[page:tutorials/bql/relations]] — nested relation queries.
- [[page:how-to/query/run-a-bql-query]] — running the projection from an SDK.
