360360# Alias
361361deleteVariable! (dfg:: CloudGraphsDFG , variable:: DFGVariable ) = deleteVariable! (dfg, variable. label)
362362
363- function deleteFactor! (dfg:: CloudGraphsDFG , label:: Symbol ):: DFGFactor
364- factor = getFactor (dfg, label)
365- if factor == nothing
363+ # return ::DFGFactor, or workaround ::Nothing, #809
364+ function deleteFactor! (dfg:: CloudGraphsDFG , label:: Symbol ; suppressGetFactor:: Bool = false )
365+ factor = suppressGetFactor ? nothing : getFactor (dfg, label)
366+ if factor === nothing && ! suppressGetFactor
366367 error (" Unable to retrieve the ID for factor '$label '. Please check your connection to the database and that the factor exists." )
367368 end
368369 # Perform detach+deletion
@@ -378,7 +379,7 @@ function deleteFactor!(dfg::CloudGraphsDFG, label::Symbol)::DFGFactor
378379end
379380
380381# Alias
381- deleteFactor! (dfg:: CloudGraphsDFG , factor:: DFGFactor ) :: DFGFactor = deleteFactor! (dfg, factor. label)
382+ deleteFactor! (dfg:: CloudGraphsDFG , factor:: DFGFactor ; suppressGetFactor :: Bool = false ) = deleteFactor! (dfg, factor. label, suppressGetFactor = suppressGetFactor )
382383
383384function getVariables (dfg:: CloudGraphsDFG , regexFilter:: Union{Nothing, Regex} = nothing ; tags:: Vector{Symbol} = Symbol[], solvable:: Int = 0 ):: Vector{DFGVariable}
384385 variableIds = listVariables (dfg, regexFilter, tags= tags, solvable= solvable)
@@ -980,4 +981,4 @@ function SkeletonDFG(cfg::CloudGraphsDFG)
980981 addVariable! .(sfg, _getSkeletonVariables (cfg))
981982 addFactor! .(sfg, _getSkeletonFactors (cfg))
982983 return sfg
983- end
984+ end
0 commit comments