Merging attributes and relations