Skip to content

Commit b11976f

Browse files
committed
Merge branch 'master' of https://github.com/JuliaRobotics/DistributedFactorGraphs.jl into 3Q20/542/saving_serialized_version
2 parents 8ef829d + ff56034 commit b11976f

22 files changed

+435
-381
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "DistributedFactorGraphs"
22
uuid = "b5cc3c7e-6572-11e9-2517-99fb8daf2f04"
3-
version = "0.9.0"
3+
version = "0.10.0"
44

55
[deps]
66
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

test/DataStoreTests.jl renamed to attic/DataStoreTests.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,3 @@ sleep(0.1)
7979
#TODO
8080
#listStoreEntries(ds)
8181
end
82-
83-
1320*4
84-
85-
3600+2200

attic/InMemoryDataStore.jl

Lines changed: 0 additions & 61 deletions
This file was deleted.

docs/src/func_ref.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,16 @@ Modules = [CloudGraphsDFGs]
133133

134134

135135

136-
## Big Data
136+
## Data Entries and Blobs
137137

138138
```@autodocs
139139
Modules = [DistributedFactorGraphs]
140140
141-
Pages = ["entities/AbstractBigDataEntries.jl",
142-
"entities/AbstractDataStore.jl",
143-
"entities/FileDataStore.jl",
144-
"entities/InMemoryDataStore.jl",
145-
"services/AbstractBigDataEntries.jl",
146-
"services/AbstractDataStore.jl",
147-
"services/FileDataStore.jl",
148-
"services/InMemoryDataStore.jl"]
141+
Pages = ["entities/AbstractDataEntries.jl",
142+
"services/AbstractDataEntries.jl",
143+
"services/BlobStores.jl",
144+
"services/DataEntryBlob.jl",
145+
"services/FileDataEntryBlob.jl",
146+
"services/InMemoryDataEntryBlob.jl"]
149147
150148
```

src/CloudGraphsDFG/services/CloudGraphsDFG.jl

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ isFactor(dfg::CloudGraphsDFG, sym::Symbol)::Bool =
155155
function getSofttype(dfg::CloudGraphsDFG, lbl::Symbol; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)
156156
st = _getNodeProperty(dfg.neo4jInstance, union(_getLabelsForType(dfg, DFGVariable), [String(lbl)]), "softtype", currentTransaction=currentTransaction)
157157
@debug "Trying to find softtype: $st"
158-
softType = getTypeFromSerializationModule(dfg, Symbol(st))
158+
softType = getTypeFromSerializationModule(st)
159159
return softType()
160160
end
161161

@@ -177,8 +177,12 @@ function updateVariable!(dfg::CloudGraphsDFG, variable::DFGVariable; skipAddErro
177177
# Create/update the base variable
178178
# NOTE: We are not merging the variable.tags into the labels anymore. We can index by that but not
179179
# going to pollute the graph with unnecessary (and potentially dangerous) labels.
180+
<<<<<<< HEAD
180181
addProps = Dict(
181182
"softtype" => "\"$(string(typeof(getSofttype(variable))))\"")
183+
=======
184+
addProps = Dict("softtype" => "\"$(DistributedFactorGraphs.typeModuleName(getSofttype(variable)))\"")
185+
>>>>>>> ff56034195104ff1cd5cdee9b10f7d271eb1d5f8
182186
query = """
183187
MATCH (session:$(join(_getLabelsForType(dfg, Session), ":")))
184188
MERGE (node:$(join(_getLabelsForInst(dfg, variable), ":")))
@@ -237,12 +241,12 @@ function getVariable(dfg::CloudGraphsDFG, label::Union{Symbol, String})
237241
for ppe in listPPEs(dfg, label)
238242
variable.ppeDict[ppe] = getPPE(dfg, label, ppe)
239243
end
240-
for solverKey in listVariableSolverData(dfg, label)
241-
variable.solverDataDict[solverKey] = getVariableSolverData(dfg, label, solverKey)
244+
for solveKey in listVariableSolverData(dfg, label)
245+
variable.solverDataDict[solveKey] = getVariableSolverData(dfg, label, solveKey)
242246
end
243-
dataDict = getDataEntries(dfg, label)
244-
for (k,v) in dataDict
245-
variable.dataDict[k] = v
247+
dataSet = getDataEntries(dfg, label)
248+
for v in dataSet
249+
variable.dataDict[v.label] = v
246250
end
247251

248252
return variable
@@ -259,7 +263,7 @@ function mergeVariableData!(dfg::CloudGraphsDFG, sourceVariable::DFGVariable; cu
259263
updateVariableSolverData!(dfg, getLabel(sourceVariable), v, currentTransaction=currentTransaction)
260264
end
261265
for (k,v) in sourceVariable.dataDict
262-
updateDatEntry!(dfg, getLabel(sourceVariable), v, currentTransaction=currentTransaction)
266+
updateDataEntry!(dfg, getLabel(sourceVariable), v, currentTransaction=currentTransaction)
263267
end
264268
return sourceVariable
265269
end
@@ -545,7 +549,7 @@ function _unpackPPE(dfg::G, packedPPE::Dict{String, Any})::AbstractPointParametr
545549
end
546550

547551
function listPPEs(dfg::CloudGraphsDFG, variablekey::Symbol; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::Vector{Symbol}
548-
return _listVarSubnodesForType(dfg, variablekey, MeanMaxPPE, "solverKey"; currentTransaction=currentTransaction)
552+
return _listVarSubnodesForType(dfg, variablekey, MeanMaxPPE, "solveKey"; currentTransaction=currentTransaction)
549553
end
550554

551555
function getPPE(dfg::CloudGraphsDFG, variablekey::Symbol, ppekey::Symbol=:default; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::AbstractPointParametricEst
@@ -580,8 +584,8 @@ function addPPE!(dfg::CloudGraphsDFG,
580584
ppe::P;
581585
currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::AbstractPointParametricEst where
582586
{P <: AbstractPointParametricEst}
583-
if ppe.solverKey in listPPEs(dfg, variablekey, currentTransaction=currentTransaction)
584-
error("PPE '$(ppe.solverKey)' already exists")
587+
if ppe.solveKey in listPPEs(dfg, variablekey, currentTransaction=currentTransaction)
588+
error("PPE '$(ppe.solveKey)' already exists")
585589
end
586590
softType = getSofttype(dfg, variablekey)
587591
# Add additional properties for the PPE
@@ -602,8 +606,8 @@ function updatePPE!(
602606
ppe::P;
603607
currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::P where
604608
{P <: AbstractPointParametricEst}
605-
if !(ppe.solverKey in listPPEs(dfg, variablekey, currentTransaction=currentTransaction))
606-
@warn "PPE '$(ppe.solverKey)' does not exist, adding"
609+
if !(ppe.solveKey in listPPEs(dfg, variablekey, currentTransaction=currentTransaction))
610+
@warn "PPE '$(ppe.solveKey)' does not exist, adding"
607611
end
608612
softType = getSofttype(dfg, variablekey, currentTransaction=currentTransaction)
609613
# Add additional properties for the PPE
@@ -645,11 +649,9 @@ end
645649
function getDataEntries(dfg::CloudGraphsDFG, label::Symbol; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)
646650
entries = Dict{Symbol, BlobStoreEntry}()
647651
# TODO: Optimize if necessary.
648-
for key in listDataEntries(dfg, label, currentTransaction=currentTransaction)
649-
entry = getDataEntry(dfg, label, key, currentTransaction=currentTransaction)
650-
entries[entry.label] = entry
651-
end
652-
return entries
652+
delist = listDataEntries(dfg, label, currentTransaction=currentTransaction)
653+
return getDataEntry.(dfg, label, delist; currentTransaction=currentTransaction)
654+
653655
end
654656

655657
function listDataEntries(dfg::CloudGraphsDFG, label::Symbol; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)
@@ -667,6 +669,10 @@ function getDataEntry(dfg::CloudGraphsDFG, label::Symbol, key::Symbol; currentTr
667669
BlobStoreEntry,
668670
key;
669671
currentTransaction=currentTransaction)
672+
673+
#FIXME
674+
properties["createdTimestamp"] = DistributedFactorGraphs.getStandardZDTString(properties["createdTimestamp"])
675+
670676
return Unmarshal.unmarshal(
671677
BlobStoreEntry,
672678
properties)
@@ -683,6 +689,10 @@ function addDataEntry!(dfg::CloudGraphsDFG, label::Symbol, bde::BlobStoreEntry;
683689
bde,
684690
:DATA,
685691
currentTransaction=currentTransaction)
692+
693+
#FIXME
694+
packed["createdTimestamp"] = DistributedFactorGraphs.getStandardZDTString(packed["createdTimestamp"])
695+
686696
return Unmarshal.unmarshal(
687697
BlobStoreEntry,
688698
packed)
@@ -699,6 +709,10 @@ function updateDataEntry!(dfg::CloudGraphsDFG, label::Symbol, bde::BlobStoreEnt
699709
bde,
700710
:DATA,
701711
currentTransaction=currentTransaction)
712+
713+
#FIXME
714+
packed["createdTimestamp"] = DistributedFactorGraphs.getStandardZDTString(packed["createdTimestamp"])
715+
702716
return Unmarshal.unmarshal(
703717
BlobStoreEntry,
704718
packed)
@@ -712,6 +726,10 @@ function deleteDataEntry!(dfg::CloudGraphsDFG, label::Symbol, key::Symbol; curre
712726
_getLabelsForType(dfg, BlobStoreEntry, parentKey=label),
713727
key,
714728
currentTransaction=currentTransaction)
729+
730+
#FIXME
731+
props["createdTimestamp"] = DistributedFactorGraphs.getStandardZDTString(props["createdTimestamp"])
732+
715733
return Unmarshal.unmarshal(
716734
BlobStoreEntry,
717735
props)
@@ -729,20 +747,20 @@ function _unpackVariableNodeData(dfg::G, packedDict::Dict{String, Any})::Variabl
729747
end
730748

731749
function listVariableSolverData(dfg::CloudGraphsDFG, variablekey::Symbol; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::Vector{Symbol}
732-
return _listVarSubnodesForType(dfg, variablekey, VariableNodeData, "solverKey"; currentTransaction=currentTransaction)
750+
return _listVarSubnodesForType(dfg, variablekey, VariableNodeData, "solveKey"; currentTransaction=currentTransaction)
733751
end
734752

735-
function getVariableSolverData(dfg::CloudGraphsDFG, variablekey::Symbol, solverKey::Symbol=:default; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
736-
properties = _getVarSubnodeProperties(dfg, variablekey, VariableNodeData, solverKey; currentTransaction=currentTransaction)
753+
function getVariableSolverData(dfg::CloudGraphsDFG, variablekey::Symbol, solveKey::Symbol=:default; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
754+
properties = _getVarSubnodeProperties(dfg, variablekey, VariableNodeData, solveKey; currentTransaction=currentTransaction)
737755
return _unpackVariableNodeData(dfg, properties)
738756
end
739757

740758
function addVariableSolverData!(dfg::CloudGraphsDFG,
741759
variablekey::Symbol,
742760
vnd::VariableNodeData;
743761
currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
744-
if vnd.solverKey in listVariableSolverData(dfg, variablekey, currentTransaction=currentTransaction)
745-
error("Solver data '$(vnd.solverKey)' already exists")
762+
if vnd.solveKey in listVariableSolverData(dfg, variablekey, currentTransaction=currentTransaction)
763+
error("Solver data '$(vnd.solveKey)' already exists")
746764
end
747765
retPacked = _matchmergeVariableSubnode!(
748766
dfg,
@@ -760,8 +778,8 @@ function updateVariableSolverData!(dfg::CloudGraphsDFG,
760778
useCopy::Bool=true,
761779
fields::Vector{Symbol}=Symbol[];
762780
currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
763-
if !(vnd.solverKey in listVariableSolverData(dfg, variablekey, currentTransaction=currentTransaction))
764-
@warn "Solver data '$(vnd.solverKey)' does not exist, adding rather than updating."
781+
if !(vnd.solveKey in listVariableSolverData(dfg, variablekey, currentTransaction=currentTransaction))
782+
@warn "Solver data '$(vnd.solveKey)' does not exist, adding rather than updating."
765783
end
766784
# TODO: Update this to use the selective parameters from fields.
767785
retPacked = _matchmergeVariableSubnode!(
@@ -774,13 +792,13 @@ function updateVariableSolverData!(dfg::CloudGraphsDFG,
774792
return _unpackVariableNodeData(dfg, retPacked)
775793
end
776794

777-
function deleteVariableSolverData!(dfg::CloudGraphsDFG, variablekey::Symbol, solverKey::Symbol=:default; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
795+
function deleteVariableSolverData!(dfg::CloudGraphsDFG, variablekey::Symbol, solveKey::Symbol=:default; currentTransaction::Union{Nothing, Neo4j.Transaction}=nothing)::VariableNodeData
778796
retPacked = _deleteVarSubnode!(
779797
dfg,
780798
variablekey,
781799
:SOLVERDATA,
782800
_getLabelsForType(dfg, VariableNodeData, parentKey=variablekey),
783-
solverKey,
801+
solveKey,
784802
currentTransaction=currentTransaction)
785803
return _unpackVariableNodeData(dfg, retPacked)
786804
end
@@ -841,12 +859,12 @@ function updateVariableSolverData!(dfg::CloudGraphsDFG,
841859
end
842860

843861
function mergeVariableSolverData!(dfg::CloudGraphsDFG, sourceVariable::DFGVariable)
844-
for solverKey in listVariableSolverData(dfg, sourceVariable.label)
862+
for solveKey in listVariableSolverData(dfg, sourceVariable.label)
845863
updateVariableSolverData!(
846864
dfg,
847865
sourceVariable.label,
848-
getVariableSolverData(dfg, sourceVariable, solverKey),
849-
solverKey)
866+
getVariableSolverData(dfg, sourceVariable, solveKey),
867+
solveKey)
850868
end
851869
end
852870

src/CloudGraphsDFG/services/CommonFunctions.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ function _structToNeo4jProps(inst::Union{User, Robot, Session, PVND, N, APPE, AB
146146
# Neo4j type conversion if possible - keep timestamps timestamps, etc.
147147
if field isa ZonedDateTime
148148
val = "datetime(\"$(string(field))\")"
149+
# val = "datetime(\"$(Dates.format(field, "yyyy-mm-ddTHH:MM:SS.ssszzz"))\")"
149150
end
150151
if field isa UUID
151152
val = "\"$(string(field))\""
@@ -167,7 +168,7 @@ function _structToNeo4jProps(inst::Union{User, Robot, Session, PVND, N, APPE, AB
167168
val = field.value
168169
end
169170
if fieldname == :softtype
170-
val = string(typeof(getSofttype(inst)))
171+
val = DistributedFactorGraphs.typeModuleName(getSofttype(inst))
171172
end
172173
# Factors
173174
# TODO: Consolidate with packFactor in Serialization.jl - https://github.com/JuliaRobotics/DistributedFactorGraphs.jl/issues/525
@@ -250,8 +251,8 @@ function _getLabelsForInst(dfg::CloudGraphsDFG,
250251
labels = _getLabelsForType(dfg, typeof(inst), parentKey=parentKey)
251252
typeof(inst) <: DFGVariable && push!(labels, String(getLabel(inst)))
252253
typeof(inst) <: DFGFactor && push!(labels, String(getLabel(inst)))
253-
typeof(inst) <: AbstractPointParametricEst && push!(labels, String(inst.solverKey))
254-
typeof(inst) <: VariableNodeData && push!(labels, String(inst.solverKey))
254+
typeof(inst) <: AbstractPointParametricEst && push!(labels, String(inst.solveKey))
255+
typeof(inst) <: VariableNodeData && push!(labels, String(inst.solveKey))
255256
typeof(inst) <: AbstractDataEntry && push!(labels, String(inst.label))
256257
return labels
257258
end
@@ -317,8 +318,8 @@ function _matchmergeVariableSubnode!(
317318
result = commit(tx)
318319
end
319320
length(result.errors) > 0 && error(string(result.errors))
320-
length(result.results[1]["data"]) != 1 && error("Cannot find subnode '$(ppe.solverKey)' for variable '$variablekey'")
321-
length(result.results[1]["data"][1]["row"]) != 1 && error("Cannot find subnode '$(ppe.solverKey)' for variable '$variablekey'")
321+
length(result.results[1]["data"]) != 1 && error("Cannot find subnode '$(ppe.solveKey)' for variable '$variablekey'")
322+
length(result.results[1]["data"][1]["row"]) != 1 && error("Cannot find subnode '$(ppe.solveKey)' for variable '$variablekey'")
322323
return result.results[1]["data"][1]["row"][1]
323324
end
324325

src/DataBlobs/DataBlobs.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ include("services/InMemoryDataEntryBlob.jl")
1515

1616

1717
export AbstractDataEntry, GeneralDataEntry, MongodbDataEntry, FileDataEntry
18-
export InMemoryDataStore, FileDataStore
1918

2019
export getData, addData!, updateData!, deleteData!, listStoreEntries
2120
export getDataBlob, addDataBlob!, updateDataBlob!, deleteDataBlob!, listDataBlobs

0 commit comments

Comments
 (0)