Example Query: Find Zones
The Insights™ Query Builder is an interactive tool set for creating and executing textual queries that helps you get data about your digital twin project and become familiar with the Quantum API.
What zones are on the ground floor?
For this example, the following image shows Floor 0, the ground floor in a site named My First Project.
This procedure gives an introduction to Query Builder, demonstrating building a query in these stages:
- Query a list of all the buildings you have access to in your account
- Filter on a particular site, My First Project
- Filter to query just the zones on Floor 0, the ground floor
This procedure shows examples of using the following features of Insights:
- The Object and Details browsers
- The Query Builder panel on the right, titled QUERY.
- The fields or trays in the Query Builder: FROM (the starting point of your query), TO (the ending point of your query), and WHERE (allows you to set filters on your query)
- The Run Query play button
- The GraphiQL query panel, which displays the editable query string and the results
- The dragger icon which opens and closes the Query Builder panel (right dragger) and the project picker (left dragger)
- The ability to chain queries
, which allows you to make more complex and detailed queries
To view a list of your site projects, and the example project floors and zones:
- After signing in to your PassiveLogic account, in Portfolio click Insights
.
Initially, you will see an interactive visual representation of the domains and relationships in the Quantum data model.
- Click Build Query.
The domain and object lists and the Query Builder open on the right.
-
Build a query to see a list of your site projects: Click the Site domain in the Object browser on the right.
The Site domain drawer opens, listing the object types in that domain.
.
- From the Site domain drawer, drag the Site object type to FROM in the Query Builder.
- Click the Building domain in the Object browser on the right.
The Building domain drawer opens, listing the object types in that domain.
- Drag the Building object type to TO in the Query Builder.
The Query Builder panel now looks like this:
-
Query for a list of your projects: Click Run Query
to see the list of site projects in the results that Query Builder provides at this stage.
The GraphiQL Query panel opens, displaying the query string generated by Query Builder as well as the results. In this case, you can see the example building that is provided when you create a new account. If you have created or scanned other building projects, they are also listed.
The first field shows the query generated by Query Builder and lets you edit the query string to refine your query. The second field lets you view or copy the results.
-
Filter the results to display only the example project: While in the query panel, click the Project selector to the right in the bottom toolbar and then choose the name of the example project, My First Project, from the portfolio library panel. This is another shortcut provided by the Query Builder; you don't need to create a Where clause and type in a value if you're just wanting to filter on a particular project.
- Click the dragger
to close the Query panel and return to the Query Builder.
The Query Builder panel now looks like this, with the filter generated for My First Project:
-
Use query chaining to filter for the floor name: Click Query Chain
.
A new query chain panel appears.
- Click the Building domain in the Object type browser on the left, then drag Floor to the new To tray in the Query Builder.
The Query Builder now looks like this:
-
View the results at this stage: Click Run Query
to see the filtered list of floors in the results that the Query Builder provides.
The Query panel opens, displaying the floors in only the example building, My First Project. Floor 0 is the name of the ground floor.
-
Filter to query just Floor 0 in My First Project: Return to the Query Builder and click Building domain > Floor object type, then drag Name from the Floor attributes to the new Where tray. Click the assertion button
, select Equal, and type Floor 0.
The Query Builder now looks like this:
-
Query for the Zone names on Floor 0 of My First Project: Click Query Chain
again, then from Building domain drag the Zone object type to the new To tray. Leave the Where tray empty.
The Query Builder now looks like this:
- Click Run Query
to see the results.
The Query panel opens and displays a list of the zone names from Floor 0 (the ground floor) of the example building, My First Project.
The results match the zone names you see when you open the project in Blueprint or Creator:
This is the text of the query that is generated. You can copy or edit it in the first field of the GraphiQL query panel, and it is saved in your query History.
query{
sites(where:{name:{isEqualTo:"My First Project"}},){
name
buildings{
ID
floors(where:{name:{isEqualTo:"Floor 0"}},){
ID
zones{
ID
name
description
locked
color
isConditioned
}
}
}
}
}
More Query Builder examples