title: How do I design a database to store properties, selecting attributes by synonyms
body: <p>I am designing a database for a real estate application. It is proving to be more involved than I had anticipated (maybe I am overcomplicating things).</p>
  
  <p>The problems essentially are due to the presence of:</p>
  
  <ul>
  <li>synonyms
  For example the terms: flat, apartment and penthouse may all refer to essentially, the same type of property</li>
  <li>attributes (different property types have different attributes)
  For example an apartment could be a ground floor or top floor etc</li>
  </ul>
  
  <p>I have ended up with a rather (unintentionally) elaborate classification tree for different property types. The tree nodes are the actual instances of property types.</p>
  
  <p>I want to create a database so that I can query using not only any of the synonyms, but also  the attributes.</p>
  
  <p>So for example, the query (in pseudo SQL):</p>
  
  <p>SELECT * from properties where synonym="flat" and attribute IN ('ground floor', 'garden');</p>
  
  <p>should return a list of apartments|flats that are either ground floor AND have a garden.</p>
  
  <p>Can someone help me with how to design the database schema so as to allow the kind of querying described above?</p>
  
  <p>Last but not the least, I will be using either MySQl or PostgreSQL as the backend database, but would prefer the approach to be db agnostic - if possible.</p>