Yet another syntax query
Posted: Fri Nov 22, 2013 8:53 pm
I have defined many lookup relvars which I use in defining types. For example:
I cannot extend this to a data type that has multiple attributes, and is not a subtype, without having problems.
What I am trying to do is:
This gives the error 'ID1' has not been defined. Other approaches give different errors.
What syntax is needed to achieve what I am trying to do?
Code: Select all
// Utillity type used throughout
TYPE ID1 POSSREP { VALUE CHARACTER CONSTRAINT LENGTH ( VALUE ) <= 36 };
// Lookup relvar
VAR lookup BASE RELATION { P ID1 } KEY { P };
// Lookup constrained type
TYPE LU IS { ID1 CONSTRAINT TUPLE { P ID1 } IN lookup { P } POSSREP { X = THE_VALUE ( ID1 ) } };
What I am trying to do is:
Code: Select all
// Define a relvar that partitions other definitions
VAR DU BASE RELATION { d1 ID, n1 ID } KEY { d1 };
// Define a type that is going to be used throughout the system, which appears in the above relvar
TYPE ident POSSREP { domain ID1, name ID1 CONSTRAINT TUPLE { domain ID1 } IN DU { d1 } };
What syntax is needed to achieve what I am trying to do?