@@ -349,29 +349,40 @@ function unpackVariable(
349
349
isnothing (variableType) && error (" Cannot deserialize variableType '$variableTypeString ' in variable '$label '" )
350
350
pointType = getPointType (variableType)
351
351
352
- _ensureid! (s:: Dict ) = begin s[" id" ] = haskey (s, " id" ) ? s[" id" ] : nothing end
353
- _ensureid! (s:: PackedVariableNodeData ) = s
354
-
355
- # FIXME , drop nested packing, see DFG #867
356
- solverData = if unpackSolverData && haskey (packedProps, " solverDataDict" )
357
- packed = if packedProps[" solverDataDict" ] isa String
358
- # JSON2.read(packedProps["solverDataDict"], Dict{String, PackedVariableNodeData})
359
- # JSON3.read(packedProps["solverDataDict"], Dict{String, PackedVariableNodeData})
360
- jdc = JSON. parse (packedProps[" solverDataDict" ])
352
+ function _unpackSolverData (
353
+ packedSolverData;
354
+ oldkeys= false
355
+ )
356
+ _ensureid! (s:: Dict ) = begin s[" id" ] = haskey (s, " id" ) ? s[" id" ] : nothing end
357
+ _ensureid! (s:: PackedVariableNodeData ) = s
358
+ packed = if packedSolverData isa String
359
+ # JSON2.read(packedSolverData, Dict{String, PackedVariableNodeData})
360
+ # JSON3.read(packedSolverData, Dict{String, PackedVariableNodeData})
361
+ jdc = JSON. parse (packedSolverData)
361
362
jpvd = Dict {String,PackedVariableNodeData} ()
362
363
for (k,v) in jdc
363
364
_ensureid! (v)
364
365
jpvd[k] = transcodeType (PackedVariableNodeData, v)
365
366
end
366
367
jpvd
367
368
else
368
- packedProps[ " solverDataDict " ]
369
+ packedSolverData
369
370
end
370
371
packedvals = values (packed)
371
372
_ensureid! .(packedvals)
373
+ # @show keys(packed)
372
374
# TODO deprecate, this is for DFG18 compat only
373
375
packed_ = transcodeType .(PackedVariableNodeData, packedvals) # from Dict to hard type
374
- Dict {Symbol, VariableNodeData{variableType, pointType}} (Symbol .(keys (packed)) .=> map (p -> unpackVariableNodeData (p), packed_))
376
+ unpacked_ = map (p -> unpackVariableNodeData (p), packed_)
377
+ keys_ = oldkeys ? Symbol .(keys (packed_)) : map (s-> s. solveKey, unpacked_)
378
+ Dict {Symbol, VariableNodeData{variableType, pointType}} (keys_ .=> unpacked_)
379
+ end
380
+
381
+ # FIXME , drop nested packing, see DFG #867
382
+ solverData = if unpackSolverData && haskey (packedProps, " solverDataDict" )
383
+ _unpackSolverData (packedProps[" solverDataDict" ]; oldkeys= false )
384
+ elseif unpackSolverData && haskey (packedProps, " solverData" )
385
+ _unpackSolverData (packedProps[" solverData" ])
375
386
else
376
387
Dict {Symbol, VariableNodeData{variableType, pointType}} ()
377
388
end
@@ -380,13 +391,13 @@ function unpackVariable(
380
391
# variable = DFGVariable{variableType}(Symbol(packedProps["label"]), timestamp, nstime, Set(tags), ppeDict, solverData, smallData, Dict{Symbol,AbstractDataEntry}(), Ref(packedProps["solvable"]))
381
392
382
393
variable = DFGVariable {variableType} (;
383
- id= id ,
394
+ id,
384
395
label = Symbol (packedProps[" label" ]),
385
396
# variableType = variableType,
386
- timestamp = timestamp ,
387
- nstime = nstime ,
397
+ timestamp,
398
+ nstime,
388
399
tags = Set {Symbol} (tags_),
389
- ppeDict = ppeDict ,
400
+ ppeDict,
390
401
solverDataDict = solverData,
391
402
smallData= smallData,
392
403
dataDict = Dict {Symbol,AbstractDataEntry} (),
0 commit comments