Candidate examples

This forum is for discussing the development of Rel examples and sample applications.
Post Reply
Chris Walton
Posts: 76
Joined: Sat Aug 18, 2012 2:13 pm

Candidate examples

Post by Chris Walton »

I am using Rel to learn about the language, and the application of pure relational concepts rather than the variant embedded in SQL. I am also using a subset of Rel as part of a definition language I am writing. I am deriving many Rel fragments code as I do so. Would there be any value in posting some of these here as examples of language constructs?

As you might gather, this is very much work in progress, and so the validity of the candidate examples would potentially vary. At present for instance, the examples have not even been compiled in DBrowser. This is because:
I need a certain volume of material in place before fragments are usable;
I am not clear that the syntax is correct (and getting my syntax checked is a reason for suggesting posting these candidates).
In my project I will find (hopefully small) differences between what the language should do (IMHO), and what it does. An example is case sensitivity for names. I have not yet written a utility to output strict Rel from the slight variant I am using, so any conversions have been done manually.

Could I have your views on my supplying candidate examples.

To give a little context this is one of the fragments that has recently emerged in my work (this is more abbreviated than would be the normal case).
Extracting a value to enforce 1:1-0:1 constraint (ie an optional attribute):
type_ID FROM ( TUPLE FROM ( type WHERE ( name = "symbolic" ) { type_ID } ) )
Dave
Site Admin
Posts: 372
Joined: Sun Nov 27, 2005 7:19 pm

Re: Candidate examples

Post by Dave »

Hi Chris,

First, sorry for my slow response!

Yes, please do post some of your examples and fragments here.
Chris Walton
Posts: 76
Joined: Sat Aug 18, 2012 2:13 pm

Re: Candidate examples

Post by Chris Walton »

A long time down the line, I am finally in a position to start posting candidate examples. This first batch is VERY elementary, but reflects points where I have encountered difficulty in getting syntax and concepts understood. The format I have chosen is to post each example as a new topic, and formatted in (I hope) a consistent manner. If you would prefer a different manner of presentation then please yell before I get too far into this. This example example illustrates the format I have chosen. The notes represent my interpretation of the difficulties I have encountered, and some of these explanations may be suspect. HTH.

Example 2: Simplest inherited TYPE definition
TYPE identifier IS
{ BDT_symbolic
CONSTRAINT LENGTH ( THE_value ( BDT_symbolic ) ) <= 64
POSSREP { identifier = THE_value ( BDT_symbolic ) } } ;

Production Rule
type_def ::= <TYPE> identifier <IS> "{" identifier <CONSTRAINT> expression
<POSSREP> "{" identifier = identifier ( identifier ) "}" "}"

Notes
A subtype must have a specialisation constraint to distinguish it from its supertype.
Operator identifiers are case sensitive, so it is LENGTH, not length.
A subtype must either be a subtype of one of the built in types, or must have at least one POSSREP.
The POSSREP of a subtype definition must be framed in terms of THE_... operator.
Post Reply