Adding building blocks for association loading.

Extracting code from our main minimapper project. Hard to test in a sane
way yet, the include part is mostly an optimization.