Skip to content

Commit efdc701

Browse files
committed
Deprecation and partial fix for #375
1 parent 1b207ea commit efdc701

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function getVariable(dfg::CloudGraphsDFG, label::Union{Symbol, String})::DFGVari
221221
if typeof(label) == String
222222
label = Symbol(label)
223223
end
224-
nodeId = _tryGetNeoNodeIdFromNodeLabel(dfg.neo4jInstance, dfg.userId, dfg.robotId, dfg.sessionId, label)
224+
nodeId = _tryGetNeoNodeIdFromNodeLabel(dfg.neo4jInstance, dfg.userId, dfg.robotId, dfg.sessionId, label, nodeType="VARIABLE")
225225
if nodeId == nothing
226226
error("Unable to retrieve the ID for variable '$label'. Please check your connection to the database and that the variable exists.")
227227
end
@@ -240,7 +240,7 @@ function getFactor(dfg::CloudGraphsDFG, label::Union{Symbol, String})::DFGFactor
240240
if typeof(label) == String
241241
label = Symbol(label)
242242
end
243-
nodeId = _tryGetNeoNodeIdFromNodeLabel(dfg.neo4jInstance, dfg.userId, dfg.robotId, dfg.sessionId, label)
243+
nodeId = _tryGetNeoNodeIdFromNodeLabel(dfg.neo4jInstance, dfg.userId, dfg.robotId, dfg.sessionId, label, nodeType="FACTOR")
244244
if nodeId == nothing
245245
error("Unable to retrieve the ID for factor '$label'. Please check your connection to the database and that the factor exists.")
246246
end

src/CloudGraphsDFG/services/CommonFunctions.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,15 @@ end
160160
$(SIGNATURES)
161161
Try get a Neo4j node ID from a node label.
162162
"""
163-
function _tryGetNeoNodeIdFromNodeLabel(neo4jInstance::Neo4jInstance, userId::String, robotId::String, sessionId::String, nodeLabel::Symbol)::Union{Nothing, Int}
163+
function _tryGetNeoNodeIdFromNodeLabel(neo4jInstance::Neo4jInstance, userId::String, robotId::String, sessionId::String, nodeLabel::Symbol; nodeType::Union{Nothing, String}=nothing)::Union{Nothing, Int}
164164
@debug "Looking up symbolic node ID where n.label = '$nodeLabel'..."
165-
nodes = _getNeoNodesFromCyphonQuery(neo4jInstance, "(node:$userId:$robotId:$sessionId) where exists(node.label) and node.label = \"$(string(nodeLabel))\"")
166-
if(length(nodes) != 1)
165+
if nodeType == nothing
166+
nodes = _getNeoNodesFromCyphonQuery(neo4jInstance, "(node:$userId:$robotId:$sessionId) where exists(node.label) and node.label = \"$(string(nodeLabel))\"")
167+
else
168+
nodes = _getNeoNodesFromCyphonQuery(neo4jInstance, "(node:$nodeType:$userId:$robotId:$sessionId) where exists(node.label) and node.label = \"$(string(nodeLabel))\"")
169+
end
170+
171+
if length(nodes) != 1
167172
return nothing
168173
end
169174
nodeId = nodes[1].id

src/services/Serialization.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ function packFactor(dfg::G, f::DFGFactor)::Dict{String, Any} where G <: Abstract
9898
props["timestamp"] = string(f.timestamp)
9999
props["tags"] = JSON2.write(f.tags)
100100
# Pack the node data
101-
fnctype = f.data.fnc.usrfnc!
101+
fnctype = getSolverData(f).fnc.usrfnc!
102102
try
103103
packtype = getfield(_getmodule(fnctype), Symbol("Packed$(_getname(fnctype))"))
104-
packed = convert(PackedFunctionNodeData{packtype}, f.data)
104+
packed = convert(PackedFunctionNodeData{packtype}, getSolverData(f))
105105
props["data"] = JSON2.write(packed)
106106
catch ex
107107
io = IOBuffer()
@@ -149,7 +149,8 @@ function unpackFactor(dfg::G, packedProps::Dict{String, Any})::DFGFactor where G
149149
factor = DFGFactor{typeof(fullFactor.fnc), Symbol}(Symbol(label), 0, timestamp)
150150

151151
union!(factor.tags, tags)
152-
factor.data = fullFactor #TODO setSolverData!(factor, fullFactor)
152+
# factor.data = fullFactor #TODO
153+
setSolverData!(factor, fullFactor)
153154
factor._variableOrderSymbols = _variableOrderSymbols
154155
setSolvable!(factor, solvable)
155156

0 commit comments

Comments
 (0)