What semantic notions underlie "righteousness, uprightness" (義) with "appearance; apparatus" (儀)?
CUHK does give you an answer in the entry of 義 .
儀 is a derivative character of 義. When there are too many meanings derived for a character, people would like to make a new character by putting an indicator for specific meaning. Here they put 人 to 義 and it is 儀.
Actually, “righteousness, uprightness” of 義 is a derivative meaning. The original meaning of “appearance” is transferred to 儀. In the very ancient only 義 exists.
義 is composed of 我 and 羊. 我 is a kind of weapon and make the symbol of an army. Character adding 羊 is an indicator of good thing, such as 祥, 善 and 美. 義, the combination of 羊 and 我, demonstrates the meaning of the good appearance of an army and it is well-disciplined. It gives the meaning of 威儀. (For definition 1)
With good appearance of an army, ceremony and etiquette comes. (For definition 2) With ceremony and etiquette, they make use of some instruments as the symbol of power and mightiness. (For definition 4) It is the symbol of the common ruler of tribe rulers. The common ruler has the right to punish those tribes that do something bad.
From this point they associates it with the righteousness of army. The meaning of righteousness and uprightness in 義 hence derived.
The school of Confucius and Mencius speaks a lot about 仁 and 義. 仁 is soft and on the peaceful side, and it is benevolence. On the contrary 義 is the hard way and on the forceful side. 義 permits of the use of force to correct the injustice.
Giving others presents and gifts is part of ceremony and etiquette eventually. (For definition 3)