diff options
-rw-r--r-- | src/act4e_solutions/semicategory_representation.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/act4e_solutions/semicategory_representation.py b/src/act4e_solutions/semicategory_representation.py index 4ab9909..dd82485 100644 --- a/src/act4e_solutions/semicategory_representation.py +++ b/src/act4e_solutions/semicategory_representation.py @@ -107,8 +107,9 @@ class MySemiCategory(Generic[OD, MD], I.SemiCategory[ROD, RMD]): return MyFiniteSet(morphisms) def compose(self, ob1: ROD, ob2: ROD, ob3: ROD, m1: RMD, m2: RMD) -> RMD: - m3 = self._composition(ob1.obdata, ob2.obdata, ob3.obdata, m1.mordata, m2.mordata) - return I.RichMorphism(";".join((m1.label, m2.label)), m3) + m3data = self._composition(ob1.obdata, ob2.obdata, ob3.obdata, m1.mordata, m2.mordata) + m3 = I.RichMorphism(";".join((m1.label, m2.label)), m3data) + return m3 def identity(self, ob: ROD) -> RMD: if not self._objects[ob.label]: @@ -142,10 +143,10 @@ class SolSemiCategoryRepresentation(I.SemiCategoryRepresentation): raise I.InvalidFormat() if "identity" in ob.keys() and ob["identity"]: - identity = I.RichMorphism(f"id_{obname}", ob["identity"]["mordata"]) + identity = I.RichMorphism(f"id_{obname}", MorData.load(h, ob["identity"]["mordata"])) sc.add_morphism(obname, obname, identity) - sc.add_object(I.RichObject(obname, ob["obdata"])) + sc.add_object(I.RichObject(obname, ObData.load(h, ob["obdata"]))) # Get the morphisms for morname, mor in data["morphisms"].items(): @@ -153,6 +154,7 @@ class SolSemiCategoryRepresentation(I.SemiCategoryRepresentation): raise I.InvalidFormat() src, tar = mor["source"], mor["target"] - sc.add_morphism(mor["source"], mor["target"], I.RichMorphism(morname, mor["mordata"])) + morphism = I.RichMorphism(morname, MorData.load(h, mor["mordata"])) + sc.add_morphism(mor["source"], mor["target"], morphism) return sc |