Links

This section describes the SDL declarations pertaining to links.

Declare an abstract link “friends_base” with a helpful title:

abstract link friends_base {
    # declare a specific title for the link
    annotation title := 'Close contacts';
}

Declare a concrete link “friends” within a “User” type:

type User {
    required property name -> str;
    property address -> str;
    # define a concrete link "friends"
    multi link friends extending friends_base-> User;

    index user_name_idx on (__subject__.name);
}

Define a new link corresponding to the more explicit DDL commands.

Concrete link form used inside type declaration:
[ required ] [{single | multi}] link name
  [ extending base [, ...] ] -> type
  [ "{"
      [ default := expression ; ]
      [ readonly := {true | false} ; ]
      [ on target delete action ; ]
      [ annotation-declarations ]
      [ property-declarations ]
      [ constraint-declarations ]
      ...
    "}" ]


Computable link form used inside type declaration:
[ required ] [{single | multi}] link name := expression;

Abstract link form:
abstract link name [extending base [, ...]]
[ "{"
    [ readonly := {true | false} ; ]
    [ annotation-declarations ]
    [ property-declarations ]
    [ constraint-declarations ]
    [ index-declarations ]
    ...
  "}" ]

The core of the declaration is identical to CREATE LINK, while the valid SDL sub-declarations are listed below:

annotation-declarations

Set link annotation to a given value.

property-declarations

Define a concrete property on the link.

constraint-declarations

Define a concrete constraint on the link.

index-declarations

Define an index for this abstract link. Note that this index can only refer to link properties.