as ("M" Reference)
[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.]
The as keyword is used to specify an alias identifier that replaces the import ("M" Reference) target.
Syntax
as is used in the two alternate syntaxes of the import directive: one that targets the module level and one that targets the member level. The syntax is identical in each case.
as Identifier
Discussion
When as is used in an import directive, the alias must be used instead of the original identifier. It is an error to reference the original identifier.
Two or more import directives can reference the same declaration, provided they specify distinct aliases. For a given module declaration, at most one import directive can use a given alias.
Examples
The following example shows the syntax using module names.
module Contacts
{
export Person;
type Person
{
FirstName : Text;
Age : Integer32;
}
}
module MyContacts
{
import Contacts as pt;
Friends : pt.Person*;
}
The following example shows the syntax using member names.
module Contacts
{
export Person;
export Address;
type Address
{
street: Text;
City: Text;
}
type Person
{
FirstName : Text;
Age : Integer32;
}
}
module MyContacts
{
import Contacts {Person as pt};
Friends : pt*;
}
The following example shows the error of using the original module name when the alias is used.
module Contacts
{
export Person;
export Address;
type Address
{
street: Text;
City: Text;
}
type Person
{
FirstName : Text;
Age : Integer32;
}
}
module MyContacts
{
import Contacts {Person as pt};
Friends : Contacts.Person*;
}