---
title: BimApi
summary: CLASS in nl.bimbase.bimworks.client.apis.
order: 10
languages: [java]
sdk-package: Java · nl.bimbase.bimworks.client.apis
---

# BimApi

[[page:reference/java/api|API catalogue]] · `nl.bimbase.bimworks.client.apis` · CLASS

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public class BimApi
````

BIM related API calls, mostly different ways of querying the stored models.

## Inheritance and interfaces

- [[page:reference/java/nl-bimbase-bimworks-client-apis/subapi-e2929b7e|SubApi]]

## Members

| Member | Kind | Description |
|---|---|---|
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-init-56ac827d99ea|BimApi(BimWorksClient)]] | CONSTRUCTOR |  |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-setaliaskeys-c47f43918223|setAliasKeys(boolean)]] | METHOD | Since 3.0 an `AS` alias only names its column: every value stays where it is without one (` attribute.Name AS n` is still at `attribute.Name`), computed colu… |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-isaliaskeys-a41ba5de0c98|isAliasKeys()]] | METHOD | Whether the queries of this client put values under their aliases, as before 3.0 (#setAliasKeys) |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-query-f1f6b5bc7ec4|query(String, Set&lt;UUID&gt;)]] | METHOD | Execute a query on the given models |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-validate-31a2bd2054d3|validate(String)]] | METHOD | Validate a query without executing it. A query that parses is accepted even when the validator has warnings about it; #validateQuery returns those. |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-validatequery-d7eebd84055e|validateQuery(String)]] | METHOD | Validate a query without executing it, with what the editor would mark in it. |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-resolvebvl-76a5b1067417|resolveBvl(String, Set&lt;UUID&gt;)]] | METHOD | Resolve a BIM.works Visualization Language (BVL), in development |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-query-e6bb1bbdb01d|query(String, UUID...)]] | METHOD | Execute a query on the given models |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-querywithcolumns-b559c647a9e0|queryWithColumns(String, UUID...)]] | METHOD | Execute a query on the given models, and say where each `GET` item is in the records: `{objects, columns}`. Each entry of `columns` is one item with its `ali… |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-setdiscipline-6e078e79d0b1|setDiscipline(UUID, Discipline)]] | METHOD | Set the discipline of the given model |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-setdisciplines-bdaffc56f198|setDisciplines(UUID, List&lt;Discipline&gt;)]] | METHOD | Set the multi-label disciplines of the given model. The first entry becomes the primary (the value #setDiscipline sets); an empty list clears all discipline … |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-listbuildingstoreys-c5c3cd4e85b9|listBuildingStoreys(Set&lt;UUID&gt;)]] | METHOD | List all the building storeys of the given models |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-query-05a820b51c93|query(UUID, Set&lt;UUID&gt;)]] | METHOD | Execute a stored query (by its UUID) on the given models |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-querycount-79909c01fce6|queryCount(String, Set&lt;UUID&gt;)]] | METHOD | Number of objects a query matches, without fetching them. |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-parsequery-7d0d9b3b1a14|parseQuery(String)]] | METHOD | Parse a BQL query into its AST without executing it (no credentials needed). |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-tableexport-ad7b55589286|tableExport(BimApi.TableExportType, String, Set&lt;UUID&gt;)]] | METHOD | Query results as a table file. The caller closes the stream. |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-textsearch-12db62ad88bd|textSearch(String, Set&lt;UUID&gt;)]] | METHOD | Free-text search over property names and values (the search box), grouped per feature. |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-getobjecthistory-22ac825f3173|getObjectHistory(UUID, int)]] | METHOD | The change history of one object in the oid lineage of the version: the transactions that made the version or one of its ancestors, back to the upload its oi… |
| [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-queryqids-0ce825857703|queryQids(String, Set&lt;UUID&gt;)]] | METHOD | The qids of the objects a query matches (what the viewer asks for to highlight a selection): `Query2` with `onlyQids`. Rows carry `qid` ("vid-oid") and, when… |

## `BimApi(BimWorksClient)` {#member-init-56ac827d99ea}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public BimApi(nl.bimbase.bimworks.client.BimWorksClient bimWorksClient)
````



### Parameters

| Name | Type | Description |
|---|---|---|
| `bimWorksClient` | [[page:reference/java/nl-bimbase-bimworks-client/bimworksclient-a27e861c|BimWorksClient]] |  |

## `setAliasKeys(boolean)` {#member-setaliaskeys-c47f43918223}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public void setAliasKeys(boolean aliasKeys)
````

Since 3.0 an `AS` alias only names its column: every value stays where it is without one (`
attribute.Name AS n` is still at `attribute.Name`), computed columns are keyed by their text (`COUNT`,
`SUM(quantity.*.NetVolume)`), and [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-querywithcolumns-b559c647a9e0|#queryWithColumns]] says where each `GET` item is. Code written
against the placement of before, where an alias moved the value to a root key of that name, calls
`setAliasKeys(true)` to keep it for every query of this client.

### Parameters

| Name | Type | Description |
|---|---|---|
| `aliasKeys` | `boolean` |  |

## `isAliasKeys()` {#member-isaliaskeys-a41ba5de0c98}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public boolean isAliasKeys()
````

Whether the queries of this client put values under their aliases, as before 3.0 ([[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-setaliaskeys-c47f43918223|#setAliasKeys]])

## `query(String, Set<UUID>)` {#member-query-f1f6b5bc7ec4}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public com.fasterxml.jackson.databind.node.ArrayNode query(java.lang.String query, java.util.Set<java.util.UUID> versionUuids) throws nl.bimbase.bimworks.client.BimWorksException, java.lang.InterruptedException
````

Execute a query on the given models

### Parameters

| Name | Type | Description |
|---|---|---|
| `query` | `java.lang.String` | The query, serialized using the BQL format |
| `versionUuids` | `java.util.Set<java.util.UUID>` | Set  of UUID representing the models/Versions to query |

### Returns

An ArrayNode with the results. This is untyped because the shape of the results depend on the query

### Exceptions

- `BimWorksException` — 
- `InterruptedException` — 

## `validate(String)` {#member-validate-31a2bd2054d3}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public boolean validate(java.lang.String query) throws nl.bimbase.bimworks.client.BimWorksException, java.lang.InterruptedException
````

Validate a query without executing it. A query that parses is accepted even when the
validator has warnings about it; [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-validatequery-d7eebd84055e|#validateQuery]] returns those.

### Parameters

| Name | Type | Description |
|---|---|---|
| `query` | `java.lang.String` | The query, serialized using the BQL format |

### Returns

true when the server accepts the query, false when the server rejects the query
        itself (a `BimWorksQueryError` such as SYNTAX_ERROR)

### Exceptions

- `BimWorksException` — on any other failure — authorization, transport, timeout. This
        method used to throw for invalid queries too, so it could only ever return true
- `InterruptedException` — 

## `validateQuery(String)` {#member-validatequery-d7eebd84055e}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public java.util.List<nl.bimbase.bimworks.client.apis.BimApi.QueryValidationMessage> validateQuery(java.lang.String query) throws nl.bimbase.bimworks.client.BimWorksException
````

Validate a query without executing it, with what the editor would mark in it.

### Parameters

| Name | Type | Description |
|---|---|---|
| `query` | `java.lang.String` | The query, serialized using the BQL format |

### Returns

for a query that parses: the validator's warnings and errors (an IFC class in the
        wrong case, an unknown attribute, a regular expression that does not compile, ...)
        and a refusal such as FEATURE_NOT_VISIBLE; empty for a clean query

### Exceptions

- `BimWorksException` — when the server rejects the query itself (a
        `BimWorksQueryError` such as SYNTAX_ERROR, whose message has the line and
        column), and on any other failure

## `resolveBvl(String, Set<UUID>)` {#member-resolvebvl-76a5b1067417}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public nl.bimbase.bimworks.ResolvedActions resolveBvl(java.lang.String input, java.util.Set<java.util.UUID> versionUuids) throws nl.bimbase.bimworks.client.BimWorksException, java.lang.InterruptedException
````

Resolve a BIM.works Visualization Language (BVL), in development

### Parameters

| Name | Type | Description |
|---|---|---|
| `input` | `java.lang.String` | The BVL source text |
| `versionUuids` | `java.util.Set<java.util.UUID>` | Set of UUID representing the models/Versions to resolve against |

### Returns

The resolved actions, parsed from the server's wire form by `ResolvedActions#fromJson`

### Exceptions

- `BimWorksException` — 
- `InterruptedException` — 

## `query(String, UUID...)` {#member-query-e6bb1bbdb01d}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public com.fasterxml.jackson.databind.node.ArrayNode query(java.lang.String query, java.util.UUID... versionUuids) throws nl.bimbase.bimworks.client.BimWorksException, java.lang.InterruptedException
````

Execute a query on the given models

### Parameters

| Name | Type | Description |
|---|---|---|
| `query` | `java.lang.String` | The query, serialized using the BQL format |
| `versionUuids` | `java.util.UUID...` | One or more UUID representing the models/Versions to query |

### Returns

An ArrayNode with the results. This is untyped because the shape of the results depend on the query

### Exceptions

- `BimWorksException` — 
- `InterruptedException` — 

## `queryWithColumns(String, UUID...)` {#member-querywithcolumns-b559c647a9e0}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public com.fasterxml.jackson.databind.node.ObjectNode queryWithColumns(java.lang.String query, java.util.UUID... versionUuids) throws nl.bimbase.bimworks.client.BimWorksException, java.lang.InterruptedException
````

Execute a query on the given models, and say where each `GET` item is in the records: `{objects,
columns}`. Each entry of `columns` is one item with its `alias`, its BQL text (`source`), the
header to show (`label`) and `path`, the keys from a record to its value (an array, because keys hold
dots). Read a value by its alias by finding the column with that `alias` and following its `path`.

### Parameters

| Name | Type | Description |
|---|---|---|
| `query` | `java.lang.String` | The query, serialized using the BQL format |
| `versionUuids` | `java.util.UUID...` | One or more UUID representing the models/Versions to query |

### Returns

`{"objects": [...], "columns": [...]}`

## `setDiscipline(UUID, Discipline)` {#member-setdiscipline-6e078e79d0b1}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public void setDiscipline(java.util.UUID versionUuid, nl.bimbase.bimworks.common.actions.Discipline discipline) throws nl.bimbase.bimworks.client.BimWorksException
````

Set the discipline of the given model

### Parameters

| Name | Type | Description |
|---|---|---|
| `versionUuid` | `java.util.UUID` | UUID of the Version |
| `discipline` | `nl.bimbase.bimworks.common.actions.Discipline` | The discipline |

### Exceptions

- `BimWorksException` — 

## `setDisciplines(UUID, List<Discipline>)` {#member-setdisciplines-bdaffc56f198}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public void setDisciplines(java.util.UUID versionUuid, java.util.List<nl.bimbase.bimworks.common.actions.Discipline> disciplines) throws nl.bimbase.bimworks.client.BimWorksException
````

Set the multi-label disciplines of the given model. The first entry becomes the primary
(the value [[page:reference/java/nl-bimbase-bimworks-client-apis/bimapi-0f79f346#member-setdiscipline-6e078e79d0b1|#setDiscipline]] sets); an empty list clears all discipline fields.

### Parameters

| Name | Type | Description |
|---|---|---|
| `versionUuid` | `java.util.UUID` | UUID of the Version |
| `disciplines` | `java.util.List<nl.bimbase.bimworks.common.actions.Discipline>` | The disciplines, primary first |

### Exceptions

- `BimWorksException` — 

## `listBuildingStoreys(Set<UUID>)` {#member-listbuildingstoreys-c5c3cd4e85b9}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public com.fasterxml.jackson.databind.node.ArrayNode listBuildingStoreys(java.util.Set<java.util.UUID> versionUuids) throws java.lang.InterruptedException, nl.bimbase.bimworks.client.BimWorksException
````

List all the building storeys of the given models

### Parameters

| Name | Type | Description |
|---|---|---|
| `versionUuids` | `java.util.Set<java.util.UUID>` |  |

### Exceptions

- `InterruptedException` — 
- `BimWorksException` — 

## `query(UUID, Set<UUID>)` {#member-query-05a820b51c93}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public com.fasterxml.jackson.databind.node.ArrayNode query(java.util.UUID queryUuid, java.util.Set<java.util.UUID> versionUuids) throws nl.bimbase.bimworks.client.BimWorksException, java.lang.InterruptedException
````

Execute a stored query (by its UUID) on the given models

### Parameters

| Name | Type | Description |
|---|---|---|
| `queryUuid` | `java.util.UUID` | UUID of the stored query |
| `versionUuids` | `java.util.Set<java.util.UUID>` | Set of UUID representing the models/Versions to query |

### Returns

An ArrayNode with the results. This is untyped because the shape of the results depend on the query

### Exceptions

- `BimWorksException` — 
- `InterruptedException` — 

## `queryCount(String, Set<UUID>)` {#member-querycount-79909c01fce6}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public long queryCount(java.lang.String query, java.util.Set<java.util.UUID> versionUuids) throws nl.bimbase.bimworks.client.BimWorksException
````

Number of objects a query matches, without fetching them.

### Parameters

| Name | Type | Description |
|---|---|---|
| `query` | `java.lang.String` |  |
| `versionUuids` | `java.util.Set<java.util.UUID>` |  |

## `parseQuery(String)` {#member-parsequery-7d0d9b3b1a14}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public com.fasterxml.jackson.databind.node.ObjectNode parseQuery(java.lang.String query) throws nl.bimbase.bimworks.client.BimWorksException
````

Parse a BQL query into its AST without executing it (no credentials needed).

### Parameters

| Name | Type | Description |
|---|---|---|
| `query` | `java.lang.String` |  |

## `tableExport(BimApi.TableExportType, String, Set<UUID>)` {#member-tableexport-ad7b55589286}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public java.io.InputStream tableExport(nl.bimbase.bimworks.client.apis.BimApi.TableExportType type, java.lang.String query, java.util.Set<java.util.UUID> versionUuids) throws nl.bimbase.bimworks.client.BimWorksException
````

Query results as a table file. The caller closes the stream.

### Parameters

| Name | Type | Description |
|---|---|---|
| `type` | [[page:reference/java/nl-bimbase-bimworks-client-apis/tableexporttype-69199f5c|BimApi.TableExportType]] |  |
| `query` | `java.lang.String` |  |
| `versionUuids` | `java.util.Set<java.util.UUID>` |  |

## `textSearch(String, Set<UUID>)` {#member-textsearch-12db62ad88bd}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public com.fasterxml.jackson.databind.node.ObjectNode textSearch(java.lang.String text, java.util.Set<java.util.UUID> versionUuids) throws nl.bimbase.bimworks.client.BimWorksException
````

Free-text search over property names and values (the search box), grouped per feature.

### Parameters

| Name | Type | Description |
|---|---|---|
| `text` | `java.lang.String` |  |
| `versionUuids` | `java.util.Set<java.util.UUID>` |  |

### Returns

`{query, groups:[{matchedIn, kind, set, name, type, count, qids, qidsComplete}]}`

## `getObjectHistory(UUID, int)` {#member-getobjecthistory-22ac825f3173}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public com.fasterxml.jackson.databind.node.ObjectNode getObjectHistory(java.util.UUID versionUuid, int oid) throws nl.bimbase.bimworks.client.BimWorksException
````

The change history of one object in the oid lineage of the version: the transactions that made
the version or one of its ancestors, back to the upload its oids come from.

### Parameters

| Name | Type | Description |
|---|---|---|
| `versionUuid` | `java.util.UUID` |  |
| `oid` | `int` |  |

## `queryQids(String, Set<UUID>)` {#member-queryqids-0ce825857703}

````java sdk=java sdk-namespace="nl.bimbase.bimworks.client.apis"
public com.fasterxml.jackson.databind.node.ArrayNode queryQids(java.lang.String query, java.util.Set<java.util.UUID> versionUuids) throws nl.bimbase.bimworks.client.BimWorksException
````

The qids of the objects a query matches (what the viewer asks for to highlight a selection):
`Query2` with `onlyQids`. Rows carry `qid` ("vid-oid") and, when selected,
`type`.

### Parameters

| Name | Type | Description |
|---|---|---|
| `query` | `java.lang.String` |  |
| `versionUuids` | `java.util.Set<java.util.UUID>` |  |

## Inherited members

- `java.lang.Object#equals(java.lang.Object)`
- `java.lang.Object#toString()`
- `java.lang.Object#wait(long)`
- `java.lang.Object#wait(long,int)`
- `java.lang.Object#wait()`
- `java.lang.Object#finalize()`
- `java.lang.Object#getClass()`
- `java.lang.Object#hashCode()`
- `java.lang.Object#clone()`
- `java.lang.Object#notify()`
- `java.lang.Object#notifyAll()`
- [[page:reference/java/nl-bimbase-bimworks-client-apis/subapi-e2929b7e#member-getbimworksclient-a7cb880c7470|getBimWorksClient()]]
