A new study traces the farming heritage of Wales and shows there's more to the common sheep pen than meets the eye.