The dependency graph is the heart of the system, as it lets us determine the order in which the resources should be processed in.
The dependency graph is the result of the graph builder.
The graph is a simplified cookie-cutter graph theory implementation, and we won’t go into details there.
Create an initial dependency graph that can be used for structured preprocessing.
Run a series of preprocessing operations over the initial dependency graph.
Create a final dependency graph that is used by the encoder.
Initial dependency graph
The graph builder firstly constructs an initial dependency graph based on the constraints defined by the resource structures.
The initial graph is temporary and is used by any preprocessing operations. This simplifies preprocessing operations, as their execution is structured and they don’t need to worry about any potentially missing dependency.
Preprocessing operations can additionally affect how the final dependency graph may look like. Resources can further define dependencies or even remove obsolete dependencies.
This is especially useful for records, as we may not know what other modules they relate to (the module defines that).
Final dependency graph
The resource encoding layer uses the final dependency graph.
You can also define any other operation with the resulting dependency graph.
Make sure that the dependency graph is valid if you decide to do any manual transformations to it.