∀x.Number(x)∧Prime(x)∧LessThan(x,3)⇒Even(x)
A tool along these lines for OCL is OCLNL. Given this OCL as input:
context Copy
inv: Copy.allInstances()->forAll(c1,c2
not (c1=c2) implies not (c1.barCode=c2.barCode))
The verbalization computed by OCLNL is:
for the class Copy the following invariants hold :
if it is not the case that c1 is equal to c2 then this implies that it is not the case that the bar code of c1 is equal to the bar code of c2 |
Two different copies have different bar codes
In a way, that's not playing fair, because covering just some such patterns from all those that may show up in valid OCL ASTs does not get the full job done. Still, it's interesting if you want to try your hand at processing OCL ASTs ... which brings me to the real plunge I wanted to make: take a look at my article on that very subject, How to process OCL Abstract Syntax Trees , and its accompanying Eclipse-based plugin. With it, you can do cool stuff such as:
'nuff said! Actually a big advantage of turning a formal spec into controlled natural language is the larger audience that can review it (and thus find errors). This aspect is highlighted in David Burke's master thesis, an excerpt follows:
May be it's just me, but I think it would be great if someone took up the task of performing similar OCL AST processing for Eclipse!
Keine Kommentare:
Kommentar veröffentlichen