UNPKG

acsets

Version:

An implementation of acsets in typescript, compatible with ACSets.jl and pyacsets

108 lines (107 loc) 2.97 kB
export interface IVersionSpec { ACSetSchema: string; Catlab: string; } export interface IOb { name: string; } export interface IHom { name: string; dom: string; codom: string; } export interface IAttrType { name: string; } export interface IAttr { name: string; dom: string; codom: string; } export interface ICatlabSchema { version?: IVersionSpec; Ob: IOb[]; AttrType: IAttrType[]; Hom: IHom[]; Attr: IAttr[]; } /** This class represents objects in schemas. In an acset, there is a table for each object in the schema. */ export declare class Ob { readonly name: string; constructor(object: IOb); export(): IOb; } /** This class represents morphisms in schemas. In an acset, the table corresponding to an object `x` has a foreign key column for every morphism in the schema that has a domain (`dom`) of `x`, that has ids that reference rows in the table for the codomain (`codom`). */ export declare class Hom { readonly name: string; readonly dom: string; readonly codom: string; constructor(object: IHom); export(): IHom; } /** This class represents attribute types in schemas. An attribute type is the "codomain" of attributes. In an acset, each attrtype is associated with a type. But in general, acsets are "polymorphic" over the types of their attributes. */ export declare class AttrType { readonly name: string; constructor(object: IAttrType); export(): IAttrType; } /** This class represents attributes in schemas. An attribute corresponds to a non-foreign-key column in the table for its domain (`dom`). */ export declare class Attr { readonly name: string; readonly dom: string; readonly codom: string; constructor(object: IAttr); export(): IAttr; } /** We use this version spec to version the serialization format, so that if we change the serialization format, we can migrate old serializations into new ones. */ export declare class VersionSpec { readonly ACSetSchema: string; readonly Catlab: string; constructor(object: IVersionSpec); export(): IVersionSpec; } export declare class CatlabSchema { readonly obs: Ob[]; readonly homs: Hom[]; readonly attrtypes: AttrType[]; readonly attrs: Attr[]; readonly version_spec?: VersionSpec; constructor(object: ICatlabSchema); constructor(obs: Ob[], homs: Hom[], attrtypes: AttrType[], attrs: Attr[], version_spec: VersionSpec | undefined); export(): ICatlabSchema; outgoingHoms(ob: Ob): Hom[]; outgoingAttrs(ob: Ob): Attr[]; } /** The things that can be set on a part in an acset. */ export type Property = Hom | Attr; /** This is a schema for an acset. Every acset needs a schema, to restrict the allowed operations to ensure consistency. */ export declare class Schema { readonly name: string; readonly schema: CatlabSchema; readonly ob_by_name: Map<string, Ob>; constructor(name: string, schema: CatlabSchema); }