hCM-0.1.0.0: Conceptual modelling support for Haskell

Copyright(c) Marek Suchánek 2017
LicenseMIT
Safe HaskellSafe
LanguageHaskell2010

CM.Metamodel

Description

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.

Synopsis

Documentation

type Identifier = String Source #

Type synonym for identifier use

class Show i => Identifiable i where Source #

Class encapsulating the identity principle

Methods

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

Minimal complete definition

toMeta

Methods

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

Minimal complete definition

cmodelElements

Methods

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

Minimal complete definition

entityAttributes

Methods

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

Minimal complete definition

relationshipParticipations

Methods

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 #

data MetaElement Source #

CMElement representation in meta level

Constructors

MetaEntity

Entity representation in meta level

MetaRelationship

Relationship representation in meta level

MetaModel

ConceptualModel representation in meta level

Instances

Eq MetaElement Source # 
Read MetaElement Source # 
Show MetaElement Source # 
Entity MetaElement Source # 
CMElement MetaElement Source # 
Identifiable MetaElement Source # 

metaElementName :: MetaElement -> String Source #

Get element name from any MetaElement