In Graphileon, both matching and mapping are mechanisms used in the execution of triggers, but they serve different purposes:

  1. Matching: This is the process that determines whether a trigger should be executed based on the current event. Each trigger has properties that are compared to the properties of the event. If all the properties match, the trigger is executed. For example, a trigger might have a “type” property set to “success”. If the event also has a “type” property set to “success”, the trigger will be executed. This mechanism allows you to control which triggers are executed based on the properties of the event.
  2. Mapping: Once a trigger has been matched and is set to be executed, the mapping process determines what data is passed to the next function in the chain. The properties of the trigger that start with “$” or “#” are used to map data from the event to the next function. For example, a trigger might have a “#data” property set to “(%).data”. This means that the “data” property of the event will be passed as an array to the next function. This mechanism allows you to control what data is passed to the next function in the chain.

In summary, matching is about deciding whether a trigger should be executed based on the properties of the event, while mapping is about deciding what data to pass to the next function once a trigger has been executed.