Share via


The Microsoft code name "M" Modeling Language Specification - Catalog

Microsoft Corporation

November 2009

[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]

[This documentation targets the Microsoft SQL Server Modeling CTP (November 2009) and is subject to change in future releases. Blank topics are included as placeholders.]

Sections:
1: Introduction to "M"
2: Lexical Structure
3: Text Pattern Expressions
4: Productions
5: Rules
6: Languages
7: Types
8: Computed and Stored Values
9: Expressions
10: Module
11: Attributes
12: Catalog
13: Standard Library
14: Glossary

12 Catalog

module Language.Catalog

{

  export CollectionTypes;

  export ComputedValues;

  export ConstantKinds;

  export Constants;

  export Declarations;

  export EntityTypes;

  export ExpressionKinds;

  export Expressions;

  export Extents;

  export Fields;

  export IdentityFields;

  export Imports;

  export IntrinsicTypes;

  export Languages;

  export MembershipConstraints;

  export Parameters;

  export Types;

  export UniqueConstraints;

  CollectionTypes : {{

    Base : Types;

    MinimumCount : Integer64 => 0;

    MaximumCount : Integer64? => null;

    ElementType : Types;

  }*} where identity(Base);

  ComputedValueGroups : {{

       Declaration : Declarations;

  }*} where identity(Declaration);

  ComputedValues : {{

       Id : Integer32 => AutoNumber;

       ComputedValueGroup : ComputedValueGroups;

       ReturnType : Types;

       Body : Text?;

  }*} where identity(Id);

  Constants : {{

    Expression : Expressions;

    ConstantKind : ConstantKinds;

    Value : General;

  }*} where identity(Expression);

  type ConstantKinds : Text where value in {

    "Null","Binary","DateTime","DateTimeOffset","Decimal","Guid","Integer",

    "Logical","Scientific","Text","Time","Unsigned" };

  // Root of the things M authors can declare (types, extents, computed values,languages)

  Declarations : {{

    Id : Integer32 => AutoNumber;

    Name : Text;

    DefinedIn : Modules;

    HasSyntheticName : Logical => false;

    Exported : Logical => false;

    Kind : Text where value in { "Type", "Extent", "ComputedValue", "Language" };

  }*} where identity(Id);

  EntityTypes : {{

    Base : Types;

    Nullable : Logical => false;

  }*} where identity(Base);

  Extents : {{

    Declaration : Declarations;

    ExtentType : Types;

  }*} where identity(Declaration);

  Expressions : {{

    Id : Integer32 => AutoNumber;

    ExpressionType : Types;

    ExpressionKind : ExpressionKinds;

  }*} where identity(Id);

  type ExpressionKinds : Text where value in {

    "Coalesce","Conditional","Constant","GraphExpressionSymbolo","Invocation",

    "MemberAccess","SelectExpressionSymbol","TypeAscription","TypeReference",

    "VariableReference","WhereExpressionSymbol","FromExpressionSymbol",

    "IntoExpressionSymbol","JoinExpressionSymbol","LetExpressionSymbol"

  };

  Fields : {{

    Id : Integer32 => AutoNumber;

    Name : Text;

    Position : Integer16;     // Position of field in entity declaration

    FieldType : Types;        // Type of this field

    AutoGenerated : (Text where value in { "Identity", "IdSequence", "NewGuid" })?;

    EntityType : EntityTypes; // EntityType that this field belongs to

  }*} where identity(Id),unique(Position,EntityType);

  IdentityFields : {{

    Id : Integer32 => AutoNumber;

    EntityType : EntityTypes;

    Position : Integer16; // Position in the identity constraint declaration

    Field : Fields;

  }*} where identity(Id),unique(EntityType,Position),unique(Field);

  Imports : {{

    Id : Integer32 => AutoNumber;

    ImportingModule : Modules;

    Kind : Text where value in { "Module", "Member" };

  }*} where identity(Id);

  ModuleImports : {{

    Id : Imports;

    Module : Modules;

  } where identity(Id), value.Module.Id != value.Id.ImportingModule.Id *};

  MemberImports : {{

    Id : Imports;

    Member : Declarations where value.HasSyntheticName == false;

  } where identity(Id), value.Member.DefinedIn.Id != value.Id.ImportingModule.Id *};

  IntrinsicTypes : {{

    Base : Types;

    Nullable : Logical => false;

    // Min/Max are used to record length constraints on Text/Binary, range constraints on integer numerics, nonsensical for Logical, Guid

    Min : Integer64 => 0;

    Max : Integer64?;

  }*} where identity(Base);

  Languages : {{

    Declaration : Declarations;

  }*} where identity(Declaration);

  MembershipConstraints : {{

    Id : Integer32 => AutoNumber;

    Kind : Text where value in { "In", "Subset", "Superset" };

    TargetExtent : Extents;

  }*} where identity(Id);

  Modules : {{

    Id : Integer32 => AutoNumber;

    Name : Text where value.Count <=400;

  }*} where identity(Id),unique(Name);

  Parameters : {{

    Id : Integer32 => AutoNumber;

    ComputedValue : ComputedValues;

    Position : Integer16;

    Name : Text where value.Count <=400;

    ParameterType : Types;

  }*} where identity(Id),unique(ComputedValue,Position),unique(ComputedValue,Name);

  Types : {{

    Declaration : Declarations;

    BuiltInType : Text; // Named of standard library type upon which this type is based.

    MembershipConstraint : MembershipConstraints?;

    ConstraintExpression : Text?;

  }*} where identity(Declaration);

  UniqueConstraints : {{

    Id : Integer32 => AutoNumber;

    CollectionType : CollectionTypes;

  }*} where identity(Id);

  UniqueFields : {{

    Id : Integer32 => AutoNumber;

    UniqueConstraint : UniqueConstraints;

    Position : Integer16; // Position in the unique constraint declaration

    Field : Fields;

  }*} where identity(Id),unique(UniqueConstraint,Position);

}