Compile rule application function. Add authoriships and referrals patterns.