Skip to content

Commit c956be5

Browse files
authored
CloudGraphs DFG Updates (#517)
* WIP on breaking out solver data * WIP on SolverData separation * PPEs and SolverData serialization is working * VariableNodeData as node properties * Estimates are now written in with additional cartesian values * WIP, may have broken a few things with DFGVariable * Working on addVariable * AddVariable/getVariable/updateVariable * Drastic speedup of getFactor etc. Cleanup of API for getSolverData * Working on addFactor/getFactor * Factor serialization/deserialization with properties! * Removing shows * Adding :FACTORGRAPH relationships to factors in a single query; cleanup * Fixing addPPE/updatePPE * Fix for projecting cartesian PPEs * Small fixes and optimization for getSofttype * Minor fix * Cleaning up cleanup functions * Fixing unit tests, refactoring API * Working through unit tests * Fixing getSofttype and associated tests * Fix for ls, fix for unit tests, fix for passing transaction to _getNodeProperty * Fixing tests and reintroducing warnings * Fixing Z-timestamp conversion * Slightly cleaner getSofttype
1 parent c11b9e2 commit c956be5

13 files changed

+825
-582
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1818
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1919
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
2020
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
21-
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
2221
Unmarshal = "cbff2730-442d-58d7-89d1-8e530c41eb02"
22+
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
2323

2424
[compat]
2525
Colors = "0.8, 0.9, 0.10, 0.11, 0.12"

src/CloudGraphsDFG/CloudGraphsDFG.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import ...DistributedFactorGraphs: setSolverParams!,
2020
exists,
2121
isVariable,
2222
isFactor,
23+
getSofttype,
2324
getDescription,
2425
updateVariable!,
2526
updateFactor!,
@@ -59,6 +60,7 @@ import ...DistributedFactorGraphs: setSolverParams!,
5960
mergeTags!,
6061
removeTags!,
6162
emptyTags!,
63+
listVariableSolverData,
6264
addVariableSolverData!,
6365
updateVariableSolverData!,
6466
deleteVariableSolverData!,
@@ -69,17 +71,19 @@ import ...DistributedFactorGraphs: setSolverParams!,
6971
listPPEs,
7072
deletePPE!,
7173
updatePPE!,
72-
packPPE,
73-
unpackPPE,
7474
getSolvable,
75-
setSolvable!
75+
setSolvable!,
76+
getEstimateFields,
77+
_getname,
78+
_getmodule,
79+
getTypeFromSerializationModule
7680

7781
using Neo4j
7882
using Base64
7983

8084
using DocStringExtensions
8185
using Requires
82-
using Dates
86+
using Dates, TimeZones
8387
using Distributions
8488
using Reexport
8589
using JSON

src/CloudGraphsDFG/services/CGStructure.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ function createUser(dfg::CloudGraphsDFG, user::User)::User
5858
!isValidLabel(user) && error("Node cannot have an ID '$(user.id)'.")
5959

6060
props = _convertNodeToDict(user)
61+
# TODO: Switch to _queryNeo4j
6162
retNode = _createNode(dfg.neo4jInstance, ["USER", String(user.id)], props, nothing)
6263
return user
6364
end
@@ -77,6 +78,7 @@ function createRobot(dfg::CloudGraphsDFG, robot::Robot)::Robot
7778
error("Robot '$(robot.id)' already exists for user '$(robot.userId)'")
7879

7980
props = _convertNodeToDict(robot)
81+
# TODO: Switch to _queryNeo4j
8082
retNode = _createNode(dfg.neo4jInstance, ["ROBOT", String(robot.userId), String(robot.id)], props, parents[1], :ROBOT)
8183
return robot
8284
end
@@ -96,6 +98,7 @@ function createSession(dfg::CloudGraphsDFG, session::Session)::Session
9698
error("Session '$(session.id)' already exists for robot '$(session.robotId)' and user '$(session.userId)'")
9799

98100
props = _convertNodeToDict(session)
101+
# TODO: Switch to _queryNeo4j
99102
retNode = _createNode(dfg.neo4jInstance, ["SESSION", String(session.userId), String(session.robotId), String(session.id)], props, parents[1], :SESSION)
100103
return session
101104
end
@@ -227,7 +230,7 @@ DANGER: Clears the whole session from the database.
227230
"""
228231
function clearSession!!(dfg::CloudGraphsDFG)::Nothing
229232
# Perform detach+deletion
230-
_getNeoNodesFromCyphonQuery(dfg.neo4jInstance, "(node:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId)) detach delete node ")
233+
_queryNeo4j(dfg.neo4jInstance, "match (node:$(dfg.userId):$(dfg.robotId):$(dfg.sessionId)) detach delete node ")
231234

232235
# Clearing history
233236
dfg.addHistory = Symbol[]
@@ -240,7 +243,7 @@ DANGER: Clears the whole robot + sessions from the database.
240243
"""
241244
function clearRobot!!(dfg::CloudGraphsDFG)::Nothing
242245
# Perform detach+deletion
243-
_getNeoNodesFromCyphonQuery(dfg.neo4jInstance, "(node:$(dfg.userId):$(dfg.robotId)) detach delete node ")
246+
_queryNeo4j(dfg.neo4jInstance, "match (node:$(dfg.userId):$(dfg.robotId)) detach delete node ")
244247

245248
# Clearing history
246249
dfg.addHistory = Symbol[]
@@ -253,7 +256,7 @@ DANGER: Clears the whole user + robot + sessions from the database.
253256
"""
254257
function clearUser!!(dfg::CloudGraphsDFG)::Nothing
255258
# Perform detach+deletion
256-
_getNeoNodesFromCyphonQuery(dfg.neo4jInstance, "(node:$(dfg.userId)) detach delete node ")
259+
_queryNeo4j(dfg.neo4jInstance, "match (node:$(dfg.userId)) detach delete node ")
257260

258261
# Clearing history
259262
dfg.addHistory = Symbol[]

0 commit comments

Comments
 (0)