QueryAPI¶
Interface QueryAPI
Hierarchy
- QueryAPI
Index
Methods
Methods
query
- query(query: string | Query, nodeID?: number): Promise<QueryResult>
-
Executes the query on the specified subtree
Parameters
-
query: string | Query
-
Optional
nodeID: number
Returns Promise<QueryResult>
-
With the Query API you can access additional information about nodes.
The query object is a JSON object which contains a select and a conditions block. The select block is an array which defines the content and layout of the result. The conditions describe a set of tests on nodes and their properties. The result will contain information for all elements on which all conditions passed (implicit AND relation between condition array elements)
, <selectkey.value> ]:, :}]
{
select: [
conditions: [{
}
Logical keys can be put inside conditions instead of a select or condition key in order to express the corresponding logical operation.
An array of arrays. For each successful condition match an array with the selected element values is returned. The order of values matches the select Specification.
const queryLabels = await context.query({ select: ['nodeId', 'label'], conditions: [{ nodeType: 'aux' }, { metadata: 'auxProperties.pmiType', equals: 'ModelView' }] }); const queryPMIType = await context.query({ select: ['nodeId', 'auxProperties.pmiType'], conditions: [{ nodeType: 'aux' }, { metadata: 'auxProperties.pmiType', equals: 'ModelView' }] });