An XQuery library for discovering the privileges required by a function