Skip to content

Commit 255cc8b

Browse files
committed
Fixes for mergeUpdate
1 parent fef381f commit 255cc8b

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@ function _getDuplicatedEmptyDFG(dfg::CloudGraphsDFG)::CloudGraphsDFG
1212
length(_getLabelsFromCyphonQuery(dfg.neo4jInstance, "(node:$(dfg.userId):$(dfg.robotId):$(sessionId))")) == 0 && break
1313
end
1414
@debug "Unique+empty copy session name: $sessionId"
15-
return CloudGraphsDFG{typeof(dfg.solverParams)}(dfg.neo4jInstance.connection, dfg.userId, dfg.robotId, sessionId, dfg.encodePackedTypeFunc, dfg.getPackedTypeFunc, dfg.decodePackedTypeFunc, dfg.rebuildFactorMetadata!, solverParams=deepcopy(dfg.solverParams), description="(Copy of) $(dfg.description)")
15+
return CloudGraphsDFG{typeof(dfg.solverParams)}(
16+
dfg.neo4jInstance.connection,
17+
dfg.userId,
18+
dfg.robotId,
19+
sessionId,
20+
dfg.encodePackedTypeFunc,
21+
dfg.getPackedTypeFunc,
22+
dfg.decodePackedTypeFunc,
23+
dfg.rebuildFactorMetadata!,
24+
solverParams=deepcopy(dfg.solverParams))
1625
end
1726

1827
# Accessors
@@ -170,6 +179,12 @@ function getVariable(dfg::CloudGraphsDFG, label::Union{Symbol, String})::DFGVari
170179

171180
props = getnodeproperties(dfg.neo4jInstance.graph, nodeId)
172181
variable = unpackVariable(dfg, props)
182+
183+
# TODO - make this get PPE's in batch
184+
for ppe in listPPE(dfg, label)
185+
variable.ppeDict[ppe] = getPPE(dfg, label, ppe)
186+
end
187+
return variable
173188
end
174189

175190
function getFactor(dfg::CloudGraphsDFG, label::Union{Symbol, String})::DFGFactor
@@ -212,13 +227,12 @@ function mergeUpdateVariableSolverData!(dfg::CloudGraphsDFG, sourceVariable::DFG
212227
if !exists(dfg, sourceVariable)
213228
error("Source variable '$(sourceVariable.label)' doesn't exist in the graph.")
214229
end
215-
var = getVariable(dfg, sourceVariable.label)
216-
newEsts = merge!(var.ppeDict, deepcopy(sourceVariable.ppeDict))
217-
newSolveData = merge!(var.solverDataDict, sourceVariable.solverDataDict)
218-
Neo4j.setnodeproperty(dfg.neo4jInstance.graph, var._internalId, "ppeDict",
219-
JSON2.write(newEsts))
220-
Neo4j.setnodeproperty(dfg.neo4jInstance.graph, var._internalId, "solverDataDict",
221-
JSON2.write(Dict(keys(newSolveData) .=> map(vnd -> packVariableNodeData(dfg, vnd), values(newSolveData)))))
230+
for (k,v) in sourceVariable.ppeDict
231+
updatePPE!(dfg, getLabel(sourceVariable), v, k)
232+
end
233+
for (k,v) in sourceVariable.solverDataDict
234+
updateVariableSolverData!(dfg, getLabel(sourceVariable), v, k)
235+
end
222236
return sourceVariable
223237
end
224238

src/services/AbstractDFG.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ Returns a LightDFG{NoSolverParams, DFGVariableSummary, DFGFactorSummary}.
10591059
"""
10601060
function getSummaryGraph(dfg::G)::LightDFG{NoSolverParams, DFGVariableSummary, DFGFactorSummary} where {G <: AbstractDFG}
10611061
summaryDfg = LightDFG{NoSolverParams, DFGVariableSummary, DFGFactorSummary}(
1062-
description="Summary of $(dfg.description)",
1062+
description="Summary of $(getDescription(dfg))",
10631063
userId=dfg.userId,
10641064
robotId=dfg.robotId,
10651065
sessionId=dfg.sessionId)

0 commit comments

Comments
 (0)