XML Data Structures: Feeding the Rave Engine
A key feature of the Rave language is that it separates the logic from the data. The external application supplies the input data that can be referenced in the Rave code.
At compile-time, Rave does not have access to data; it only knows the structure of the data. During runtime, the Jeppesen Pairing Generator feeds massive amounts of flight, airport, and crew data into the rule evaluation engine. Historically and practically, XML (and specialized proprietary tabular formats) are heavily used to structure this payload.
1. The Keyword Mapping
In Rave, a Keyword acts as a special kind of variable used to refer to this external data. For example, the start time of a flight is supplied by the application running the Rave code and mapped to a keyword.
graph LR
XML["XML/Data Payload<br>(Departure: 10:00Z)"] --> Engine["Optimization Engine"]
Engine --> Map["Keyword Mapping"]
Map --> Rave["Rave Code<br>leg.%start_utc%"]
2. Example Data Representation
While the exact proprietary schema formats vary by airline implementation, the conceptual structure resembles hierarchical XML. The data must perfectly align with Rave's internal hierarchy (Leg \(\rightarrow\) Duty \(\rightarrow\) Trip).
<FlightSchedule>
<Leg id="N01234">
<DepartureAirport>OSL</DepartureAirport>
<ArrivalAirport>BGO</ArrivalAirport>
<StartUTC>2026-08-12T08:00:00Z</StartUTC>
<EndUTC>2026-08-12T08:50:00Z</EndUTC>
<AircraftType>B738</AircraftType>
</Leg>
<Leg id="N01235">
<!-- Subsequent leg data -->
</Leg>
</FlightSchedule>
When the optimization engine reads this Leg data, it populates the keywords. A Rave developer can then reference these fields dynamically in their rules:
// The external XML 'StartUTC' is mapped to keywords.%departure% or leg.%start_utc%
%leg_time% = leg.%end_utc% - leg.%start_utc%;
Because the data is only supplied at runtime, Rave developers must write safe, generic logic that can handle edge cases without failing, as it is not safe to make assumptions about variables in the Rave code at compile-time.