UCM Scenarios Data Model

Overview

  • This page defines the data model that will be implemented in jUCMNav.
  • UCMNav supports only global boolean variables.

Proposal / Recommendation

  • We focus on the core behaviour, to be improved at a later date.
  • Java style comments are supported (/* ... */ and // ... )

Supported Data Types

  • Boolean
    • Examples: true, false (integers cannot be cast to Boolean in conditions)
    • Global variables defined in a central location.
      • DA: I don't mind having global ones; there are many things to resolve before considering local ones
  • Integers
    • Examples: -10, 0, 1, 2, 3
    • Global variables defined in a central location.
  • Enumerations
    • Example: (user-defined) { INITIAL, WAITING, WORKING, DONE }
    • Global enumeration defined in central location.

Supported Operations

  • Booleans
    • Compare (equals, not equals)
    • Binary operations (and, or, xor, implies)
    • Unary operations (not)
    • Assignment
  • Integers
    • Compare (equals, not equals, greater than, less than, greater or equal to, less or equal to)
    • Binary operations (addition, substraction, multiplication, we do not support division)
    • Unary operations (additive complemettn (-VarName) : (we do not support (pre/post)-increment, (pre/post)-decrement)
    • Assignment
  • Enumerations
    • Compare (equals, not equals)
      • DA: Ok, no < or > (no ranking)
    • Assignment

BNF Grammar for conditions used in jUCMNav

  • Spacing added for readability
  • Limitations of BNF grammar:
    1. The grammar as expressed requires a type-checker working above it.

Expression              := Implication
Implication             := Disjunction (Implies Disjunction)*
Disjunction             := Conjunction ((Or | Xor ) Conjunction)*
Conjunction             := Comparison (And Comparison)*
Comparison              := BooleanUnit ((Equals| NotEquals) BooleanUnit)*
Negation                := Not BooleanUnit
BooleanUnit             := Negation | RelationalExpression | BooleanConstant 
RelationalExpression    := AdditiveExpression ((GreaterThan | GreaterOrEqualTo | LowerThan | LowerOrEqualTo) AdditiveExpression)?
AdditiveExpression      := MultiplicativeExpression ((Addition | Substraction) MultiplicativeExpression)*
MultiplicativeExpression:= UnaryExpression (Multiplication UnaryExpression)*
UnaryExpression         := (Addition | Substraction)? ("(" Expression ")" | IntegerConstant | Identifier )

And                     := "and" | "&&"
Or                      := "or" | "||"
Xor                     := "xor" | "^"
Implies                 := "=>"
Equals                  := "=" | "=="
NotEquals               := "not" | "!"
GreaterThan             := ">"
GreaterOrEqualTo        := ">="
LowerThan               := "<"
LowerOrEqualTo          := "<="
Addition                := "+"
Substraction            := "-"
Multiplication          := "*"
IntegerConstant         := ["0"-"9"]+
BooleanConstant         := "true" | "false"
Identifier              := ["_","a"-"z","A"-"Z"](["_","a"-"z","A"-"Z", "0"-"9"])*

BNF Grammar for operations in responsibilities

ResponsibilityAction   := Statement+
Statement              := Assignment | CompoundStatement  | IfStatement
Assignment             := Identifier AssignmentOperator Expression StatementTerminator
CompoundStatement      := "{" Statement* "}"
IfStatement            := If Expression Statement (Else Statement)?

AssignmentOperator     := "=" | ":="
If                     := "if"
Else                   := "else"
StatementTerminator    := ";"

BNF Grammar for global definitions

  • None. These will be constrained by UI.

Type-checker rules.

  • (Boolean) Implies (Boolean) : (Boolean)
  • (Boolean) Or (Boolean) : (Boolean)
  • (Boolean) Xor (Boolean) : (Boolean)
  • (Boolean) And (Boolean) : (Boolean)
  • (Boolean) Equals (Boolean) : (Boolean)
  • (Boolean) NotEquals (Boolean) : (Boolean)
  • (Integer) Equals (Integer) : (Boolean)
  • (Integer) NotEquals (Integer) : (Boolean)
  • (EnumerationName) Equals (EnumerationName) : (Boolean)
  • (EnumerationName) NotEquals (EnumerationName) : (Boolean)
  • Not (Boolean) : (Boolean)
  • (Integer) GreaterThan (Integer) : (Boolean)
  • (Integer) GreaterOrEqualTo (Integer) : (Boolean)
  • (Integer) LowerThan (Integer) : (Boolean)
  • (Integer) LowerOrEqualTo (Integer) : (Boolean)
  • (Integer) Addition (Integer) : (Integer)
  • (Integer) Substraction (Integer) : (Integer)
  • (Integer) Multiplication (Integer) : (Integer)
  • ( (Boolean) ) : (Boolean)
  • ( (Integer) ) : (Integer)
  • ( (EnumerationName) ) : (EnumerationName)
  • Substraction (Integer) : (Integer)
  • Addition (Integer) : (Integer)
  • If (Boolean) (void) : (void)
  • If (Boolean) (void) Else (void) : (void)
  • (Boolean) AssignmentOperator (Boolean) : (void)
  • (Integer) AssignmentOperator (Integer) : (void)
  • (EnumerationName) AssignmentOperator (EnumerationName) : (void)
  • { (void) } : (void)

Later iterations

  • To be implemented when scenarios work with the core data model according to re-evaluated needs.
  • If required, support real numbers and include support for multiplication and division.
  • If desired, support loops.
  • If desired, functions.
  • Arrays, more complex data structures.
  • DA: What about errors created by the underlying (Java) data types used (e.g., overflow)?
    • JK: Dynamic aspects (exceptions) will be handled at runtime.

Changes to metamodel

-- JasonKealey - 12 May 2006
Topic revision: r15 - 19 Sep 2006, JasonKealey
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback