Skip to main content
Version: 2.12.X

Building Models in Cogynt Authoring

With the capitals_training.json file uploaded, the next step is to start building a model to process the data. This process consists of the following steps:

  1. Discovering a schema
  2. Creating event patterns
  3. Setting partitions
  4. Defining outcomes
  5. Setting computations

Discovering Schemas

Cogynt Authoring's Schema Discovery utility expedites model creation by providing data schemas that are pre-populated with relevant values based on your data. In this step, you'll use the utility to analyze the capitals_training.json data. The utility will then suggest possible schemas for you to use.

To discover a schema:

  1. Return to Cogynt Authoring by entering the appropriate address in your web browser.
  2. On the Project homepage, click the system panel (☰) icon.
  3. Under Other Tasks, click Schema Discovery.
  4. In the Schema Discovery dialog:
    1. From the Project dropdown menu, select the project you created (following our example, "Hello World" + your initials).
    2. From the Kafka Broker dropdown menu, select the default Kafka broker.
    3. Click Discover.
    4. In the Discovered Topics list, click the topic you created (following our example, "capitals_" + your initials).
    5. Click Create User Data Schema.
  5. In the Create User Data Schema dialog:
    1. In the Name field, type a name for the schema. (By default, it uses the name of the selected topic.)
    2. In the Description field, type a description for the schema if necessary.
    3. Click Create.

If the schema creation is successful, Cogynt displays a confirmation message.

Once you receive the confirmation message, you can move on to creating event patterns.

Creating Event Patterns

The primary unit of logic in a Cogynt model is the event pattern. An event pattern contains pattern detection logic. Users decide what kind of data it should receive, process, and produce for output. For more information about working with event patterns, see System Authoring in the Cogynt Authoring User Guide.

In modeling diagrams, event patterns are represented by event pattern nodes. Models can contain a great many nodes, but this guide's simple model requires only one.

To create an event pattern:

  1. In Cogynt Authoring, navigate to the diagramming area.
  2. In the tool palette in the upper-left of the screen, click the Event Pattern icon.
  3. Click any open space in the diagramming area to place an event pattern node there.
  4. On the right of the screen, under the Contents tab:
    1. Type a name for the event pattern in the Name field. (For this exercise, "Hello World" followed by your initials is recommended.)
    2. In the Description field, type a description. (For this exercise, typing "Training" is recommended.)
  5. In the diagramming area, double-click the event pattern node you placed in Step 3. The event pattern modeling screen opens.
  6. In the tool palette, click Add Element (⬭), then click New Event Type.
  7. In the Create Event Type dialog:
    1. In the Name field, type a name for the event type. (For this exercise, "Capitals Data" followed by your initials is recommended.)
    2. From the Topic dropdown menu, select the topic you created (following our example, "capitals_" + your initials).
    3. From the User Data Schema dropdown menu, select the user data schema you created.
    4. Click Create.

Once you finish this process, the created event type is added to your model.

The next step is to set partitions on the event pattern for greater data processing precision.

Setting Partitions

A partition instructs the system to analyze events based on a particular field within a specified event pattern. For more information, see Creating Partitions in the Cogynt Authoring User Guide.

To create a partition for your event pattern:

  1. In Cogynt Authoring, navigate to the diagramming area.
  2. Click the event pattern node you created.
  3. In the details panel, click the Contents tab if it is not already selected.
  4. Under Attributes, click the Partitions section to expand it.
  5. Confirm that the Enable Partitions toggle is set to "on." (If it is set to "off," click the toggle to set it to the "on" position.)
  6. Beside the Enable Partitions toggle, click +.
  7. In the Create Partition dialog:
    1. From the Elements dropdown menu, select the event pattern you created. (Following our example, it would be "Capitals Data" + your initials.)
    2. From the Fields dropdown menu, select the field to partition over. For this exercise, select the country_name field. (Note: The Fields dropdown menu cannot be opened until a selection has been made from Elements.)
  8. Click Create to create.

With the partition set, your pattern will now publish a unique solution for each country in the data set. Workstation will then process each unique solution as a separate record.

The next step is to define an outcome for the event pattern.

Defining Outcomes

An outcome represents output data in a model. Once Cogynt finds a pattern you've defined, an outcome tells the system what to do after that discovery. For more information about outcomes, see Working with Outcomes in the Cogynt Authoring User Guide.

To create an outcome:

  1. In Cogynt Authoring, navigate to the diagramming area.
  2. In the diagramming area, click the event pattern node you created.
  3. In the tool palette, click Add Outcome (▭).
  4. In the Select Event Type dialog, click New.
  5. In the Create Event Type dialog:
    1. In the Name field, type a name for the outcome. (For this exercise, "Hello World Results" is recommended.)
    2. In the Topic field, enter a Kafka topic name. It is recommended that the Kafka topic name matches what you've entered in the Name field as closely as possible, using underscores (_) instead of spaces. (For this exercise, "hello_world_results" is recommended.)
    3. From the User Data Schemas dropdown menu, select the schema you previously used.
    4. Click Create.

Once you have defined an outcome, the next step is to set some computations to process the data points your outcome will generate.

Setting Computations

Cogynt has many built-in computations and functions that make it possible to perform complex calculations or analyses based on inputs from multiple sources.

For this exercise, you'll practice mapping input values to lay the groundwork for computations. After you've finished the entire walkthrough, feel free to return to this section to experiment with computations further.

To add a computation element to your model:

  1. In Cogynt Authoring, navigate to the diagramming area.
  2. In the diagramming area, double-click the outcome you created.
  3. Right-click to open the tool palette.
  4. In the tool palette, click Map Input Element.
  5. Click the event pattern you created. (Following our example, it would be "Capitals Data" + your initials.)
  6. Click any open space in the diagramming area to place the computation element.
  7. Connect the data fields from the "Capitals Data + initials" input node to the "Hello World Results" output node by clicking and dragging. Establish the following connections:
    • capital_name to capital_name
    • continent_name to continent_name
    • country_code to country_code
    • country_name to country_name
    • geo_coordinates to geo_coordinates
  8. When finished, click Hello World in the top navigation bar to return to the event pattern home screen.

With your computations set, you have now configured a complete model. Next, you will deploy your model to start putting it to work.

Did you find the information that you needed?