As.hs revision d658c27a8e2e75f11e83548631f759ced4ab7e74
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett{- |
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettModule : $Header$
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettDescription : abstract CSMOF syntax
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettCopyright : (c) Daniel Calegari Universidad de la Republica, Uruguay 2013
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettLicense : GPLv2 or higher, see LICENSE.txt
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettMaintainer : dcalegar@fing.edu.uy
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettStability : provisional
020cdb5dad6b871aba61136a0e1567c00426de87Andy GimblettPortability : portable
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-}
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettmodule CSMOF.As where
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettimport Common.Id
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-- Simplified MOF Metamodel
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata Metamodel = Metamodel
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett { metamodelName :: String
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett , element :: [NamedElement]
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett , model :: [Model]
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett } deriving (Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettinstance GetRange Metamodel where
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett getRange _ = nullRange
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett rangeSpan _ = []
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata NamedElement = NamedElement
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett { namedElementName :: String
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett , namedElementOwner :: Metamodel
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett , namedElementSubClasses :: TypeOrTypedElement
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett } deriving (Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettinstance GetRange NamedElement where
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett getRange _ = nullRange
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett rangeSpan _ = []
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata TypeOrTypedElement = TType { getType :: Type }
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett | TTypedElement { getTypeElement :: TypedElement }
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett deriving (Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettinstance GetRange TypeOrTypedElement where
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett getRange _ = nullRange
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett rangeSpan _ = []
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-- When going downside-up, we can sort the auxiliary class TypeOrTypedElement and make super of type NamedElement
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata Type = Type { typeSuper :: NamedElement
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett , typeSubClasses :: DataTypeOrClass
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett } deriving (Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettinstance GetRange Type where
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett getRange _ = nullRange
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett rangeSpan _ = []
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata DataTypeOrClass = DDataType { getDataType :: DataType }
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett | DClass { getClass :: Class }
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett deriving (Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettinstance GetRange DataTypeOrClass where
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett getRange _ = nullRange
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett rangeSpan _ = []
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett-- When going downside-up, we can sort the auxiliary class DataTypeOrClass and make super of type Type
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblettdata DataType = DataType { classSuper :: Type } deriving (Eq, Ord)
020cdb5dad6b871aba61136a0e1567c00426de87Andy Gimblett
instance GetRange DataType where
getRange _ = nullRange
rangeSpan _ = []
-- When going downside-up, we can sort the auxiliary class DataTypeOrClass and make super of type Type
data Class = Class
{ classSuperType :: Type
, isAbstract :: Bool
, superClass :: [Class]
, ownedAttribute :: [Property]
} deriving (Eq, Ord)
instance GetRange Class where
getRange _ = nullRange
rangeSpan _ = []
-- When going downside-up, we can sort the auxiliary class TypeOrTypedElement and make super of type NamedElement
data TypedElement = TypedElement
{ typedElementSuper :: NamedElement
, typedElementType :: Type
, typedElementSubClasses :: Property
} deriving (Eq, Ord)
instance GetRange TypedElement where
getRange _ = nullRange
rangeSpan _ = []
data Property = Property
{ propertySuper :: TypedElement
, multiplicityElement :: MultiplicityElement
, opposite :: Maybe Property
, propertyClass :: Class
} deriving (Eq, Ord)
instance GetRange Property where
getRange _ = nullRange
rangeSpan _ = []
data MultiplicityElement = MultiplicityElement
{ lower :: Integer
, upper :: Integer
, multiplicityElementSubClasses :: Property
} deriving (Eq, Ord)
instance GetRange MultiplicityElement where
getRange _ = nullRange
rangeSpan _ = []
-- Model part of CSMOF
data Model = Model
{ modelName :: String
, object :: [Object]
, link :: [Link]
, modelType :: Metamodel
} deriving (Eq, Ord)
instance GetRange Model where
getRange _ = nullRange
rangeSpan _ = []
data Object = Object
{ objectName :: String
, objectType :: Type
, objectOwner :: Model
} deriving (Eq, Ord)
instance GetRange Object where
getRange _ = nullRange
rangeSpan _ = []
data Link = Link
{ linkType :: Property
, source :: Object
, target :: Object
, linkOwner :: Model
} deriving (Eq, Ord)
instance GetRange Link where
getRange _ = nullRange
rangeSpan _ = []