AlgebraicJulia / DataMigrations.jl

https://algebraicjulia.github.io/DataMigrations.jl/
MIT License
2 stars 0 forks source link

MethodError when migrating ACSets with AttrVar #159

Open aaguinal opened 4 months ago

aaguinal commented 4 months ago

The following MethodError is thrown when attempting to migrating an ACSet that contains AttrVar.

ERROR: MethodError: no method matching Catlab.CategoricalAlgebra.Sets.SetFunctionCallable(::var"#36#38", ::Catlab.CategoricalAlgebra.FinSets.FinSetInt, ::Catlab.CategoricalAlgebra.FinSets.VarSet{…})

Closest candidates are:
  Catlab.CategoricalAlgebra.Sets.SetFunctionCallable(::Any, ::Dom, ::Codom) where {T, T′, Dom<:SetOb{T}, Codom<:SetOb{T′}}
   @ Catlab ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/Sets.jl:69

Stacktrace:
  [1] (SetFunction{…} where {…})(f::Function, dom::Catlab.CategoricalAlgebra.FinSets.VarSet{…}, codom::Catlab.CategoricalAlgebra.FinSets.VarSet{…})
    @ Catlab.CategoricalAlgebra.FinSets ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FinSets.jl:227
  [2] compose(d::QueryDiagram{…}, F::Catlab.CategoricalAlgebra.CSets.ACSetFunctor{…}; kw::@Kwargs{})
    @ DataMigrations.Migrations ~/.julia/packages/DataMigrations/5xF1K/src/Migrations.jl:221
  [3] compose
    @ ~/.julia/packages/DataMigrations/5xF1K/src/Migrations.jl:209 [inlined]
  [4] (::DataMigrations.Migrations.var"#19#23"{…})(c::Catlab.Theories.FreeSchema.Ob{…})
    @ DataMigrations.Migrations ~/.julia/packages/DataMigrations/5xF1K/src/Migrations.jl:390
  [5] (::Catlab.CategoricalAlgebra.FinCats.var"#94#95"{…})(x::Catlab.Theories.FreeSchema.Ob{…})
    @ Catlab.CategoricalAlgebra.FinCats ./none:0
  [6] iterate
    @ ./generator.jl:47 [inlined]
  [7] _all(f::Base.var"#384#386", itr::Base.Generator{Vector{…}, Catlab.CategoricalAlgebra.FinCats.var"#94#95"{…}}, ::Colon)
    @ Base ./reduce.jl:1287
  [8] all
    @ ./reduce.jl:1283 [inlined]
  [9] Dict(kv::Base.Generator{Vector{…}, Catlab.CategoricalAlgebra.FinCats.var"#94#95"{…}})
    @ Base ./dict.jl:111
 [10] make_map(f::DataMigrations.Migrations.var"#19#23"{…}, xs::Vector{…}, ::Type{…})
    @ Catlab.CategoricalAlgebra.FinCats ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FinCats.jl:819
 [11] make_map
    @ ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FinCats.jl:797 [inlined]
 [12] migrate(X::Catlab.CategoricalAlgebra.CSets.ACSetFunctor{…}, M::DataMigration{…}; return_limits::Bool, tabular::Bool)
    @ DataMigrations.Migrations ~/.julia/packages/DataMigrations/5xF1K/src/Migrations.jl:374
 [13] migrate(X::Catlab.CategoricalAlgebra.CSets.ACSetFunctor{…}, M::DataMigration{…})
    @ DataMigrations.Migrations ~/.julia/packages/DataMigrations/5xF1K/src/Migrations.jl:367 [inlined]
 [14] #migrate#2
    @ ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FunctorialDataMigrations.jl:74 [inlined]
 [15] migrate
    @ ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FunctorialDataMigrations.jl:73 [inlined]
 [16] migrate(::Type{…}, X::WithLabel{…}, M::DataMigration{…}; kw::@Kwargs{})
    @ Catlab.CategoricalAlgebra.FunctorialDataMigrations ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FunctorialDataMigrations.jl:71
 [17] migrate(::Type{…}, X::WithLabel{…}, M::DataMigration{…})
    @ Catlab.CategoricalAlgebra.FunctorialDataMigrations ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FunctorialDataMigrations.jl:70
 [18] top-level scope
    @ ~/Documents/Git/ieee-tase24-skilltransfer/PlanningDomainMigrations/src/sandbox.jl:380

caused by: MethodError: no method matching Catlab.CategoricalAlgebra.Sets.SetFunctionCallable(::var"#36#38", ::Catlab.CategoricalAlgebra.FinSets.FinSetInt, ::Catlab.CategoricalAlgebra.FinSets.VarSet{…})

Closest candidates are:
  Catlab.CategoricalAlgebra.Sets.SetFunctionCallable(::Any, ::Dom, ::Codom) where {T, T′, Dom<:SetOb{T}, Codom<:SetOb{T′}}
   @ Catlab ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/Sets.jl:69

Stacktrace:
  [1] (SetFunction{…} where {…})(f::Function, dom::Catlab.CategoricalAlgebra.FinSets.VarSet{…}, codom::Catlab.CategoricalAlgebra.FinSets.VarSet{…})
    @ Catlab.CategoricalAlgebra.FinSets ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FinSets.jl:227
  [2] compose(d::QueryDiagram{…}, F::Catlab.CategoricalAlgebra.CSets.ACSetFunctor{…}; kw::@Kwargs{})
    @ DataMigrations.Migrations ~/.julia/packages/DataMigrations/5xF1K/src/Migrations.jl:221
  [3] compose
    @ ~/.julia/packages/DataMigrations/5xF1K/src/Migrations.jl:209 [inlined]
  [4] (::DataMigrations.Migrations.var"#19#23"{…})(c::Catlab.Theories.FreeSchema.Ob{…})
    @ DataMigrations.Migrations ~/.julia/packages/DataMigrations/5xF1K/src/Migrations.jl:390
  [5] (::Catlab.CategoricalAlgebra.FinCats.var"#94#95"{…})(x::Catlab.Theories.FreeSchema.Ob{…})
    @ Catlab.CategoricalAlgebra.FinCats ./none:0
  [6] iterate
    @ ./generator.jl:47 [inlined]
  [7] grow_to!(dest::Dict{Any, Any}, itr::Base.Generator{Vector{…}, Catlab.CategoricalAlgebra.FinCats.var"#94#95"{…}})
    @ Base ./dict.jl:120
  [8] dict_with_eltype(DT_apply::F, kv::Base.Generator, t::Any) where F
    @ Base ./abstractdict.jl:590 [inlined]
  [9] Dict(kv::Base.Generator{Vector{…}, Catlab.CategoricalAlgebra.FinCats.var"#94#95"{…}})
    @ Base ./dict.jl:109
 [10] make_map(f::DataMigrations.Migrations.var"#19#23"{…}, xs::Vector{…}, ::Type{…})
    @ Catlab.CategoricalAlgebra.FinCats ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FinCats.jl:819
 [11] make_map
    @ ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FinCats.jl:797 [inlined]
 [12] migrate(X::Catlab.CategoricalAlgebra.CSets.ACSetFunctor{…}, M::DataMigration{…}; return_limits::Bool, tabular::Bool)
    @ DataMigrations.Migrations ~/.julia/packages/DataMigrations/5xF1K/src/Migrations.jl:374
 [13] migrate(X::Catlab.CategoricalAlgebra.CSets.ACSetFunctor{…}, M::DataMigration{…})
    @ DataMigrations.Migrations ~/.julia/packages/DataMigrations/5xF1K/src/Migrations.jl:367 [inlined]
 [14] #migrate#2
    @ ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FunctorialDataMigrations.jl:74 [inlined]
 [15] migrate
    @ ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FunctorialDataMigrations.jl:73 [inlined]
 [16] migrate(::Type{…}, X::WithLabel{…}, M::DataMigration{…}; kw::@Kwargs{})
    @ Catlab.CategoricalAlgebra.FunctorialDataMigrations ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FunctorialDataMigrations.jl:71
 [17] migrate(::Type{…}, X::WithLabel{…}, M::DataMigration{…})
    @ Catlab.CategoricalAlgebra.FunctorialDataMigrations ~/.julia/packages/Catlab/J9R14/src/categorical_algebra/FunctorialDataMigrations.jl:70
 [18] top-level scope
    @ ~/Documents/Git/ieee-tase24-skilltransfer/PlanningDomainMigrations/src/sandbox.jl:380
Some type information was truncated. Use `show(err)` to see complete types.

Here is a minimal example that recreates the error:

using Catlab
using DataMigrations

@present SchWithLabel(FreeSchema) begin
  X::Ob
  Label::AttrType
  hasLabel::Attr(X, Label)
end
@acset_type WithLabel(SchWithLabel)
yWithLabel = yoneda(WithLabel{String})

@present SchSplit(FreeSchema) begin
  A::Ob
  B::Ob
end
@acset_type Split(SchSplit)

M = @migration SchSplit SchWithLabel begin
  A => @join begin
    x::X
    L::Label
    (f:x → L)::hasLabel
    (A:x → L)::(x -> "A")
  end
  B => @join begin
    x::X
    L::Label
    (f:x → L)::hasLabel
    (A:x → L)::(x -> "B")
  end
end

data = @acset_colim yWithLabel begin
  x::X
end

result = migrate(Split, data, M)

The ideal behavior is that result is an empty ACSet.