small Wikibase-related code improvements

- avoid repetition of "data['mainsnak']['datavalue']['value']"
- avoid repetition of "value = self.getTarget().toWikibase()"
- enforce type compliance for quantity datatype

split from Ibe77c51fc5cf3dae8ece533cc5787bf960f0ebed

Change-Id: I79941ae8711b3e9e6e8f0915dd6b911fc28ca440
Merge "small Wikibase-related code improvements"