Fix error on duplicate link when target query is flat

The check for duplicate links assumed a hierarchical query.
Added more sample Mapping files.