GET
The projection clause — which features a query returns, arithmetic over them, aliases, aggregates and nested queries over related objects.
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#
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.
GET qid, type, attribute.Name WHERE type = IFCDOORFeatures#
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 Qid; the Oid alone (oid is GET-only and mainly for debugging). |
reference/bql#conventions |
type, niceType, suggestedType, suggestion.<facet> |
The IFC class, a readable name, the suggested class. | Types |
attribute.<Name>, attribute.* |
IFC attributes. | Attributes |
property.<Pset>.<Name>, property.*.<Name>, property.* |
Properties, with wildcards and fields. | Properties |
quantity.<Qset>.<Name>, quantity.* |
Quantities. | Quantities |
classification.<field>, classification.system.<field> |
Classification references. | Classifications |
calculated.<group>.<name>, aabb.<side> |
Values BIM.works derives from the geometry and structure. | Calculated values |
layer.name, material.<field> |
Presentation layers and materials. | Layers, Materials |
model.<field> |
The model the object belongs to. | Model |
<relation>.<feature>, <relation>(<feature>, …) |
Features of related objects. | Sub-features and relations, Building storeys, Type objects, Openings and fillings |
<family>.meta |
Which members exist, instead of their values. | Meta features |
The wildcard * selects every member of a family or set: attribute.*, property.*, property.Pset_WallCommon.*, quantity.*, classification.*, layer.*, material.*, calculated.*, model.*.
GET qid, niceType, attribute.*, property.*, quantity.*, classification.*, layer.*, material.*, calculated.*, model.*
WHERE attribute.GlobalId = "25xnmjtXDBEeYnceWKw7hY"Features a workspace hides#
A published workspace can limit which features its visitors see (its Visible features tab, 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#
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).
GET qid, ABS(quantity.Qto_WallBaseQuantities.NetVolume - calculated.quantity.volume) UNIT m3 AS Deviation
WHERE type = IFCWALLGET qid, calculated.geometry.counts.triangles / calculated.quantity.volume AS Density
WHERE type = IFCWALL AND calculated.quantity.volume > 0 m3A 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#
AS names a column. The name is the alias and the label of the item in the answer's columns (output#columns) and the header of its column in a table export (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 Nameis"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,BOXand the other columns of Spatial and advanced, and an aggregate as described under output#values (COUNT,SUM(quantity.*.NetVolume)). - A column with
UNITis 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 differentWHEREclauses, for instance, which both write the relation's name.
Read a value by its alias through the columns: 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 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 Query, aliasKeys: true on Query2, the aliasKeys option or setAliasKeys(true) of the JavaScript SDK, and setAliasKeys(true) of the Java SDK (changelog/v3-0/bql#results).
GET attribute.Name AS Name, quantity.Qto_WallBaseQuantities.NetSideArea UNIT m2 AS "Side area (m2)"
WHERE type = IFCWALLAggregates#
COUNT, SUM, MIN, MAX, AVG, MEDIAN, MODE, RANGE, STDDEV, COLLECT and FIRST aggregate over the whole result, or per group with 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 group-by#aggregates.
GET COUNT(qid) AS Walls, SUM(quantity.Qto_WallBaseQuantities.NetSideArea) AS TotalSideArea
WHERE type = IFCWALLNested queries over relations#
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.
GET
attribute.Name,
children(qid, type, attribute.Name WHERE type = IFCDOOR ORDER BY attribute.Name LIMIT 5)
WHERE type = IFCBUILDINGSTOREYA 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 (sub-features#aggregates). One numeric aggregate with an optional WHERE is also a WHERE operand (where#relation-aggregates):
GET qid, spaceBoundary(SUM(quantity.*.Area) WHERE type = IFCWINDOW)
WHERE type = IFCSPACEThe 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 Sub-features and relations.
Special GET features#
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,Nameof each level).eval(<boolean expression>)—trueorfalseper object; the expression uses the WHERE vocabulary.BIN(<feature>, <size>)— buckets a numeric feature (BIN(aabb.height, 500 mm)), usable inGROUP BYas well.viewPoint,gis:convertGeoReference(<epsg>), the virtual geometriesBOX,CYLINDER,CONE,SPHERE, the inscribed-shape and usable-area functions: Spatial and advanced.
GET qid, eval(property.Pset_WallCommon.IsExternal = true) AS External, COUNT(children) AS Children
WHERE type = IFCWALLUsed in#
- Your first query —
GETwithqid,typeand attributes. - Relations — nested relation queries.
- Run a BQL query — running the projection from an SDK.