Overview

In this lab, you will enhance the app you’ve built by adding an operator to compute an average speed over every five observations, separately for each vehicle tracked. After that, you will use the Streams Console to monitor results.

So far, the operators you’ve used look at each tuple in isolation, and there was no need to keep any history. However, for many analytical processes, it is necessary to remember some history to compute the desired results. In stream computing, there is no such thing as “the entire data set,” but it is possible to define buffers holding a limited sequence of consecutive tuples, for example, to compute the average over that limited subset of tuples of one or more numeric attributes. Such buffers are called windows. In this part, you will use an Aggregate operator to compute just such an average.

Prerequisites

If you successfully completed the previous lab, skip this section and go to Step 1.

If you did not successfully complete the previous lab, you can continue with this lab by importing a Streams project that has been prepared for you and that contains the expected results from Lab 2.

To import the Streams project:

  1. In the Project Explorer, right-click the current project (MyProject or MyProject1) and select Close Project. This gets it out of the way for builds or name conflicts without deleting any files.
  2. In the top Eclipse menu, click File > Import.
  3. In the Import dialog, click IBM Streams Studio > SPL Project. Then, click Next.
  4. Click Browse. In the file browser, expand My Home, scroll down, expand Labs, and select IntroLab. Click OK.
  5. Select MyProject2 and click Finish.
    This starts a build, but you don’t need to wait until it finishes.
  6. In the Project Explorer, expand MyProject2 and then my.name.space.
  7. Double-click MyMainComposite to open it in the graphical editor.
  8. In the editor palette, right-click Toolkits. In the context menu, clear Show All Toolkits.