# Model.Query Request

The model.query request is used to query models and references. The request will alert the platform to be routed to the Information Model Service to query for models and references of existing object models. model.query action message is sent to the platform by a connected device (i.e. Edge) via IoTHub.

# Idempotency

This request is idempotent, meaning that sending several identical requests will result in same responses being sent back.

# Event Properties

# Message Body

Property Mandatory Data Type Description
query Mandatory string Contains query in DSL format (see DSL Reference Documentation)

# Message format

{
    "msgType": "action",
    "action": "model.query",
    "version": 2,
    "ack": "<ack>",
    "correlationId": "<GUID>",
    "target": "<connected device path>",
    "body": {
        "query": "<DSL query string>"
    }
}

# Validation Rules

DCS validates all message properties, that the message body is in proper JSON format, and the message body property query as specified on the summary page of all v2 Device API messages. The message body is then passed to the Instance API /query endpoint where the remaining validation is performed.

# Functionality

# Description

The Information Model Service is queried for latest versions of models and/or references. For each fetched model, a model notification c2d message Abb.Ability.ObjectModel.Updated is sent back to directly connected device where it can also be propagated further if needed (based on target).

For each fetched reference, a reference notification c2d message Abb.Ability.ObjectModel.Reference.Updated is sent back to directly connected device where it can also be propagated further if needed (based on target).

If requested, acknowledgement c2d message is sent back to directly connected device where it can also be propagated further if needed (based on target). For more details see Acknowledgement Handling.

# Format of returned model notification c2d messages 'Abb.Ability.ObjectModel.Updated'

{
  "properties": {
    "msgType": "platformEvent",
    "eventType": "Abb.Ability.ObjectModel.Updated",
    "version": 2,
    "correlationId": "<correlation id>",
    "objectId": "<GUID>",
    "model": "<model definition>",
    "target": "<connected device path>"
  },
  "body": "{full object model payload}"
}

# Format of returned reference notification c2d messages 'Abb.Ability.ObjectModel.Reference.Updated'

{
  "properties": {
    "msgType": "platformEvent",
    "eventType": "Abb.Ability.ObjectModel.Reference.Updated",
    "version": 2,
    "correlationId": "<correlation id>",
    "objectId": "<GUID>",
    "model": "<model definition>",
    "target": "<connected device path>"
  },
  "body": "{full reference payload}"
}

# Format of returned acknowledgement c2d message

# Format of successful acknowledgment

{
    "properties": {
      "msgType": "ack",
      "action": "model.query",
      "correlationId": "<correlation id>",
      "version": 2,
      "target": "<some target>"
    },
    "body": {
      "success": true,
      "code": "ok",
      "details": "",
      "objectModels": "<number of models returned by query>",
      "references": "<number of references returned by query>"
    }
}

# Format of failing acknowledgment

{
    "properties": {
      "msgType": "ack",
      "action": "model.query",
      "correlationId": "<correlation id>",
      "version": 2,
      "target": "<some target>"
    },
    "body": {
      "success": false,
      "code": "<error code>",
      "details": "<error detail>"
    }
}

# Error handling

When an error occurs error information is logged inside platform in the Azure Portal on the Application Insight blade. If a response can be delivered back to the device then an acknowledgment can be sent back to device, if requested. More details can be found here: Acknowledgement Handling.

Last updated: 12/3/2021, 1:27:01 PM
Feedback