Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Modelling.CdOd.CD2Alloy.Transform
Description
This modules performs a Alloy code generation based on CD2Alloy in order to generate object diagrams based on (at least) one given class diagram using Alloy.
The whole transformation is based on the following paper https://git.rwth-aachen.de/monticore/publications-additional-material/blob/master/cd2alloy/CD2AlloyTranslationTR.pdf although a newer version of this document exists https://www.se-rwth.de/publications/CD2Alloy-A-Translation-of-Class-Diagrams-to-Alloy.pdf
Throughout this module there are references to figures of the former paper, indicating which part of the original work the previous value definition is representing.
Also to increase readability, some identifiers, predicates, etc. have been renamed opposed to the original work, these are:
Original: umlp2alloy ––– Here: cd2alloy Original: FName ––– Here: FieldName Original: fName ––– Here: fieldName Original: Obj ––– Here: Object Original: ObjUAttrib ––– Here: ObjectUpperAttribute Original: ObjLAttrib ––– Here: ObjectLowerAttribute Original: ObjLUAttrib ––– Here: ObjectLowerUpperAttribute
Furthermore refactorings have been made which inline Alloy functions, these are
...CompFieldNamesCD...
...CompositesCD...
...FieldNamesCD...
...SubsCD...
also the following Alloy predicates, have been inlined
ObjectFieldNames
ObjectLowerUpperAttribute
ObjectLowerAttribute
ObjectLowerUpper
ObjectLower
ObjectUpper
Composition
Synopsis
- data ExtendsAnd
- data LinguisticReuse
- = None
- | ExtendsAnd !ExtendsAnd
- data Parts = Parts {}
- combineParts :: Parts -> String
- createRunCommand :: String -> Maybe [String] -> Int -> ObjectConfig -> [Relationship a b] -> String
- mergeParts :: Parts -> Parts -> Parts
- overlappingLinksPredicates :: [Relationship String String] -> [(String, String)]
- transform :: LinguisticReuse -> Cd -> Maybe [String] -> [String] -> ObjectConfig -> ObjectProperties -> String -> String -> Parts
Documentation
data ExtendsAnd Source #
What further to reuse than extends
Constructors
NothingMore | i.e. only extends |
FieldPlacement | local field definition |
Instances
Show ExtendsAnd Source # | |
Defined in Modelling.CdOd.CD2Alloy.Transform Methods showsPrec :: Int -> ExtendsAnd -> ShowS # show :: ExtendsAnd -> String # showList :: [ExtendsAnd] -> ShowS # |
data LinguisticReuse Source #
To what degree, high-level Allow language features should be used in order to express relationships directly.
Expressiveness is increased when relying less on Alloy language features. Conciseness is increased when relying more on Alloy language features.
Constructors
None | not at all |
ExtendsAnd !ExtendsAnd | use extends for inheritance |
Instances
Show LinguisticReuse Source # | |
Defined in Modelling.CdOd.CD2Alloy.Transform Methods showsPrec :: Int -> LinguisticReuse -> ShowS # show :: LinguisticReuse -> String # showList :: [LinguisticReuse] -> ShowS # |
Parts belonging to the CD2Alloy Alloy program.
combineParts :: Parts -> String Source #
Transforms Parts
into an Alloy program (besides the run command).
(See createRunCommand
for the latter)
Arguments
:: String | |
-> Maybe [String] | if provided, object limit will be defined as constraint rather than
by scope (by scope should be preferred, but is not possible for
|
-> Int | |
-> ObjectConfig | |
-> [Relationship a b] | |
-> String |
Creates an Alloy run command line taking provided size constraints into account.
mergeParts :: Parts -> Parts -> Parts Source #
Merges Alloy code Parts
for multiple class diagrams
to be used in a single Alloy query.
overlappingLinksPredicates :: [Relationship String String] -> [(String, String)] Source #
Generates a predicate for each non-inheritance relationship - relationship name combination (except its actual) this can be used to prevent or force overlapping links (i.e. that could match to two relationships) in order to steer difficulty.
The function returns a list of both, the predicates names as well as the predicates themselves.
Arguments
:: LinguisticReuse | the degree of linguistic reuse to apply during the translation |
-> Cd | the class diagram for which to generate the code |
-> Maybe [String] | all relationship names to consider (possibly across multiple class diagrams; if not provided, they will be taken from the provided class diagram) |
-> [String] | the list of abstract class names |
-> ObjectConfig | size constraints on the object diagrams |
-> ObjectProperties | structural constraints for the object diagrams |
-> String | an identifier for the class diagram |
-> String | a time stamp |
-> Parts |
Generates Alloy code to generate object diagrams for a given class diagram. The given class diagram must be valid otherwise the code generation might not terminate.
The resulting code is split into parts which allows for recombination with the generated Alloy code for other (similar) class diagrams.
(See mergeParts
, combineParts
and createRunCommand
)