Copyright | (c) Marek Suchánek 2017 |
---|---|
License | MIT |
Safe Haskell | Safe |
Language | Haskell2010 |
Metamodel used to create actual models within system provides simple way for compiler-driven modelling without restricting usage of various Haskell constructs of structure and behavior coding.
- type Identifier = String
- class Show i => Identifiable i where
- class (Show e, Read e) => CMElement e where
- class CMElement a => ConceptualModel a where
- class (CMElement a, Identifiable a) => Entity a where
- class (CMElement a, Identifiable a) => Relationship a where
- data ParticipationQuantity
- data ParticipationType
- data MetaAttribute = MetaAttribute {}
- data MetaParticipation = MetaParticipation {}
- data MetaElement
- = MetaEntity {
- meName :: String
- meIdentifier :: String
- meAttributes :: [MetaAttribute]
- meValid :: Bool
- meSuperNames :: [String]
- meSubNames :: [String]
- | MetaRelationship { }
- | MetaModel {
- mmName :: Maybe String
- mmIdentifier :: Maybe String
- mmElements :: [MetaElement]
- mmValid :: Bool
- = MetaEntity {
- metaElementName :: MetaElement -> String
- metaElementIdentifier :: MetaElement -> String
- metaElementValid :: MetaElement -> Bool
- tupleToAttribute :: (String, String, String) -> MetaAttribute
- tupleToParticipation :: (String, String, String, ParticipationType) -> MetaParticipation
Documentation
type Identifier = String Source #
Type synonym for identifier use
class Show i => Identifiable i where Source #
Class encapsulating the identity principle
identifier :: i -> Identifier Source #
Get identifier of element (default: show)
identic :: i -> i -> Bool Source #
Check if two elements are identic
class (Show e, Read e) => CMElement e where Source #
Generic element of conceptual model
simpleConstraints :: [e -> Validity] Source #
List of simple contraints (no need to know its model)
complexConstaints :: ConceptualModel m => [m -> e -> Validity] Source #
List of complex (model-aware) contraints
constraints :: ConceptualModel m => m -> [e -> Validity] Source #
List of all contraints (default: simple + complex)
evalConstraints :: ConceptualModel m => m -> e -> [Validity] Source #
Evaluate all contraints and get list of Validity
as result
valid :: ConceptualModel m => m -> e -> Bool Source #
Check if element is valid (conforms all constraints)
violations :: ConceptualModel m => m -> e -> [String] Source #
Get list of all constraints violations (empty list if valid)
elementName :: e -> String Source #
Name of element type (default is derived by show
)
toMeta :: ConceptualModel m => m -> e -> MetaElement Source #
Convert element to MetaElement
(recommended: use functions from subclasses)
fromMeta :: e -> MetaElement -> Maybe e Source #
Optional function from converting back from MetaElement
class CMElement a => ConceptualModel a where Source #
Whole conceptual model class
cmodelElements :: a -> [MetaElement] Source #
Get all elements of the model
validModel :: a -> Bool Source #
Check whether all elements in model are valid and is valid itself
cmodelName :: a -> String Source #
Name of model type (default: elementName
)
toMetaModel :: ConceptualModel b => b -> a -> MetaElement Source #
Convert to MetaModel
with use of cmodelName
and cmodelElements
class (CMElement a, Identifiable a) => Entity a where Source #
Entities for representing concepts
entityAttributes :: a -> [MetaAttribute] Source #
Get all attributes of the entity
entityName :: a -> String Source #
Name of entity type (default: elementName
)
entitySuperNames :: a -> [String] Source #
Name of supertypes (default: '[]')
entitySubNames :: a -> [String] Source #
Names of subtypes (default: '[]')
toMetaEntity :: ConceptualModel m => m -> a -> MetaElement Source #
Convert to MetaEntity
with use of entityName
, entityAttributes
and others
class (CMElement a, Identifiable a) => Relationship a where Source #
Relationship that connects multiple entities
relationshipParticipations :: a -> [MetaParticipation] Source #
Get all participations in the relationship
relationshipName :: a -> String Source #
Name of relationship type (default: elementName
)
toMetaRelationship :: ConceptualModel m => m -> a -> MetaElement Source #
Convert to MetaRelationship
with use of relationshipName
and relationshipParticipations
data ParticipationQuantity Source #
Quantity of participation type
data ParticipationType Source #
Type of participation (i.e. multiplicity)
Mandatory ParticipationQuantity | Type for mandatory relationship (1..N) |
Optional ParticipationQuantity | Type for optional relationship (0..N) |
Custom ParticipationQuantity ParticipationQuantity | Type for custom relationship (X..Y) |
data MetaAttribute Source #
Attribute representation in meta level
data MetaParticipation Source #
Participation representation in meta level
data MetaElement Source #
CMElement
representation in meta level
MetaEntity |
|
| |
MetaRelationship |
|
| |
MetaModel |
|
|
metaElementName :: MetaElement -> String Source #
Get element name from any MetaElement
metaElementIdentifier :: MetaElement -> String Source #
Get identifier from any MetaElement
metaElementValid :: MetaElement -> Bool Source #
Check if any MetaElement
is valid
tupleToAttribute :: (String, String, String) -> MetaAttribute Source #
Convert tuple to MetaAttribute
tupleToParticipation :: (String, String, String, ParticipationType) -> MetaParticipation Source #
Convert tuple to MetaParticipation