Set mapping and tuple_keys in the constructor

Default to an empty hash when there are no primitive attributes
Small refactor in Header