Add new Term classes

Most of this has already been reviewed before it was merged into
https://github.com/wmde/WikibaseInternalSerialization/tree/master/DataModel

This commit moves the code to DataModel, adds tests, adds some validity
checks and adds some new getters

This is part of the evil plan to split up Entity as per
https://github.com/wmde/WikibaseDataModel/issues/22.

The new classes are essentially already used by WikibaseInternalSerialization.