1

I have the following declarations of schemas (event types)

create  json schema DetectedObjects as (tracking_id int, class_id int, class_name string, confidence double, bbox_xywh int[], rois string[], lc string[], rois_oc string[]);

create  map schema CountMap as (obj string, cnt int);

create   json schema Analytics as ( obj_count_rois CountMap, overcrowded_rois string[], lc_cum_count CountMap, lc_curr_count CountMap);

create   json schema FrameMeta as (frame_num int, source_id int, frame_width int, frame_height int, raw_time long, timestamp string, analytics Analytics);

create  json schema IdentifiedFrames as ( frame_meta FrameMeta,  Objects_meta DetectedObjects[]);

When receiving an instance of event IdenfitiedFames, Esper does not populate automatically the stream of DetectedObjects

For example, I receive the following event

{
  "frame_meta": {
    "frame_num": 500,
    "source_id": 4,
    "frame_width": 720,
    "frame_height": 567,
    "raw_time": 165478954214,
    "timestamp": "2021-11-11 16:45:46",
    "analytics":
    {
      "obj_count_rois":
      {
        "ROI1": 5,
        "ROI2":2,
        "ROI3":4
      },
      "overcrowded_rois": ["ROI1","ROI2","ROI3"],
      "lc_cum_count": {
        "LINE1": 11,
        "LINE2":15
      },
      "lc_curr_count": {
        "LINE1":2,
        "LINE2":3
      }

    }

  },
  "Objects_meta": [
    {
      "tracking_id": 1,
      "class_id": 0,
      "class_name": "person",
      "confidence": 0.7,
      "bbox_xywh": [25,165,40,150],
      "rois": ["ROI1"],
      "lc": ["LINE2"],
      "rois_oc": []
    },
    {
      "tracking_id": 2,
      "class_id": 2,
      "class_name": "bag",
      "confidence": 0.9,
      "bbox_xywh": [150,16,80,100],
      "rois": ["ROI1"],
      "lc": [],
      "rois_oc": []
    },
    {
      "tracking_id": 3,
      "class_id": 1,
      "class_name": "veichle",
      "confidence": 0.62,
      "bbox_xywh": [420,165,50,60],
      "rois": [],
      "lc": [],
      "rois_oc": []
    },
    {
      "tracking_id": 4,
      "class_id": 0,
      "class_name": "person",
      "confidence": 0.78,
      "bbox_xywh": [240,143,50,120],
      "rois": ["ROI2"],
      "lc": ["LINE1"],
      "rois_oc": []
    }
  ]
}

I want to populate the DetectObjects stream with each entry in the Objects_meta property. My question is: is there something like select explode in EPL? I know that I can declare everything as Java classes and use the runtime object to send events. I am seeking something of a declarative nature or scripting in EPL.

Ahmed Awad
  • 95
  • 8

1 Answers1

2

The select clause can have expressions in brackets that explode events into more events. The documentation is here. The brackets can also have a select-clause and can combine the container event and each contained event.

insert into Exploded select * from IdentifiedFrames[DetectedObjects]
user3613754
  • 816
  • 1
  • 5
  • 5