The Logic of Knowledge Bases