Building Intelligent Databases through Similarity: Interaction of Logical and Qualitative Reasoning