Final challenge
Three rounds without new syntax: a report query, a grouped survey and a spatial selection, each one a statement you would write at work.
No new constructs on this page. Each round is a question someone actually asks about a model, and the answer needs several of the clauses you have learned at once. The hints are shorter than before on purpose; the BQL cheatsheet is the page to keep open next to this one.
The clause order never changes, and remembering it is half of writing a long statement:
GET <feature> [UNIT <unit>] [AS <alias>], ...
WHERE <condition>
GROUP BY <feature>, ...
ORDER BY <feature> [ASC|DESC], ...
LIMIT <n>
OFFSET <n>
USING <DIMENSION>_UNIT = <unit> ...Your turn#
GET qid, attribute.Name WHERE type = IFCWALLHints
- Three columns besides qid: the name, the storey's name, the quantity NetSideArea.
- "External" is the property IsExternal; the set wildcard saves you looking the set up.
- ORDER BY … DESC on the same quantity, then LIMIT 5.
- USING AREA_UNIT = m2 converts the area of the whole statement.
Show solution
GET qid, attribute.Name, buildingStorey.attribute.Name, quantity.*.NetSideArea
WHERE type = IFCWALL AND property.*.IsExternal = true
ORDER BY quantity.*.NetSideArea DESC
LIMIT 5
USING AREA_UNIT = m2GET qid, attribute.Name, buildingStorey.attribute.Name, quantity.*.NetSideArea AS Area WHERE type = IFCWALL AND property.*.IsExternal = true ORDER BY quantity.*.NetSideArea DESC LIMIT 5 USING AREA_UNIT = m2GET buildingStorey.attribute.Name, COUNT(qid) WHERE type = IFCDOOR GROUP BY buildingStorey.attribute.NameHints
- The count is already there; the second aggregate is a SUM over a quantity of the door.
- The quantity of a door opening is called Area in the demo model's BaseQuantities.
- An aggregate cannot carry UNIT; convert the statement with USING instead.
Show solution
GET buildingStorey.attribute.Name, COUNT(qid), SUM(quantity.*.Area)
WHERE type = IFCDOOR
GROUP BY buildingStorey.attribute.Name
USING AREA_UNIT = m2GET buildingStorey.attribute.Name AS Storey, COUNT(qid) AS Doors, SUM(quantity.*.Area) AS OpeningArea WHERE type = IFCDOOR GROUP BY buildingStorey.attribute.Name USING AREA_UNIT = m2GET qid, attribute.LongName WHERE type = IFCSPACEHints
- Three conditions: the class, the storey, and the word in the long name.
- The storey is a relation: buildingStorey.attribute.Name.
- CONTAINS matches a word anywhere in the value, and ignores case.
Show solution
GET qid, attribute.LongName
WHERE type = IFCSPACE AND buildingStorey.attribute.Name = "00 begane grond" AND attribute.LongName CONTAINS "kamer"GET qid, attribute.LongName WHERE type = IFCSPACE AND attribute.LongName CONTAINS "kamer" AND buildingStorey.calculated.property.level = 0Eleven rooms, coloured in the model. Try the same query with the first floor and you get nothing: up there the modeller named the spaces instal. ruimte, hal and berging, which is the sort of thing a survey (lesson 8) tells you before a check depends on it.
You have finished the course#
You can select objects, filter them on anything the model carries, follow the graph around them, summarise them, control the units, use what BIM.works computes, ask geometric questions and take the result out as a file.
From here:
- The BQL cheatsheet — every construct on one page, one line each.
- Run a BQL query — running queries from JavaScript, Java, .NET, PHP and the API.
- BQL — the language clause by clause, when a construct needs its exact rules.
- The Build a model viewer course — query results in a viewer of your own.
- Spatial and advanced — the constructs this course only mentioned: clashes and containment, clearance, paths and graphs, walkable routes, usable area, virtual shapes, full-text search.
The other query languages are learned the same way: BCL checks a model against rules, BVL colours it, BUL changes it, and all of them use the BQL selections you have just learned.