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…

NameMeaning
typeThe type of the property (ie. TEXT, MEASUREMENT, STATUS, ENUM)
nameThe name of the asset the property belongs to
propnameThe name of the property
assetidThe numeric ID associated with the ARDI asset
propertyidThe numeric ID associated with the ARDI property
valueThe current value of the property, delimited with vertical bars

There are also some optional attributes depending on the type of property…

NameMeaningType
min/maxThe minimum and maximum Expected RangeMEASUREMENT
unitsThe units of measurementMEASUREMENT
mapA lookup table from numeric value to textLOOKUP/ENUM/STATUS
coloursA table of colour values for analogue valuesMEASUREMENT
colourmapA table of colour values for discrete valuesENUM/STATUS
iconsA table of PNG images for discrete valuesENUM/STATUS
historyA list of time/value pairs giving the value over timeBOUND ONLY

Continue Reading