ARDI Query Language
Although there are a variety of API functions available, most queries you'll make to ARDI use the ARDI Query Language (AQL).
Although the name is similar, AQL is not based on the SQL language that you might be familiar with from traditional relational databases.
This is because SQL struggles when it comes to complex relationships - it's hard to make an SQL query that deals with a large number of parent-to-child connections.
Endpoint
AQL is REST-based, so you can send an AQL query from virtually any modern language and platform.
There are three main URLs you might want to use to access query language…
To Write A Query Interactively
<ardiserver>/aql/api/
For Normal Queries:
<ardiserver>/aql/api/query?query=<query>
For Tabulated Data:
<ardiserver>/aql/api/table?query=<query>&format=<format>
For example, you can see the current values from Wind Turbine #1 from the following URL…
https://demo.optrix.com.au/s/ex/aql/api/query?query=%27Wind+Turbine+%231%27+ASSET+ALLPOINTS
Normal vs Tabulated Queries
Normal AQL queries return each point of data independently, based on how they are stored in their back-end system.
However when you're dealing with history, the different timings can be a significant issue when you are trying to create graphs, analytics and particularly machine-learning solutions.
The tabulated endpoint is used when requesting history from AQL - we'll cover its use in the next pages.
Normal Query Result
Normal (ie. non-tabulated) query results are returned as a JSON-encoded object.
{ "query": "'Wind Turbine #1' ASSET ALLPOINTS", "results": [ { "type": "pointlist", "value": [ { "assetid": 42, "sourceid": 42, "value": "WT-1", "rawvalue": "WT-1", "propid": 2, "fullvalue": "WT-1", "type": "TAG", "name": "Wind Turbine #1", "propname": "Equipment Tag", "ern": "WT-1" }, { "assetid": 42, "sourceid": 42, "value": "663.30206458", "rawvalue": "663.30206458", "propid": 28, "fullvalue": "663.30206458| V|0|700|1|^ V", "type": "MEASUREMENT", "name": "Wind Turbine #1", "code": "42:28:measurement", "units": " V", "min": "0", "max": "700", "places": "1", "propname": "Voltage", "ern": "WT-1" }, { "assetid": 42, "sourceid": 42, "value": "85.54490912", "rawvalue": "85.54490912", "propid": 31, "fullvalue": "85.54490912|%|0|100|1|^%", "type": "MEASUREMENT", "name": "Wind Turbine #1", "code": "42:31:measurement", "units": "%", "min": "0", "max": "100", "places": "1", "propname": "Load", "colours": { "0": "0000ff", "35": "247b00", "68": "0eff00", "91": "faff00", "100": "ff0000" }, "ern": "WT-1" }] }] }
Certain AQL queries may return multiple sets of results (for example, sets of values at different time ranges, or distinct min, max and average-value queries). This is why the response includes an array of objects in the Response section.
Each result has a type. In the example above, it's a POINTLIST. Pointlists are a list of points (property values). Each value includes…
Name | Meaning |
---|---|
type | The type of the property (ie. TEXT, MEASUREMENT, STATUS, ENUM) |
name | The name of the asset the property belongs to |
propname | The name of the property |
assetid | The numeric ID associated with the ARDI asset |
propertyid | The numeric ID associated with the ARDI property |
value | The current value of the property, delimited with vertical bars |
There are also some optional attributes depending on the type of property…
Name | Meaning | Type |
---|---|---|
min/max | The minimum and maximum Expected Range | MEASUREMENT |
units | The units of measurement | MEASUREMENT |
map | A lookup table from numeric value to text | LOOKUP/ENUM/STATUS |
colours | A table of colour values for analogue values | MEASUREMENT |
colourmap | A table of colour values for discrete values | ENUM/STATUS |
icons | A table of PNG images for discrete values | ENUM/STATUS |
history | A list of time/value pairs giving the value over time | BOUND ONLY |