Skip to content

Commit 9f46ce3

Browse files
committed
Cloud Tags SET Functions and tests
1 parent 8c061ef commit 9f46ce3

File tree

2 files changed

+62
-3
lines changed

2 files changed

+62
-3
lines changed

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,65 @@ end
714714
## TAGS as a set, list, merge, remove, empty
715715
## CloudGraphsDFG functions
716716
##==============================================================================
717+
function mergeTags!(dfg::CloudGraphsDFG, sym::Symbol, tags::Vector{Symbol})
718+
719+
if isVariable(dfg,sym)
720+
getNode = getVariable
721+
updateNode! = updateVariable!
722+
else
723+
getNode = getFactor
724+
updateNode! = updateFactor!
725+
end
726+
727+
node = getNode(dfg, sym)
728+
union!(getTags(node), tags)
729+
730+
updateNode!(dfg, node)
731+
732+
return getTags(getNode(dfg, sym))
733+
734+
end
735+
736+
function removeTags!(dfg::CloudGraphsDFG, sym::Symbol, tags::Vector{Symbol})
737+
738+
if isVariable(dfg,sym)
739+
getNode = getVariable
740+
updateNode! = updateVariable!
741+
else
742+
getNode = getFactor
743+
updateNode! = updateFactor!
744+
end
745+
746+
node = getNode(dfg, sym)
747+
setdiff!(getTags(node), tags)
748+
749+
updateNode!(dfg, node)
750+
751+
return getTags(getNode(dfg, sym))
752+
753+
end
754+
755+
function emptyTags!(dfg::CloudGraphsDFG, sym::Symbol)
756+
757+
if isVariable(dfg,sym)
758+
getNode = getVariable
759+
updateNode! = updateVariable!
760+
else
761+
getNode = getFactor
762+
updateNode! = updateFactor!
763+
end
764+
765+
node = getNode(dfg, sym)
766+
empty!(getTags(node))
767+
768+
updateNode!(dfg, node)
769+
770+
return getTags(getNode(dfg, sym))
771+
772+
end
773+
774+
775+
717776
function RESERVED_mergeTags!(dfg::CloudGraphsDFG, sym::Symbol, tags::Vector{Symbol})
718777

719778
nodeId = _tryGetNeoNodeIdFromNodeLabel(dfg.neo4jInstance,

test/consolInterfaceDev.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ fac2 = addFactor!(newfg, [:b, :c], LinearConditional(Normal()))
106106
VariablesandFactorsCRUD_SET!(fg1, var1, var2, var3, fac0, fac1, fac2)
107107
end
108108

109-
# @testset "tags" begin
110-
# tagsTestBlock!(fg1, var1, v1_tags)
111-
# end
109+
@testset "tags" begin
110+
tagsTestBlock!(fg1, var1, v1_tags)
111+
end
112112
#
113113
#
114114
# fg = fg1

0 commit comments

Comments
 (0)