In the Units data, there is an object type Resource. In the field Behavior - Resource Type can be selected what kind of resource the unit is. Next thing you need is a Behavior with the type Resource. If you want a to build another building on top of that, you need to give that building also that Resource Type. Furthermore you need to add some behaviors, I suggest you take a look at the bahviors Automated Refinery.
In the Units data, there is an object type Resource. In the field Behavior - Resource Type can be selected what kind of resource the unit is. Next thing you need is a Behavior with the type Resource. If you want a to build another building on top of that, you need to give that building also that Resource Type. Furthermore you need to add some behaviors, I suggest you take a look at the bahviors Automated Refinery.