On 12/12/2007, at 4:26 PM, pitcat_regime wrote:
> The following is purely speculative and incomplete :)
> http://www.paste2.org/p/10458
>
> There may no doubt be more a transparent and succinct syntax, but it
> was a useful exercise, and raises some questions....
Certainly... like:
"how is a business analyst supposed to verify this?",
"what's with all the : => { } symbols?",
"what's a module, a class, an attr_accessor?".
You see, it just doesn't even begin to address the problem that
semantic modeling exists to solve. That's why I gave up pursuing
that path. You'd be better off just dumping the structures as YAML.
It'd certainly be feasible to come up with such a language that you
could convince some programmers to use... or you could just use
ActiveFacts to dump the NORMA model to the CQL below, then
use the new parser (based on Treetop) to convert it into runtime
model objects. I think you'll agree that the CQL is easier to read.
Here's the full dump from my version of the NORMA model using AF.
This passes through the parser, though I'm lacking syntax for a couple
of constraints. All the entities here use simple reference modes, so you
only see the syntax for that style of identification. The parser
supports
multi-part identification, and also supports conceptual queries.
Since you've bent your mind to this problem, perhaps you'd like to
suggest consistent plain(-ish) language syntax for the remaining
constraints (in a C-style comment at the bottom).
Clifford Heath, Data Constellation.
// Model Orienteering
Accessibility = FixedLengthText(1) restricted to {'A'..'D'};
ClubCode = VariableLengthText(6);
ClubName = VariableLengthText(32);
ControlNumber = UnsignedInteger(32) restricted to {1..1000};
Course = VariableLengthText(16) restricted to {'A'..'E', 'PW'};
EntryID = AutoCounter();
EventID = AutoCounter();
EventName = VariableLengthText(50);
FamilyName = VariableLengthText(48);
Gender = FixedLengthText(1) restricted to {'M', 'F'};
GivenName = VariableLengthText(48);
Location = VariableLengthText(200);
MapID = AutoCounter();
MapName = VariableLengthText(80);
Number = UnsignedInteger(32) restricted to {1..100};
PersonID = AutoCounter();
PointValue = UnsignedInteger(32);
Position = UnsignedInteger(32);
PostCode = UnsignedInteger(32);
PunchID = AutoCounter();
Score = SignedInteger(32);
ScoringMethod = VariableLengthText(32) restricted to {'Score',
'Scatter', 'Special'};
SeriesID = AutoCounter();
SeriesName = VariableLengthText(40);
StartTime = DateAndTime();
Time = DateAndTime();
Year = UnsignedInteger(32) restricted to {1900..3000};
Club = entity(Code);
Entry = entity(ID);
Event = entity(ID);
Map = entity(ID);
Person = entity(ID);
Punch = entity(ID);
Series = entity(ID);
Event is called at most one EventName;
EventName is name of at most one Event;
Map is map for Event,
Event uses exactly one Map;
Location is where Event starts,
Event starts at exactly one start Location;
ClubName is name of at most one Club
Club has exactly one ClubName;
Map has exactly one MapName,
MapName is of at most one Map;
Event is held on exactly one StartTime;
Person has exactly one FamilyName,
FamilyName is of Person;
Club (as Owner) owns Map,
Map is owned by exactly one CLub;
Visit = Punch was visited by Entry at Time (as VisitTime);
Series has exactly one SeriesName (as Name),
SeriesName (as Name) is of at most one Series;
Map has at most one Accessibility;
Person has exactly one GivenName,
GivenName is name of Person;
Person is of at most one Gender;
Person was born in at most one Year (as BirthYear);
Person has at most one PostCode;
Person is a member of at most one Club (as MemberOfClub);
Entry received at most one Score;
Entry finished in at most one finish Position;
EventScoringMethod = ScoringMethod is used for Course of Event;
ControlValue = ControlNumber for Event has at most one PointValue;
PunchPlacement = Event has Punch at at most one ControlNumber;
Event is in at most one Series;
Event has at most one Number;
Club runs Event,
Event is run by exactly one Club;
/*
Constraints not yet converted:
CompetitorHasDistinctName: each combination
(PersonHasGivenName.GivenName, PersonHasFamilyName.FamilyName) may
occur at most 1 time
OnlyOneScoringMethodForEachEventAndCourse: in
EventScoringMethod, each combination (Course, Event) may occur at
most 1 time
InternalUniquenessConstraint10: in Entry, each combination
(Person, Event) may occur at most 1 time
EqualityConstraint EqualityConstraint1 between
EventIsInSeries(Event), EventHasNumber(Event)
*/