Specify operator properties

With the streams fully defined, it is time to configure the operators.

  1. In the graphical editor, select FileSink_1.
  2. In the Properties view, click the Param tab.
    This shows one mandatory parameter, file, with a placeholder value of parameterValue (not a valid value, hence the error marker).
  3. Click on the field that says parameterValue, and type "filtered.cars" (with the double quotes).
  4. Press Enter.
    Note that this is a relative path. It doesn’t start with “/”, so this file will go in the data subdirectory of the current project as specified by default for this application.
  5. Click Add to add two more parameters.
  6. In the Select parameters dialog, select format and quoteStrings. You might need to scroll down to find it.
  7. Click OK.
  8. For the value of format, enter csv. Do not use quotation marks; this is an enumerated value.
  9. For the value of quoteString, enter false. Do not use quotation marks; this is a Boolean value.
    The properties view should look like this:
  10. The FileSource operator needs to know what file to read. In the graphical editor, select the FileSource_2 operator.
  11. In the Properties view (Param tab), click Add.
  12. In the Select parameters dialog, select file and format.
  13. Click OK.
  14. In the value for file, enter "/home/streamsadmin/data/all.cars" (with quotes and exactly as shown—all lowercase).
  15. For format, enter csv.
  16. You have to tell the Filter operator what to filter on. Without a filter condition, it will simply copy every input tuple to the output.
    In the graphical editor, select Filter_3.
  17. In the Properties view (Param tab), click Add.
  18. In the Select parameters dialog, select filter, and click OK.
  19. In the value field, enter the Boolean expression id in ["C101","C133"] to indicate that only tuples for which that expression evaluates to true should be passed along to the output. (The expression with the key word in followed by a list evaluates to true only if an element of the list matches the item on the left.)
  20. Save your changes. The error markers disappear, and the application is valid.
  21. Make a few final changes.
    Select the FileSink operator again.
  22. Go back to the General tab in the Properties view.
  23. Rename the operator in the same way you renamed the two streams earlier. Call it Writer.
  24. Select the FileSource operator, and rename it. This time, leave the name blank. Observe how the Identifier changes to Observations, which is the name of the output stream.
  25. Rename the Filter operator by removing the alias. In the graph, it will show as Filtered, which is the name of the output stream.
  26. Save your changes and dismiss the floating Properties view.
    Tip for operator identifiers and aliases: SPL automatically assigns a name (identifier) to an operator by using the name of the output stream or streams. It also allows you to assign an alias to use as identifier instead, which gives you, as a developer, more control.
    The graphical editor automatically assigns a generated alias to every operator, but in case of a single output stream, using the stream name is usually fine, so it is better to omit the alias. For an operator with multiple output streams, it’s a good idea to provide a more descriptive alias. When there is no output stream (as for the FileSink) an alias is mandatory.
  27. Check your results.
    The Properties view might have been obscuring this, but each time you saved the graph, a build was started to compile the application. The progress messages are shown in the Console view (in a console called SPL Build). If you scroll back, you will see some builds that terminated on errors, with messages in red. (You might also want to maximize the Console view.) The last build should have completed without any errors.