---
title: Convert 2.x queries to 3.0
summary: Send the BQL queries, BVL visualisations and BCL checks your application keeps itself, written for BIM.works 2.x, in one request and get them back in the 3.0 syntax, with what changed, or with the error that is left for you to fix.
order: 45
terms: [bql, bvl, bcl]
see-also: [changelog/v3-0/from-2-to-3, changelog/v3-0/bql, how-to/query/validate-a-query, reference/bql/unit]
---

# Convert 2.x queries to 3.0

An application that keeps BQL, BVL or BCL texts of its own (in its code, its database or its configuration) and moves from 2.x to 3.0: [[openapi:UpgradeSyntax]] rewrites them to the 3.0 syntax, as many as you like up to 1000 per request. It makes the same rewrite the instance makes once to its own stored actions ([[page:changelog/v3-0/from-2-to-3#stored-actions]]), so you do not have to call it for those.

## Before you start

- A login; the call needs no scope and reads no model.
- The texts, each with its language: `BQL`, `BVL` or `BCL`.

## 1. Send the texts

```try-it {#upgrade-syntax}
operation: UpgradeSyntax
method: POST
path: /openapi/ifc/UpgradeSyntax
body: |
  {
    "inputs": [
      { "id": "wall-heights", "language": "BQL", "text": "GET qid, quantity.Qto_WallBaseQuantities.Height IN mm WHERE type = IFCWALL" },
      { "id": "lengths", "language": "BCL", "text": "select (type = IFCWALL) { require property.Dimensions.length > 0; }" },
      { "id": "walls", "language": "BVL", "text": "if (type = IFCWALL) { SHOW; } else { HIDE; }" },
      { "id": "typo", "language": "BQL", "text": "GET qid WHER type = IFCWALL" }
    ]
  }
```

`id` is optional: your own name for a text, given back with its result. The results come in the order of the inputs.

## 2. Read the results

```json {#upgrade-syntax-answer}
{
  "results": [
    { "id": "wall-heights", "language": "BQL", "status": "REWRITTEN",
      "text": "GET qid, quantity.Qto_WallBaseQuantities.Height UNIT mm WHERE type = IFCWALL", "changes": ["IN → UNIT"] },
    { "id": "lengths", "language": "BCL", "status": "REWRITTEN",
      "text": "select (type = IFCWALL) { require property.Dimensions.\"length\" > 0; }", "changes": ["length → \"length\""] },
    { "id": "walls", "language": "BVL", "status": "UNCHANGED",
      "text": "if (type = IFCWALL) { SHOW; } else { HIDE; }", "changes": [] },
    { "id": "typo", "language": "BQL", "status": "NOT_REWRITTEN",
      "text": "GET qid WHER type = IFCWALL", "changes": [], "error": "line 1:9: missing EOF at 'WHER'" }
  ]
}
```

| `status` | `text` | What to do |
|---|---|---|
| `REWRITTEN` | the text in the 3.0 syntax; `changes` lists what changed | store it in place of the old one |
| `UNCHANGED` | the text as you sent it: it parses in 3.0 | nothing |
| `NOT_REWRITTEN` | the text as you sent it; `error` says where 3.0 fails | fix it by hand ([[page:changelog/v3-0/bql]]) |

The exact message of `error` is the 3.0 parser's, `line L:C: …`, up to three errors.

## What it changes

Only the syntax changes from 2.x to 3.0 that have one right answer, and only where the 3.0 parser reports an error:

- `IN <unit>` after a `GET` feature is `UNIT <unit>` ([[page:reference/bql/unit]]). `IN (…)`, the list comparison of `WHERE`, is not touched.
- `CS LENGTH` is `LENGTH`.
- A set, property, quantity or alias name that 3.0 reserves as a keyword is quoted: `property.Dimensions."length"`, `AS "status"`, and in BVL and BCL also names such as `."top"`, `."left"` and, in BCL, `."pick"`. Only the words that are new in 3.0 are quoted, so a 3.0 feature such as `calculated.quantity.length` stays as it is.

A text with any other error, such as a typo or a BCL that 2.x ran partly and 3.0 refuses, is not changed at all, also when it has one of these changes as well. Strings and comments are never changed.

`IN mm` → `UNIT mm` changes results: 2.x ignored the unit clause, 3.0 converts. If your application relied on the unconverted numbers, remove the clause instead.

A query that parses can still select other objects or return other values in 3.0, for example `= null` or `COUNT(f)`; this call does not look at meaning. [[page:changelog/v3-0/bql]] lists those changes.

## Check

Run the rewritten texts on a 3.0 test instance, or validate them first ([[page:how-to/query/validate-a-query]]).
