Create BRIQL query for Applications
DCH uses BRIQL queries to dynamically map site and building specific data points to the application on install. This walkthrough goes through how to setup the BRIQL queries for you application. We do not go through how to write BRIQL queries in this walkthrough. To learn how to write a query read the BRIQL specification and walkthrough.
In order to tell DCH details about each query, where to bind it and what type to expect. The application maps each BRIQL query to an input node in the recipe file. See walkthrough Setup Recipe File to learn how to specify input nodes. The top level keys correspond to the node id of an input node in the recipe.json file. Each block describes how DCH maps the result to the application.
key - Input node id specified in recipe.json
required - Specifies if the query is required to have a solution. If this is set to true and the query returns an empty list of solutions the installation is cancelled.
type - Specifies how to pass the result to the application input node.
BRIQL_RESULT - The result is passed directly to the input node, giving the chance to traverse the result and apply advanced logic that is impossible or hard to do in a BRIQL query.
STREAM - The result is given as a reference to a stream. If the result contains more than one match, the first solution is used.
STREAM_COLLECTION - The result is given as a list of references streams. The result can be an empty list if required is false and no solutions were found.
query - The BRIQL query.. The queryDef part of the BRIQL Json query is inserted here. See section below.
Insert BRIQL query
The BRIQL query used directly against the api must be given with a list of model to apply the query to. In DCH applications the models are given dynamically when the application is installed. Therefore the models part of the query is omitted. Below you will see how the top layer of a BRIQL query looks like. For the BRIQL mapping you will copy the queryDef value and insert into the query property of the BRIQL mapping.
Last updated