modelling-tasks-0.0.0.1
Safe HaskellSafe-Inferred
LanguageHaskell2010

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

Documentation

data ExtendsAnd Source #

What further to reuse than extends

Constructors

NothingMore

i.e. only extends

FieldPlacement

local field definition

Instances

Instances details
Show ExtendsAnd Source # 
Instance details

Defined in Modelling.CdOd.CD2Alloy.Transform

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

Instances details
Show LinguisticReuse Source # 
Instance details

Defined in Modelling.CdOd.CD2Alloy.Transform

data Parts Source #

Parts belonging to the CD2Alloy Alloy program.

Constructors

Parts 

Fields

combineParts :: Parts -> String Source #

Transforms Parts into an Alloy program (besides the run command).

(See createRunCommand for the latter)

createRunCommand Source #

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 ExtendsAnd FieldPlacement)

-> 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.

transform Source #

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)