Tpt asked:
why having both the Term and the MonolingualText data structures? Is it just for historical reasons (labels have been introduced before statements and so before all the DataValue system) or is there an architectural reason behind?
That's not the only reason.
First, all data values (including monolingual text) must implement the same DataValue interface.
Term must not implement anything (it does implement Comparable for convenience).
All DataValues share the same abstract DataValueObject base class. The only reason for this is code sharing. No code should type hint against DataValueObject (I just checked and hurray, we are clean).
MonolingualTextValue could indeed share code with Term. But it's not possible to do "class MonolingualTextValue extends DataValueObject, Term" in PHP. We would need to drop the code sharing with DataValueObject and do "class MonolingualTextValue extends Term implements DataValue" instead, which means we would have to copy all the code from DataValueObject over to MonolingualTextValue. This is entirely possible, but what would be the actual advantage of such a change? Which code would benefit from being able to pass MonoLingualValue's to code that accepts Term's?
Best Thiemo