In order to enable custom value parsers for certain data types (T359421) we need to look up the corresponding Property's data type whenever a statement/qualifier/reference value is parsed. This currently results in a circular dependency in Wikibase:
- Store depends on Deserialization (because the DB contains serialized entities and we want Store services to return data model objects, not JSON/arrays)
- PropertyDataTypeLookup is part of Store
- we now create a "data type aware value deserializer" which is part of deserialization but depends on Store via PropertyDataTypeLookup
- Store <- Deserialization <- Store <- ... β»οΈ
The goal would be to start with the following approach and only if that doesn't work we'd implement the second approach
Approach #1
- create a PropertyDataTypeLookup that doesn't depend on Store specifically for this purpose
- e.g. using PropertyInfoDataTypeLookup as done in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/994205 (but maybe wrapped in a cache)
- likely requires a whole lot less work than the approach #2, but potentially comes with undesired side effects if we rely on secondary storage (https://doc.wikimedia.org/Wikibase/master/php/docs_storage_propertyinfo.html)
Approach #2
- separate the existing PropertyDataTypeLookup from Store
- means we need to rethink the EntityRetrievingDataTypeLookup because it encompasses the full circular dependency within a single class