Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/src/DataStructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Accessible properties for each of the variable structures:
|---------------------|-------|-----------|------|-----------|-----------|----------|-------------|----------|--------------|
| VariableSkeleton | X | | X | | | | | | |
| VariableSummary | X | X | X | X | Symbol | | | | X |
| VariableCompute | X | X | X | X | X | X | X | X | X |
| VariableDFG | X | X | X | X | X | X | X | X | X |

Accessible properties for each of the factor structures:

Expand Down
4 changes: 2 additions & 2 deletions docs/src/GraphData.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,6 @@ Agent and Graph bloblets are useful for storing data that is related to the enti
Example of using graph-level data:

```julia
setAgentMetadata!(dfg, Dict(:a => "Hello"))
getAgentMetadata(dfg)
addAgentBloblet!(dfg, Bloblet(:status, "ready"))
getAgentBloblet(dfg, :status)
```
17 changes: 0 additions & 17 deletions src/DataBlobs/entities/BlobEntry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,6 @@ function Base.getproperty(x::Blobentry, f::Symbol)
end
end

function Base.setproperty!(x::Blobentry, f::Symbol, val)
if f == :blobId
@warn "Blobentry field :blobId has been renamed to :blobid"
setfield!(x, :blobid, val)
elseif f == :mimeType
@warn "Blobentry field :mimeType has been renamed to :mimetype"
setfield!(x, :mimetype, val)
elseif f == :_version
@warn "Blobentry field :_version has been renamed to :version"
setfield!(x, :version, val)
elseif f in [:id, :createdTimestamp, :lastUpdatedTimestamp, :hash]
error("Blobentry field $f has been deprecated")
else
setfield!(x, f, val)
end
end

const Blobentries = OrderedDict{Symbol, Blobentry}

function StructUtils.lower(entries::Blobentries)
Expand Down
75 changes: 54 additions & 21 deletions src/DataBlobs/services/BlobEntry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ end
function getBlobentries(
node;
labelFilter::Union{Nothing, Function} = nothing,
blobIdFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
)
entries = collect(values(refBlobentries(node)))
filterDFG!(entries, labelFilter, getLabel)
filterDFG!(entries, blobIdFilter, x -> string(x.blobid))
filterDFG!(entries, blobidFilter, x -> string(x.blobid))
return entries
end

Expand Down Expand Up @@ -195,6 +195,52 @@ function listModelBlobentries end
function hasGraphBlobentry end
function hasAgentBlobentry end
function hasModelBlobentry end

##==============================================================================
## Default Variable/Factor implementations
##==============================================================================

function getVariableBlobentry(dfg::AbstractDFG, variableLabel::Symbol, label::Symbol)
return getBlobentry(getVariable(dfg, variableLabel), label)
end

function getVariableBlobentries(
dfg::AbstractDFG,
variableLabel::Symbol;
labelFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
)
return getBlobentries(getVariable(dfg, variableLabel); labelFilter, blobidFilter)
end

function listVariableBlobentries(dfg::AbstractDFG, variableLabel::Symbol)
return listBlobentries(getVariable(dfg, variableLabel))
end

function hasVariableBlobentry(dfg::AbstractDFG, variableLabel::Symbol, label::Symbol)
return hasBlobentry(getVariable(dfg, variableLabel), label)
end

function getFactorBlobentry(dfg::AbstractDFG, factorLabel::Symbol, label::Symbol)
return getBlobentry(getFactor(dfg, factorLabel), label)
end

function getFactorBlobentries(
dfg::AbstractDFG,
factorLabel::Symbol;
labelFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
)
return getBlobentries(getFactor(dfg, factorLabel); labelFilter, blobidFilter)
end

function listFactorBlobentries(dfg::AbstractDFG, factorLabel::Symbol)
return listBlobentries(getFactor(dfg, factorLabel))
end

function hasFactorBlobentry(dfg::AbstractDFG, factorLabel::Symbol, label::Symbol)
return hasBlobentry(getFactor(dfg, factorLabel), label)
end
##==============================================================================
## Blobentry [default] bulk operations
##==============================================================================
Expand Down Expand Up @@ -280,19 +326,10 @@ end
## Blobentry - Helper functions, Lists, etc
##==============================================================================

function getVariableBlobentries(
dfg::AbstractDFG,
variableLabel::Symbol;
labelFilter::Union{Nothing, Function} = nothing,
blobIdFilter::Union{Nothing, Function} = nothing,
)
return getBlobentries(getVariable(dfg, variableLabel); labelFilter, blobIdFilter)
end

function gatherBlobentries(
dfg::AbstractDFG;
labelFilter::Union{Nothing, Function} = nothing,
blobIdFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
solvableFilter::Union{Nothing, Function} = nothing,
tagsFilter::Union{Nothing, Function} = nothing,
typeFilter::Union{Nothing, Function} = nothing,
Expand All @@ -306,15 +343,11 @@ function gatherBlobentries(
labelFilter = variableLabelFilter,
)
return map(vls) do vl
return vl => getVariableBlobentries(dfg, vl; labelFilter, blobIdFilter)
return vl => getVariableBlobentries(dfg, vl; labelFilter, blobidFilter)
end
end
const collectBlobentries = gatherBlobentries

function listVariableBlobentries(dfg::AbstractDFG, label::Symbol)
return listBlobentries(getVariable(dfg, label))
end

"""
$(SIGNATURES)
Finds and returns the first blob entry that matches the filter.
Expand All @@ -324,11 +357,11 @@ Also see: [`getBlobentry`](@ref)
function getfirstBlobentry(
node;
labelFilter::Union{Nothing, Function} = nothing,
blobIdFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
sortby::Function = getLabel,
sortlt::Function = natural_lt,
)
entries = getBlobentries(node; labelFilter, blobIdFilter)
entries = getBlobentries(node; labelFilter, blobidFilter)
if isempty(entries)
return nothing
else
Expand All @@ -340,9 +373,9 @@ function getfirstVariableBlobentry(
dfg::AbstractDFG,
label::Symbol;
labelFilter::Union{Nothing, Function} = nothing,
blobIdFilter::Union{Nothing, Function} = nothing,
blobidFilter::Union{Nothing, Function} = nothing,
)
return getfirstBlobentry(getVariable(dfg, label); labelFilter, blobIdFilter)
return getfirstBlobentry(getVariable(dfg, label); labelFilter, blobidFilter)
end

## =============================================================================
Expand Down
20 changes: 13 additions & 7 deletions src/Deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ end
# isSolvable
# """
function getSolveInProgress(
var::Union{VariableCompute, FactorCompute},
var::Union{VariableDFG, FactorCompute},
solveKey::Symbol = :default,
)
# Variable
if var isa VariableCompute
if var isa VariableDFG
if haskey(refStates(var), solveKey)
return refStates(var)[solveKey].solveInProgress
else
Expand All @@ -76,7 +76,7 @@ end
#TODO missing set solveInProgress and graph level accessor

function isSolveInProgress(
node::Union{VariableCompute, FactorCompute},
node::Union{VariableDFG, FactorCompute},
solvekey::Symbol = :default,
)
return getSolveInProgress(node, solvekey) > 0
Expand Down Expand Up @@ -321,6 +321,12 @@ function updateBlob!(args...)
return error("updateBlob! is obsolete as blobid=>Blob pairs are immutable.")
end

function setTags!(node, tags::Union{Vector{Symbol}, Set{Symbol}})
Base.depwarn("setTags! is deprecated, use mergeTags! or addTags! instead.", :setTags!)
node.tags !== tags && empty!(node.tags)
return union!(node.tags, tags)
end

## ================================================================================
## Deprecated in v0.28
##=================================================================================
Expand Down Expand Up @@ -629,18 +635,18 @@ end

function getfirstBlobentry(var::AbstractGraphVariable, blobId::UUID)
Base.depwarn(
"getfirstBlobentry(var, blobId) is deprecated, use getfirstBlobentry(var; blobIdFilter = ==(string(blobId))) instead.",
"getfirstBlobentry(var, blobId) is deprecated, use getfirstBlobentry(var; blobidFilter = ==(string(blobId))) instead.",
:getfirstBlobentry,
)
return getfirstBlobentry(var; blobIdFilter = ==(string(blobId)))
return getfirstBlobentry(var; blobidFilter = ==(string(blobId)))
end

function getfirstBlobentry(dfg::AbstractDFG, label::Symbol, blobId::UUID)
Base.depwarn(
"getfirstBlobentry(dfg, label, blobId) is deprecated, use getfirstBlobentry(dfg, label; blobIdFilter = ==(string(blobId))) instead.",
"getfirstBlobentry(dfg, label, blobId) is deprecated, use getfirstBlobentry(dfg, label; blobidFilter = ==(string(blobId))) instead.",
:getfirstBlobentry,
)
return getfirstBlobentry(dfg, label; blobIdFilter = ==(string(blobId)))
return getfirstBlobentry(dfg, label; blobidFilter = ==(string(blobId)))
end

function getfirstBlobentry(var::AbstractGraphVariable, key::Regex)
Expand Down
Loading
Loading