Functional Approach to Chemical Structure Databases