You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Split OCL Grammar and Add Support for Invariants and Derived Attributes (#4451)
* Splitting the OCL grammar from UML-RSDS tool
* Updating the desc.xml file and the examples
* Fix derived attribute parsing with qualified_name context rule
* Adding a new example to test derived attributes
* desc.xml fixed according to path patterns allowed
Based on the OCL 2.4 definition https://www.omg.org/spec/OCL/2.4/PDF but with a more consistent use of the arrow operators ->op: these are almost always used for operations on non-primitive types (strings, collections, functions, maps). Thus str.isMatch(patt) is written as str->isMatch(patt) for strings str, patt.
3
+
This repository provides grammars for the Object Constraint Language (OCL) 2.4, along with its integration with UML-RSDS, a tool supporting UML 2.5 class diagram notation and OCL 2.4. These grammars aim to enhance the precision and usability of OCL while making it easier to integrate with UML modeling tools.
4
4
5
-
One exception to this rule is string addition: s1 + s2
5
+
## Overview
6
6
7
-
Boolean and numeric operators are written with infix or prefix notation as usual, thus:
7
+
The repository is structured around one main grammar: OCL. However, it has been split into two files to separate the core OCL grammar from the UML-RSDS specification tool that also includes UML. The separation makes it easier to use and understand the grammars while still allowing their combined use when needed.
8
8
9
+
### Key Features
10
+
11
+
-**OCL Core Grammar (`OCL.g4`)**: This file contains the core OCL 2.4 grammar, providing a consistent and robust foundation for working with OCL expressions.
12
+
-**UML-RSDS Grammar (`UMLRSDS.g4`)**: This file integrates the OCL core grammar with UML-RSDS, enabling the specification of UML models using OCL expressions.
13
+
14
+
These grammars are designed to support the consistent use of the arrow operator (`->`) for operations on non-primitive types (e.g., strings, collections, functions, maps). For example:
15
+
16
+
-`str->isMatch(patt)` (for strings `str` and `patt`)
17
+
18
+
However, string concatenation remains an exception to this rule:
19
+
20
+
-`s1 + s2`
21
+
22
+
Boolean and numeric operators retain their traditional infix or prefix notations:
23
+
24
+
```ocl
9
25
a xor b
26
+
a * bm div netc.
27
+
```
28
+
29
+
### Composition
30
+
31
+
Using OCL without a tool grammar to specify the UML model is often impractical. While the grammars are modular, they are designed to work seamlessly together:
10
32
11
-
a * b
33
+
-`OCL.g4` provides the foundation for OCL expressions.
34
+
-`UMLRSDS.g4` integrates the core OCL grammar to enable UML modeling.
12
35
13
-
m div n
36
+
The repository’s structure ensures flexibility, allowing users to utilize either grammar independently or together, depending on their needs.
14
37
15
-
etc.
38
+
### Future Contributions
16
39
40
+
This repository currently focuses on the OCL core and UML-RSDS grammars. In the future, there is potential to include grammars from other tools, such as USE-OCL, to further expand the repository’s utility and scope.
0 commit comments