Skip to content

Commit 0b182a2

Browse files
authored
Merge pull request #46 from JuliaRobotics/hotfix/v013
fix testing
2 parents ba79e8b + 6a692a2 commit 0b182a2

File tree

4 files changed

+61
-30
lines changed

4 files changed

+61
-30
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ Requires = "≥ 0.5"
2222
julia = "0.7, 1"
2323

2424
[extras]
25-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2625
IncrementalInference = "904591bb-b899-562f-9e6f-b8df64c7d480"
2726
RoME = "91fb55c2-4c03-5a59-ba21-f4ea956187b8"
27+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2828

2929
[targets]
3030
test = ["Test"]

src/CloudGraphsDFG/CloudGraphsDFG.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Neo4j
2-
using JSON2
32

43
# Entities
54
include("entities/CloudGraphsDFG.jl")

src/DistributedFactorGraphs.jl

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ using Requires
66
using Dates
77
using Distributions
88
using Reexport
9+
using JSON2
910

1011
# Entities
1112
include("entities/AbstractTypes.jl")
@@ -35,8 +36,39 @@ include("services/DFGVariable.jl")
3536

3637
# Include the Graphs.jl API.
3738
include("GraphsDFG/GraphsDFG.jl")
38-
# Include the Cloudgraphs API
39-
include("CloudGraphsDFG/CloudGraphsDFG.jl")
39+
40+
function __init__()
41+
@require DataFrames="a93c6f00-e57d-5684-b7b6-d8193f3e46c0" begin
42+
if isdefined(Main, :DataFrames)
43+
"""
44+
$(SIGNATURES)
45+
Get an adjacency matrix for the DFG as a DataFrame.
46+
Rows are all factors, columns are all variables, and each cell contains either nothing or the symbol of the relating factor.
47+
The first column is the factor headings.
48+
"""
49+
function getAdjacencyMatrixDataFrame(dfg::GraphsDFG)::Main.DataFrames.DataFrame
50+
varLabels = sort(map(v->v.label, getVariables(dfg)))
51+
factLabels = sort(map(f->f.label, getFactors(dfg)))
52+
adjDf = DataFrames.DataFrame(:Factor => Union{Missing, Symbol}[])
53+
for varLabel in varLabels
54+
adjDf[varLabel] = Union{Missing, Symbol}[]
55+
end
56+
for (i, factLabel) in enumerate(factLabels)
57+
push!(adjDf, [factLabel, DataFrames.missings(length(varLabels))...])
58+
factVars = getNeighbors(dfg, getFactor(dfg, factLabel))
59+
map(vLabel -> adjDf[vLabel][i] = factLabel, factVars)
60+
end
61+
return adjDf
62+
end
63+
end
64+
end
65+
66+
@require Neo4j="d2adbeaf-5838-5367-8a2f-e46d570981db" begin
67+
# Include the Cloudgraphs API
68+
include("CloudGraphsDFG/CloudGraphsDFG.jl")
69+
end
70+
end
71+
4072
# not sure where to put
4173
include("Common.jl")
4274
include("NeedsAHome.jl")

src/GraphsDFG/services/GraphsDFG.jl

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -502,29 +502,29 @@ function toDotFile(dfg::GraphsDFG, fileName::String="/tmp/dfg.dot")::Nothing
502502
return nothing
503503
end
504504

505-
function __init__()
506-
@require DataFrames="a93c6f00-e57d-5684-b7b6-d8193f3e46c0" begin
507-
if isdefined(Main, :DataFrames)
508-
"""
509-
$(SIGNATURES)
510-
Get an adjacency matrix for the DFG as a DataFrame.
511-
Rows are all factors, columns are all variables, and each cell contains either nothing or the symbol of the relating factor.
512-
The first column is the factor headings.
513-
"""
514-
function getAdjacencyMatrixDataFrame(dfg::GraphsDFG)::Main.DataFrames.DataFrame
515-
varLabels = sort(map(v->v.label, getVariables(dfg)))
516-
factLabels = sort(map(f->f.label, getFactors(dfg)))
517-
adjDf = DataFrames.DataFrame(:Factor => Union{Missing, Symbol}[])
518-
for varLabel in varLabels
519-
adjDf[varLabel] = Union{Missing, Symbol}[]
520-
end
521-
for (i, factLabel) in enumerate(factLabels)
522-
push!(adjDf, [factLabel, DataFrames.missings(length(varLabels))...])
523-
factVars = getNeighbors(dfg, getFactor(dfg, factLabel))
524-
map(vLabel -> adjDf[vLabel][i] = factLabel, factVars)
525-
end
526-
return adjDf
527-
end
528-
end
529-
end
530-
end
505+
# function __init__()
506+
# @require DataFrames="a93c6f00-e57d-5684-b7b6-d8193f3e46c0" begin
507+
# if isdefined(Main, :DataFrames)
508+
# """
509+
# $(SIGNATURES)
510+
# Get an adjacency matrix for the DFG as a DataFrame.
511+
# Rows are all factors, columns are all variables, and each cell contains either nothing or the symbol of the relating factor.
512+
# The first column is the factor headings.
513+
# """
514+
# function getAdjacencyMatrixDataFrame(dfg::GraphsDFG)::Main.DataFrames.DataFrame
515+
# varLabels = sort(map(v->v.label, getVariables(dfg)))
516+
# factLabels = sort(map(f->f.label, getFactors(dfg)))
517+
# adjDf = DataFrames.DataFrame(:Factor => Union{Missing, Symbol}[])
518+
# for varLabel in varLabels
519+
# adjDf[varLabel] = Union{Missing, Symbol}[]
520+
# end
521+
# for (i, factLabel) in enumerate(factLabels)
522+
# push!(adjDf, [factLabel, DataFrames.missings(length(varLabels))...])
523+
# factVars = getNeighbors(dfg, getFactor(dfg, factLabel))
524+
# map(vLabel -> adjDf[vLabel][i] = factLabel, factVars)
525+
# end
526+
# return adjDf
527+
# end
528+
# end
529+
# end
530+
# end

0 commit comments

Comments
 (0)