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
--
Thiemo Mättig
Software-Entwickler
Wikimedia Deutschland e.V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Tel. (030) 219 158 26-0
http://wikimedia.de
Stellen Sie sich eine Welt vor, in der jeder Mensch an der Menge allen
Wissens frei teilhaben kann. Helfen Sie uns dabei!
http://spenden.wikimedia.de/
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e.V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg
unter der Nummer 23855 B. Als gemeinnützig anerkannt durch das
Finanzamt für Körperschaften I Berlin, Steuernummer 27/681/51985.