Foundations of Knowledge Base Management