Introduction to Data Migrations
DataMigrations.jl includes facilities for categorical data migrations. We'll start by example, working with some graph schemas from Catlab.
using Catlab, DataMigrations
M = @migration SchReflexiveGraph SchGraph begin
V => V
E => @cases begin e::E; v::V end
src => begin e => src; v => id(V) end
tgt => begin e => tgt; v => id(V) end
refl => v
end
DataMigration{Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.Categories.TypeCat{Catlab.CategoricalAlgebra.Diagrams.SimpleDiagram{AlgebraicInterfaces.id, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, D} where D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}}), QueryDiagramHom{AlgebraicInterfaces.id, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}, Dict{Any, Any}}, Φ, D} where {Φ<:(Catlab.CategoricalAlgebra.Categories.Transformation{C, D, Dom, Codom} where {C<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}), D<:Catlab.CategoricalAlgebra.Categories.Category, Dom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom})), Codom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}))}), D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}})}}, Dict{Symbol, Catlab.CategoricalAlgebra.Diagrams.SimpleDiagram{AlgebraicInterfaces.id, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, D} where D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}})}, Dict{Symbol, QueryDiagramHom{AlgebraicInterfaces.id, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}, Dict{Any, Any}}, Φ, D} where {Φ<:(Catlab.CategoricalAlgebra.Categories.Transformation{C, D, Dom, Codom} where {C<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}), D<:Catlab.CategoricalAlgebra.Categories.Category, Dom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom})), Codom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}))}), D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}})}}}, Dict{Any, Union{}}}(FinDomFunctor(Dict{Symbol, Catlab.CategoricalAlgebra.Diagrams.SimpleDiagram{AlgebraicInterfaces.id, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, D} where D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}})}(:V => Diagram{id}(FinFunctor(Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}(:V => V), Dict{Symbol, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}(), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[V], Hom = Hom{:generator}[], AttrType = AttrType{:generator}[], Attr = Attr{:generator}[]), Dict(:V=>(:Ob=>1)), Pair[])), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[V, E], Hom = Hom{:generator}[src, tgt], AttrType = AttrType{:generator}[], Attr = Attr{:generator}[]), Dict(:src=>(:Hom=>1), :V=>(:Ob=>1), :E=>(:Ob=>2), :tgt=>(:Hom=>2)), Pair[])))), :E => Diagram{id}(FinFunctor(Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}(:v => V, :e => E), Dict{Any, Any}(), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[e, v], Hom = Hom{:generator}[], AttrType = AttrType{:generator}[], Attr = Attr{:generator}[]), Dict(:e=>(:Ob=>1), :v=>(:Ob=>2)), Pair[])), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[V, E], Hom = Hom{:generator}[src, tgt], AttrType = AttrType{:generator}[], Attr = Attr{:generator}[]), Dict(:src=>(:Hom=>1), :V=>(:Ob=>1), :E=>(:Ob=>2), :tgt=>(:Hom=>2)), Pair[]))))), Dict{Symbol, QueryDiagramHom{AlgebraicInterfaces.id, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}, Dict{Any, Any}}, Φ, D} where {Φ<:(Catlab.CategoricalAlgebra.Categories.Transformation{C, D, Dom, Codom} where {C<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}), D<:Catlab.CategoricalAlgebra.Categories.Category, Dom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom})), Codom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}))}), D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}})}}(:refl => DiagramHom{id}([(v, id(V))], [], FinFunctor(Dict{Symbol, Ob{:generator}}(:V=>V), Dict{Symbol, Union{Attr, AttrType, Hom}}(), …), FinFunctor(Dict{Symbol, Ob{:generator}}(:v=>V, :e=>E), Dict{Any, Any}(), …)), :src => DiagramHom{id}([(V, src), (V, id(V))], [], FinFunctor(Dict{Symbol, Ob{:generator}}(:v=>V, :e=>E), Dict{Any, Any}(), …), FinFunctor(Dict{Symbol, Ob{:generator}}(:V=>V), Dict{Symbol, Union{Attr, AttrType, Hom}}(), …)), :tgt => DiagramHom{id}([(V, tgt), (V, id(V))], [], FinFunctor(Dict{Symbol, Ob{:generator}}(:v=>V, :e=>E), Dict{Any, Any}(), …), FinFunctor(Dict{Symbol, Ob{:generator}}(:V=>V), Dict{Symbol, Union{Attr, AttrType, Hom}}(), …))), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[V, E], Hom = Hom{:generator}[src, tgt, refl], AttrType = AttrType{:generator}[], Attr = Attr{:generator}[]), Dict(:refl=>(:Hom=>3), :src=>(:Hom=>1), :V=>(:Ob=>1), :E=>(:Ob=>2), :tgt=>(:Hom=>2)), Pair[])), TypeCat(Catlab.CategoricalAlgebra.Diagrams.SimpleDiagram{AlgebraicInterfaces.id, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, D} where D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}}), QueryDiagramHom{AlgebraicInterfaces.id, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}, Dict{Any, Any}}, Φ, D} where {Φ<:(Catlab.CategoricalAlgebra.Categories.Transformation{C, D, Dom, Codom} where {C<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}), D<:Catlab.CategoricalAlgebra.Categories.Category, Dom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom})), Codom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}))}), D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}})})), Dict{Any, Union{}}())
This is a migration from SchReflexiveGraph
to SchGraph
. Every call to @migration
constructs a contravariant data migration, which means in this case that M
will turn graphs into reflexive graphs. To construct M
, we construct a functor whose domain is SchReflexiveGraph
. The codomain is not just SchGraph
, though! Before we get into that, let's understand what the syntax is signifying more concretely.
In general, each assignment statement a => b
means "when I migrate a graph G
to a reflexive graph H
with this migration, I want the a
in H
to be given by b
." b
will be some expression that makes sense in terms of the original graph G
.
Thus the first line V => V
is easy: we want the vertices of H
to be the same as the vertices of G
. For the second line, E => @cases begin e::E; v::V end
things begin to get interesting. What this is saying is that we want an *edge* in
Hto be *either* an edge in
G*or* a vertex in
G. Thus both
Eand
Vrefer to those sorts for
G. The little
eand
v` function as references for later.
Next we have to define our migration on the homs in SchReflexiveGraph
. The line src => begin e => src; v => id(V) end
says that we want the src
function in our new reflexive graph H
to be given by sending an edge to its original src
and a vertex to itself. The tgt
function of H
behaves much the same. Finally, we need refl
to be a function from H
's V
to H
's E
, and the only likely way to do that is to send a vertex to itself via v
. (So you can think of e
and v
as the two inclusions into the coproduct, if you like.)
All in all, what have we done? Let's give it a try!
G = Graph(3)
H = migrate(ReflexiveGraph,G,M)
V | refl |
---|---|
1 | 1 |
2 | 2 |
3 | 3 |
E | src | tgt |
---|---|---|
1 | 1 | 1 |
2 | 2 | 2 |
3 | 3 | 3 |
We see that M
takes the discrete graph on 3 vertices to the discrete reflexive graph on 3 vertices; that is, M
just adds a new loop to each vertex. And there's our first data migration!
That was an example of a colimit migration, in that in involved building a disjoint union, i.e. coproduct. Let's now look at an example of a limit migration. And why not make things look a bit more practical? Here's a schema for some tasks and workers, where we can assign times for a job to be done and a worker who's supposedly going to do that job at that time.
@present SchSchedule(FreeSchema) begin
Jobs::Ob
Workers::Ob
assignment::Hom(Jobs,Workers)
Time::AttrType
time::Attr(Jobs,Time)
end
@acset_type Schedule(SchSchedule,index = [:assignment])
Main.Schedule
Now let's construct a simple migration to find jobs assigned to the same worker at the same time.
@present SchConflicts(FreeSchema) begin
ConflictedPairs::Ob
Job1::Ob
Job2::Ob
Workers::Ob
assignment::Hom(ConflictedPairs,Workers)
job1::Hom(ConflictedPairs,Job1)
job2::Hom(ConflictedPairs,Job2)
Time::AttrType
time::Attr(ConflictedPairs,Time)
end
@acset_type Conflicts(SchConflicts,index = [:assignment])
Main.Conflicts
The key thing is going to be to construct the set of conflicted pairs: pairs (x,y) of jobs assigned to the same worker at the same time. This is a perfect job for a limit migration.
N = @migration SchConflicts SchSchedule begin
ConflictedPairs => @join begin
X::Jobs
Y::Jobs
W::Workers
T::Time
(a:X→W)::assignment
(b:Y→W)::assignment
(t:X→T)::time
(s:Y→T)::time
end
Job1 => Jobs
Job2 => Jobs
Workers => Workers
assignment => assignment(X)
job1 => X
job2 => Y
Time => Time
time => time(X)
end
DataMigration{Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.Categories.TypeCat{Catlab.CategoricalAlgebra.Diagrams.SimpleDiagram{GATlab.Stdlib.StdModels.op, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, D} where D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}}), Catlab.CategoricalAlgebra.Diagrams.SimpleDiagramHom{GATlab.Stdlib.StdModels.op, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}, Dict{Any, Any}}, Φ, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, GATlab.Models.SymbolicModels.GATExpr{:generator}}, Dict{Symbol, GATlab.Models.SymbolicModels.GATExpr{:generator}}}} where Φ<:(Catlab.CategoricalAlgebra.Categories.Transformation{C, D, Dom, Codom} where {C<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}), D<:Catlab.CategoricalAlgebra.Categories.Category, Dom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom})), Codom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}))})}, Dict{Symbol, Catlab.CategoricalAlgebra.Diagrams.SimpleDiagram{GATlab.Stdlib.StdModels.op, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, D} where D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}})}, Dict{Symbol, Catlab.CategoricalAlgebra.Diagrams.SimpleDiagramHom{GATlab.Stdlib.StdModels.op, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}, Dict{Any, Any}}, Φ, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, GATlab.Models.SymbolicModels.GATExpr{:generator}}, Dict{Symbol, GATlab.Models.SymbolicModels.GATExpr{:generator}}}} where Φ<:(Catlab.CategoricalAlgebra.Categories.Transformation{C, D, Dom, Codom} where {C<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}), D<:Catlab.CategoricalAlgebra.Categories.Category, Dom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom})), Codom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}))})}}, Dict{Any, Union{}}}(FinDomFunctor(Dict{Symbol, Catlab.CategoricalAlgebra.Diagrams.SimpleDiagram{GATlab.Stdlib.StdModels.op, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, D} where D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}})}(:Job2 => Diagram{op}(FinFunctor(Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}(:Jobs => Jobs), Dict{Symbol, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}(), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[Jobs], Hom = Hom{:generator}[], AttrType = AttrType{:generator}[], Attr = Attr{:generator}[]), Dict(:Jobs=>(:Ob=>1)), Pair[])), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[Jobs, Workers], Hom = Hom{:generator}[assignment], AttrType = AttrType{:generator}[Time], Attr = Attr{:generator}[time]), Dict(:Jobs=>(:Ob=>1), :Workers=>(:Ob=>2), :assignment=>(:Hom=>1), :Time=>(:AttrType=>1), :time=>(:Attr=>1)), Pair[])))), :Workers => Diagram{op}(FinFunctor(Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}(:Workers => Workers), Dict{Symbol, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}(), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[Workers], Hom = Hom{:generator}[], AttrType = AttrType{:generator}[], Attr = Attr{:generator}[]), Dict(:Workers=>(:Ob=>1)), Pair[])), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[Jobs, Workers], Hom = Hom{:generator}[assignment], AttrType = AttrType{:generator}[Time], Attr = Attr{:generator}[time]), Dict(:Jobs=>(:Ob=>1), :Workers=>(:Ob=>2), :assignment=>(:Hom=>1), :Time=>(:AttrType=>1), :time=>(:Attr=>1)), Pair[])))), :Job1 => Diagram{op}(FinFunctor(Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}(:Jobs => Jobs), Dict{Symbol, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}(), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[Jobs], Hom = Hom{:generator}[], AttrType = AttrType{:generator}[], Attr = Attr{:generator}[]), Dict(:Jobs=>(:Ob=>1)), Pair[])), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[Jobs, Workers], Hom = Hom{:generator}[assignment], AttrType = AttrType{:generator}[Time], Attr = Attr{:generator}[time]), Dict(:Jobs=>(:Ob=>1), :Workers=>(:Ob=>2), :assignment=>(:Hom=>1), :Time=>(:AttrType=>1), :time=>(:Attr=>1)), Pair[])))), :ConflictedPairs => Diagram{op}(FinFunctor(Dict{Symbol, GATlab.Models.SymbolicModels.GATExpr{:generator}}(:T => Time, :W => Workers, :X => Jobs, :Y => Jobs), Dict{Symbol, GATlab.Models.SymbolicModels.GATExpr{:generator}}(:a => assignment, :b => assignment, :s => time, :t => time), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[X, Y, W, T], Hom = Hom{:generator}[a, b, t, s], AttrType = AttrType{:generator}[], Attr = Attr{:generator}[]), Dict(:T=>(:Ob=>4), :a=>(:Hom=>1), :b=>(:Hom=>2), :s=>(:Hom=>4), :W=>(:Ob=>3), :X=>(:Ob=>1), :Y=>(:Ob=>2), :t=>(:Hom=>3)), Pair[])), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[Jobs, Workers], Hom = Hom{:generator}[assignment], AttrType = AttrType{:generator}[Time], Attr = Attr{:generator}[time]), Dict(:Jobs=>(:Ob=>1), :Workers=>(:Ob=>2), :assignment=>(:Hom=>1), :Time=>(:AttrType=>1), :time=>(:Attr=>1)), Pair[])))), :Time => Diagram{op}(FinFunctor(Dict{Symbol, Catlab.Theories.FreeSchema.AttrType{:generator}}(:Time => Time), Dict{Symbol, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}(), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[Time], Hom = Hom{:generator}[], AttrType = AttrType{:generator}[], Attr = Attr{:generator}[]), Dict(:Time=>(:Ob=>1)), Pair[])), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[Jobs, Workers], Hom = Hom{:generator}[assignment], AttrType = AttrType{:generator}[Time], Attr = Attr{:generator}[time]), Dict(:Jobs=>(:Ob=>1), :Workers=>(:Ob=>2), :assignment=>(:Hom=>1), :Time=>(:AttrType=>1), :time=>(:Attr=>1)), Pair[]))))), Dict{Symbol, Catlab.CategoricalAlgebra.Diagrams.SimpleDiagramHom{GATlab.Stdlib.StdModels.op, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}, Dict{Any, Any}}, Φ, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, GATlab.Models.SymbolicModels.GATExpr{:generator}}, Dict{Symbol, GATlab.Models.SymbolicModels.GATExpr{:generator}}}} where Φ<:(Catlab.CategoricalAlgebra.Categories.Transformation{C, D, Dom, Codom} where {C<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}), D<:Catlab.CategoricalAlgebra.Categories.Category, Dom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom})), Codom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}))})}(:job1 => DiagramHom{op}([(X, id(Jobs))], [], FinFunctor(Dict{Symbol, GATExpr{:generator}}(:T=>Time, :W=>Workers, :X=>Jobs, :Y=>Jobs), Dict{Symbol, GATExpr{:generator}}(:a=>assignment, :b=>assignment, :s=>time, :t=>time), …), FinFunctor(Dict{Symbol, Ob{:generator}}(:Jobs=>Jobs), Dict{Symbol, Union{Attr, AttrType, Hom}}(), …)), :assignment => DiagramHom{op}([(X, assignment)], [], FinFunctor(Dict{Symbol, GATExpr{:generator}}(:T=>Time, :W=>Workers, :X=>Jobs, :Y=>Jobs), Dict{Symbol, GATExpr{:generator}}(:a=>assignment, :b=>assignment, :s=>time, :t=>time), …), FinFunctor(Dict{Symbol, Ob{:generator}}(:Workers=>Workers), Dict{Symbol, Union{Attr, AttrType, Hom}}(), …)), :job2 => DiagramHom{op}([(Y, id(Jobs))], [], FinFunctor(Dict{Symbol, GATExpr{:generator}}(:T=>Time, :W=>Workers, :X=>Jobs, :Y=>Jobs), Dict{Symbol, GATExpr{:generator}}(:a=>assignment, :b=>assignment, :s=>time, :t=>time), …), FinFunctor(Dict{Symbol, Ob{:generator}}(:Jobs=>Jobs), Dict{Symbol, Union{Attr, AttrType, Hom}}(), …)), :time => DiagramHom{op}([(X, time)], [], FinFunctor(Dict{Symbol, GATExpr{:generator}}(:T=>Time, :W=>Workers, :X=>Jobs, :Y=>Jobs), Dict{Symbol, GATExpr{:generator}}(:a=>assignment, :b=>assignment, :s=>time, :t=>time), …), FinFunctor(Dict{Symbol, AttrType{:generator}}(:Time=>Time), Dict{Symbol, Union{Attr, AttrType, Hom}}(), …))), FinCat(Presentation{T, Symbol}(Catlab.Theories.FreeSchema, (Ob = Ob{:generator}[ConflictedPairs, Job1, Job2, Workers], Hom = Hom{:generator}[assignment, job1, job2], AttrType = AttrType{:generator}[Time], Attr = Attr{:generator}[time]), Dict(:time=>(:Attr=>1), :Job2=>(:Ob=>3), :Workers=>(:Ob=>4), :assignment=>(:Hom=>1), :Job1=>(:Ob=>2), :ConflictedPairs=>(:Ob=>1), :job2=>(:Hom=>3), :Time=>(:AttrType=>1), :job1=>(:Hom=>2)), Pair[])), TypeCat(Catlab.CategoricalAlgebra.Diagrams.SimpleDiagram{GATlab.Stdlib.StdModels.op, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, D} where D<:(Catlab.CategoricalAlgebra.Categories.Functor{<:Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}}), Catlab.CategoricalAlgebra.Diagrams.SimpleDiagramHom{GATlab.Stdlib.StdModels.op, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, Catlab.Theories.FreeSchema.Ob{:generator}}, Dict{Any, Any}}, Φ, Catlab.CategoricalAlgebra.FinCats.FinDomFunctorMap{Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Catlab.CategoricalAlgebra.FinCats.FinCatPresentation{Catlab.Theories.ThSchema.Meta.T, Union{Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Ob}, Union{Catlab.Theories.FreeSchema.Attr, Catlab.Theories.FreeSchema.AttrType, Catlab.Theories.FreeSchema.Hom}}, Dict{Symbol, GATlab.Models.SymbolicModels.GATExpr{:generator}}, Dict{Symbol, GATlab.Models.SymbolicModels.GATExpr{:generator}}}} where Φ<:(Catlab.CategoricalAlgebra.Categories.Transformation{C, D, Dom, Codom} where {C<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}), D<:Catlab.CategoricalAlgebra.Categories.Category, Dom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom})), Codom<:(Catlab.CategoricalAlgebra.Categories.Functor{Dom} where Dom<:(Catlab.CategoricalAlgebra.Categories.Category{Ob, Hom, Catlab.CategoricalAlgebra.FinCats.FinCatSize} where {Ob, Hom}))}))), Dict{Any, Union{}}())
Most of this migration is easy enough, but the image of ConflictedPairs
is quite complicated. We've specified a *diagram* in
SchSchedule, given by mapping the graph with vertices
X,Y,W,Tand edges
a,b,t,s` into that schema according to the mapping given to the right of the double colons.
What the @join
decoration does is instruct the migration to send a Schedule
A
to a
ConflictsB
whose
ConflictedPairsare the set of all ways to choose an element of
A's
Jobsfor
Xand for
Y, an element of
A's
Workersfor
W, and an element of
A's
Timefor
T, in such a way that moving along any of the four edges sends one of the selected choices to another. What this amounts to is, as promised, all the ways to choose two jobs assigned the same worker and the same time. Let's see it in action. We'll use Julia's
Timetype for the
Time` attribute but for now, times will be on whole hours.
using Dates
A = @acset Schedule{Time} begin
Jobs = 7
Workers = 3
assignment = [1,3,2,2,3,1,1]
time = Time.([9,9,10,11,10,10,9])
end
Jobs | assignment | time |
---|---|---|
1 | 1 | 09:00:00 |
2 | 3 | 09:00:00 |
3 | 2 | 10:00:00 |
4 | 2 | 11:00:00 |
5 | 3 | 10:00:00 |
6 | 1 | 10:00:00 |
7 | 1 | 09:00:00 |
You can probably spot that we ought to get one conflict, since worker 1 is supposed to be doing both jobs 1 and 7 at 9:00am. Let's check:
A′ = migrate(Conflicts,A,N)
ConflictedPairs | assignment | job1 | job2 | time |
---|---|---|---|---|
1 | 1 | 1 | 1 | 09:00:00 |
2 | 1 | 1 | 7 | 09:00:00 |
3 | 3 | 2 | 2 | 09:00:00 |
4 | 2 | 3 | 3 | 10:00:00 |
5 | 2 | 4 | 4 | 11:00:00 |
6 | 3 | 5 | 5 | 10:00:00 |
7 | 1 | 6 | 6 | 10:00:00 |
8 | 1 | 7 | 1 | 09:00:00 |
9 | 1 | 7 | 7 | 09:00:00 |