Lucas_Werkmeister_WMDE added a comment.
It’s used in `CallbackFactory`, like this: public function getCallbackToAddDataTypeToSnaksGroupedByProperty( PropertyDataTypeLookup $dataTypeLookup ) { return function ( $array ) use ( $dataTypeLookup ) { foreach ( $array as $propertyIdGroupKey => &$snakGroup ) { try { $dataType = $dataTypeLookup->getDataTypeIdForProperty( new PropertyId( $propertyIdGroupKey ) ); foreach ( $snakGroup as &$snak ) { $snak['datatype'] = $dataType; } } catch ( PropertyDataTypeLookupException $e ) { //XXX: shall we set $serialization['datatype'] = 'bad' ?? } } return $array; }; } public function getCallbackToAddDataTypeToSnak( PropertyDataTypeLookup $dataTypeLookup ) { return function ( $array ) use ( $dataTypeLookup ) { if ( is_array( $array ) ) { try { $dataType = $dataTypeLookup->getDataTypeIdForProperty( new PropertyId( $array['property'] ) ); $array['datatype'] = $dataType; } catch ( PropertyDataTypeLookupException $e ) { //XXX: shall we set $serialization['datatype'] = 'bad' ?? } } return $array; }; } I’m not sure why this is necessary. Even very old revisions already contain a snak type, though in a very different format; here’s the claims of revision 7203379 (earliest statement edit I could find) look like, for example: [ { "m": [ "value", 107, "wikibase-entityid", { "entity-type": "item", "numeric-id": 1969448 } ], "q": [], "g": "q1$D14AD1E5-FAEA-432D-BFC3-62175619F423", "rank": 1, "refs": [] } ] And here’s the more recent revision 798493007: { "P31": [ { "mainsnak": { "snaktype": "value", "property": "P31", "hash": "6de388c45d20bfaa9fe8f07528413ac1078edf44", "datavalue": { "value": { "entity-type": "item", "numeric-id": 36330215, "id": "Q36330215" }, "type": "wikibase-entityid" } }, "type": "statement", "id": "Q14840$3075B641-8C36-4409-A1BE-31990E2B6BD7", "rank": "normal" } ] } The format is very different, but both contain the `wikibase-entityid` – though it’s possible that there were some intermediate serialization versions where it was missing. TASK DETAIL https://phabricator.wikimedia.org/T243952 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/ To: Lucas_Werkmeister_WMDE Cc: Lucas_Werkmeister_WMDE, Addshore, Aklapper, Agabi10, Ladsgroup, darthmon_wmde, Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, rosalieper, Scott_WUaS, Jonas, Wikidata-bugs, aude, Lydia_Pintscher, Mbch331
_______________________________________________ Wikidata-bugs mailing list Wikidata-bugs@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs