With a simple tree I mean a self-referencing one-to-many relationship without a strategy to handle cycles between linked instances. An excellent MSDN-article on that subject is found here.
module Tree
{
type Person
{
Id : Integer32 = AutoNumber();
Name : Text#50;
Parent : Person? where value in People;
} where identity(Id);
People : Person*;
}
This is translated into the following T-SQL:
create schema [Tree];
go
create table [Tree].[People]
(
[Id] int not null identity,
[Name] nvarchar(50) not null,
[Parent] int null,
constraint [PK_People] primary key clustered ([Id]),
constraint [FK_People_Parent_Tree_People]
foreign key ([Parent]) references [Tree].[People] ([Id])
);
go