Tiefes Renaming von rep_ocl.
git-svn-id: https://projects.brucker.ch/su4sml/svn/infsec-import/trunk/src/su4sml@3037 3260e6d1-4efc-4170-b0a7-36055960796d
This commit is contained in:
parent
6faecbf088
commit
ddc36ea5e8
|
@ -25,7 +25,7 @@
|
||||||
signature REP =
|
signature REP =
|
||||||
sig
|
sig
|
||||||
|
|
||||||
include MDR_CORE
|
include REP_CORE
|
||||||
include REP_ACTIVITY_GRAPH
|
include REP_ACTIVITY_GRAPH
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
structure Rep : REP =
|
structure Rep : REP =
|
||||||
struct
|
struct
|
||||||
|
|
||||||
open mdr_core Rep_StateMachine Rep_ActivityGraph
|
open Rep_Core Rep_StateMachine Rep_ActivityGraph
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -22,18 +22,18 @@
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
******************************************************************************)
|
******************************************************************************)
|
||||||
|
|
||||||
signature MDR_CORE =
|
signature REP_CORE =
|
||||||
sig
|
sig
|
||||||
type operation = { name : string,
|
type operation = { name : string,
|
||||||
precondition : (string option * ocl_term.OclTerm) list,
|
precondition : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
postcondition : (string option * ocl_term.OclTerm) list,
|
postcondition : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
arguments : (string * ocl_type.OclType) list,
|
arguments : (string * Rep_OclType.OclType) list,
|
||||||
result : ocl_type.OclType,
|
result : Rep_OclType.OclType,
|
||||||
isQuery : bool
|
isQuery : bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type associationend = {name : string,
|
type associationend = {name : string,
|
||||||
aend_type : ocl_type.OclType,
|
aend_type : Rep_OclType.OclType,
|
||||||
multiplicity: (int * int) list,
|
multiplicity: (int * int) list,
|
||||||
ordered: bool
|
ordered: bool
|
||||||
}
|
}
|
||||||
|
@ -41,43 +41,43 @@ type associationend = {name : string,
|
||||||
|
|
||||||
datatype Classifier =
|
datatype Classifier =
|
||||||
Class of
|
Class of
|
||||||
{ name : ocl_type.Path,
|
{ name : Rep_OclType.Path,
|
||||||
parent : ocl_type.Path option,
|
parent : Rep_OclType.Path option,
|
||||||
attributes : (string * ocl_type.OclType) list,
|
attributes : (string * Rep_OclType.OclType) list,
|
||||||
operations : operation list,
|
operations : operation list,
|
||||||
associationends : associationend list,
|
associationends : associationend list,
|
||||||
invariant : (string option * ocl_term.OclTerm) list,
|
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
stereotypes : string list,
|
stereotypes : string list,
|
||||||
interfaces : ocl_type.Path list,
|
interfaces : Rep_OclType.Path list,
|
||||||
thyname : string option,
|
thyname : string option,
|
||||||
activity_graphs : Rep_ActivityGraph.ActivityGraph list
|
activity_graphs : Rep_ActivityGraph.ActivityGraph list
|
||||||
}
|
}
|
||||||
| Interface of (* not supported yet *)
|
| Interface of (* not supported yet *)
|
||||||
{ name : ocl_type.Path,
|
{ name : Rep_OclType.Path,
|
||||||
parents : ocl_type.Path list,
|
parents : Rep_OclType.Path list,
|
||||||
operations : operation list,
|
operations : operation list,
|
||||||
stereotypes : string list,
|
stereotypes : string list,
|
||||||
invariant : (string option * ocl_term.OclTerm) list,
|
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
thyname : string option
|
thyname : string option
|
||||||
}
|
}
|
||||||
| Enumeration of (* not really supported yet? *)
|
| Enumeration of (* not really supported yet? *)
|
||||||
{ name : ocl_type.Path,
|
{ name : Rep_OclType.Path,
|
||||||
parent : ocl_type.Path option,
|
parent : Rep_OclType.Path option,
|
||||||
operations : operation list,
|
operations : operation list,
|
||||||
literals : string list,
|
literals : string list,
|
||||||
invariant : (string option * ocl_term.OclTerm) list,
|
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
stereotypes : string list,
|
stereotypes : string list,
|
||||||
interfaces : ocl_type.Path list,
|
interfaces : Rep_OclType.Path list,
|
||||||
thyname : string option
|
thyname : string option
|
||||||
}
|
}
|
||||||
| Primitive of (* not really supported yet *)
|
| Primitive of (* not really supported yet *)
|
||||||
{ name : ocl_type.Path,
|
{ name : Rep_OclType.Path,
|
||||||
parent : ocl_type.Path option,
|
parent : Rep_OclType.Path option,
|
||||||
operations : operation list,
|
operations : operation list,
|
||||||
associationends : associationend list,
|
associationends : associationend list,
|
||||||
invariant : (string option * ocl_term.OclTerm) list,
|
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
stereotypes : string list,
|
stereotypes : string list,
|
||||||
interfaces : ocl_type.Path list,
|
interfaces : Rep_OclType.Path list,
|
||||||
thyname : string option
|
thyname : string option
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,25 +85,25 @@ val OclAnyC : Classifier
|
||||||
|
|
||||||
val normalize : Classifier -> Classifier
|
val normalize : Classifier -> Classifier
|
||||||
|
|
||||||
val name_of : Classifier -> ocl_type.Path
|
val name_of : Classifier -> Rep_OclType.Path
|
||||||
val package_of : Classifier -> ocl_type.Path
|
val package_of : Classifier -> Rep_OclType.Path
|
||||||
val short_name_of : Classifier -> string
|
val short_name_of : Classifier -> string
|
||||||
|
|
||||||
val parent_name_of : Classifier -> ocl_type.Path
|
val parent_name_of : Classifier -> Rep_OclType.Path
|
||||||
val parent_package_of : Classifier -> ocl_type.Path
|
val parent_package_of : Classifier -> Rep_OclType.Path
|
||||||
val short_parent_name_of : Classifier -> string
|
val short_parent_name_of : Classifier -> string
|
||||||
|
|
||||||
val thy_name_of : Classifier -> string
|
val thy_name_of : Classifier -> string
|
||||||
val update_thyname : string -> Classifier -> Classifier
|
val update_thyname : string -> Classifier -> Classifier
|
||||||
val attributes_of : Classifier -> (string * ocl_type.OclType) list
|
val attributes_of : Classifier -> (string * Rep_OclType.OclType) list
|
||||||
val operations_of : Classifier -> operation list
|
val operations_of : Classifier -> operation list
|
||||||
val invariant_of : Classifier -> (string option * ocl_term.OclTerm) list
|
val invariant_of : Classifier -> (string option * Rep_OclTerm.OclTerm) list
|
||||||
val string_of_path : string list -> string
|
val string_of_path : string list -> string
|
||||||
|
|
||||||
val arguments_of_op : operation -> (string * ocl_type.OclType) list
|
val arguments_of_op : operation -> (string * Rep_OclType.OclType) list
|
||||||
val precondition_of_op : operation -> (string option * ocl_term.OclTerm) list
|
val precondition_of_op : operation -> (string option * Rep_OclTerm.OclTerm) list
|
||||||
val result_of_op : operation -> ocl_type.OclType
|
val result_of_op : operation -> Rep_OclType.OclType
|
||||||
val postcondition_of_op : operation -> (string option * ocl_term.OclTerm) list
|
val postcondition_of_op : operation -> (string option * Rep_OclTerm.OclTerm) list
|
||||||
val name_of_op : operation -> string
|
val name_of_op : operation -> string
|
||||||
val mangled_name_of_op : operation -> string
|
val mangled_name_of_op : operation -> string
|
||||||
|
|
||||||
|
|
|
@ -22,66 +22,66 @@
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
******************************************************************************)
|
******************************************************************************)
|
||||||
|
|
||||||
structure mdr_core : MDR_CORE =
|
structure Rep_Core : REP_CORE =
|
||||||
struct
|
struct
|
||||||
type operation = { name : string,
|
type operation = { name : string,
|
||||||
precondition : (string option * ocl_term.OclTerm) list,
|
precondition : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
postcondition : (string option * ocl_term.OclTerm) list,
|
postcondition : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
arguments : (string * ocl_type.OclType) list,
|
arguments : (string * Rep_OclType.OclType) list,
|
||||||
result : ocl_type.OclType,
|
result : Rep_OclType.OclType,
|
||||||
isQuery : bool }
|
isQuery : bool }
|
||||||
|
|
||||||
type associationend = {name : string,
|
type associationend = {name : string,
|
||||||
aend_type: ocl_type.OclType,
|
aend_type: Rep_OclType.OclType,
|
||||||
multiplicity: (int*int) list,
|
multiplicity: (int*int) list,
|
||||||
ordered: bool }
|
ordered: bool }
|
||||||
|
|
||||||
datatype Classifier =
|
datatype Classifier =
|
||||||
Class of
|
Class of
|
||||||
{ name : ocl_type.Path,
|
{ name : Rep_OclType.Path,
|
||||||
parent : ocl_type.Path option,
|
parent : Rep_OclType.Path option,
|
||||||
attributes : (string * ocl_type.OclType) list,
|
attributes : (string * Rep_OclType.OclType) list,
|
||||||
operations : operation list,
|
operations : operation list,
|
||||||
associationends : associationend list,
|
associationends : associationend list,
|
||||||
invariant : (string option * ocl_term.OclTerm) list,
|
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
stereotypes : string list,
|
stereotypes : string list,
|
||||||
interfaces : ocl_type.Path list,
|
interfaces : Rep_OclType.Path list,
|
||||||
thyname : string option,
|
thyname : string option,
|
||||||
activity_graphs : Rep_ActivityGraph.ActivityGraph list
|
activity_graphs : Rep_ActivityGraph.ActivityGraph list
|
||||||
}
|
}
|
||||||
| Interface of (* not supported yet *)
|
| Interface of (* not supported yet *)
|
||||||
{ name : ocl_type.Path,
|
{ name : Rep_OclType.Path,
|
||||||
parents : ocl_type.Path list,
|
parents : Rep_OclType.Path list,
|
||||||
operations : operation list,
|
operations : operation list,
|
||||||
stereotypes : string list,
|
stereotypes : string list,
|
||||||
invariant : (string option * ocl_term.OclTerm) list,
|
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
thyname : string option
|
thyname : string option
|
||||||
}
|
}
|
||||||
| Enumeration of (* not really supported yet? *)
|
| Enumeration of (* not really supported yet? *)
|
||||||
{ name : ocl_type.Path,
|
{ name : Rep_OclType.Path,
|
||||||
parent : ocl_type.Path option,
|
parent : Rep_OclType.Path option,
|
||||||
operations : operation list,
|
operations : operation list,
|
||||||
literals : string list,
|
literals : string list,
|
||||||
invariant : (string option * ocl_term.OclTerm) list,
|
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
stereotypes : string list,
|
stereotypes : string list,
|
||||||
interfaces : ocl_type.Path list,
|
interfaces : Rep_OclType.Path list,
|
||||||
thyname : string option
|
thyname : string option
|
||||||
}
|
}
|
||||||
| Primitive of (* not really supported yet *)
|
| Primitive of (* not really supported yet *)
|
||||||
{ name : ocl_type.Path,
|
{ name : Rep_OclType.Path,
|
||||||
parent : ocl_type.Path option,
|
parent : Rep_OclType.Path option,
|
||||||
operations : operation list,
|
operations : operation list,
|
||||||
associationends : associationend list,
|
associationends : associationend list,
|
||||||
invariant : (string option * ocl_term.OclTerm) list,
|
invariant : (string option * Rep_OclTerm.OclTerm) list,
|
||||||
stereotypes : string list,
|
stereotypes : string list,
|
||||||
interfaces : ocl_type.Path list,
|
interfaces : Rep_OclType.Path list,
|
||||||
thyname : string option
|
thyname : string option
|
||||||
}
|
}
|
||||||
|
|
||||||
(* convert an association end into the corresponding collection type *)
|
(* convert an association end into the corresponding collection type *)
|
||||||
fun assoc_to_attr_type {name,aend_type,multiplicity,ordered} =
|
fun assoc_to_attr_type {name,aend_type,multiplicity,ordered} =
|
||||||
if ordered then ocl_type.Sequence aend_type (* OrderedSet? *)
|
if ordered then Rep_OclType.Sequence aend_type (* OrderedSet? *)
|
||||||
else ocl_type.Set aend_type
|
else Rep_OclType.Set aend_type
|
||||||
|
|
||||||
(* convert an association end into an attribute of the *)
|
(* convert an association end into an attribute of the *)
|
||||||
(* corresponding collection type *)
|
(* corresponding collection type *)
|
||||||
|
@ -90,36 +90,36 @@ fun assoc_to_attr (assoc:associationend) = (#name assoc,assoc_to_attr_type assoc
|
||||||
(* convert a multiplicity range into an invariant of the form *)
|
(* convert a multiplicity range into an invariant of the form *)
|
||||||
(* size > lowerBound and size < upperBound ) *)
|
(* size > lowerBound and size < upperBound ) *)
|
||||||
fun range_to_inv cls_name aend (a,b) =
|
fun range_to_inv cls_name aend (a,b) =
|
||||||
let val cls = ocl_type.Classifier cls_name
|
let val cls = Rep_OclType.Classifier cls_name
|
||||||
val attr_type = assoc_to_attr_type aend
|
val attr_type = assoc_to_attr_type aend
|
||||||
val attr_name = cls_name@[#name aend]
|
val attr_name = cls_name@[#name aend]
|
||||||
val literal_a = ocl_term.Literal (Int.toString a, ocl_type.Integer)
|
val literal_a = Rep_OclTerm.Literal (Int.toString a, Rep_OclType.Integer)
|
||||||
val literal_b = ocl_term.Literal (Int.toString b, ocl_type.Integer)
|
val literal_b = Rep_OclTerm.Literal (Int.toString b, Rep_OclType.Integer)
|
||||||
val self = ocl_term.Variable ("self",cls)
|
val self = Rep_OclTerm.Variable ("self",cls)
|
||||||
val attribute = ocl_term.AttributeCall (self,cls,attr_name,attr_type)
|
val attribute = Rep_OclTerm.AttributeCall (self,cls,attr_name,attr_type)
|
||||||
val attribute_size =
|
val attribute_size =
|
||||||
ocl_term.OperationCall (attribute,attr_type,
|
Rep_OclTerm.OperationCall (attribute,attr_type,
|
||||||
["oclLib","Collection","size"],[],
|
["oclLib","Collection","size"],[],
|
||||||
ocl_type.Integer)
|
Rep_OclType.Integer)
|
||||||
val lower_bound =
|
val lower_bound =
|
||||||
ocl_term.OperationCall (attribute_size,ocl_type.Integer,
|
Rep_OclTerm.OperationCall (attribute_size,Rep_OclType.Integer,
|
||||||
["oclLib","Real",">="],
|
["oclLib","Real",">="],
|
||||||
[(literal_a,ocl_type.Integer)],ocl_type.Boolean)
|
[(literal_a,Rep_OclType.Integer)],Rep_OclType.Boolean)
|
||||||
val upper_bound =
|
val upper_bound =
|
||||||
ocl_term.OperationCall (attribute_size,ocl_type.Integer,
|
Rep_OclTerm.OperationCall (attribute_size,Rep_OclType.Integer,
|
||||||
["oclLib","Real","<="],
|
["oclLib","Real","<="],
|
||||||
[(literal_b,ocl_type.Integer)],ocl_type.Boolean)
|
[(literal_b,Rep_OclType.Integer)],Rep_OclType.Boolean)
|
||||||
val equal =
|
val equal =
|
||||||
ocl_term.OperationCall (attribute_size,ocl_type.Integer,
|
Rep_OclTerm.OperationCall (attribute_size,Rep_OclType.Integer,
|
||||||
["oclLib","OclAny","="],
|
["oclLib","OclAny","="],
|
||||||
[(literal_a,ocl_type.Integer)],ocl_type.Boolean)
|
[(literal_a,Rep_OclType.Integer)],Rep_OclType.Boolean)
|
||||||
in
|
in
|
||||||
if a = b then equal
|
if a = b then equal
|
||||||
else if b = ~1 then lower_bound
|
else if b = ~1 then lower_bound
|
||||||
else ocl_term.OperationCall (lower_bound,ocl_type.Boolean,
|
else Rep_OclTerm.OperationCall (lower_bound,Rep_OclType.Boolean,
|
||||||
["oclLib","Boolean","and"],
|
["oclLib","Boolean","and"],
|
||||||
[(upper_bound,ocl_type.Boolean)],
|
[(upper_bound,Rep_OclType.Boolean)],
|
||||||
ocl_type.Boolean)
|
Rep_OclType.Boolean)
|
||||||
end
|
end
|
||||||
|
|
||||||
(* calculate the invariants of an association end: *)
|
(* calculate the invariants of an association end: *)
|
||||||
|
@ -132,11 +132,11 @@ fun assoc_to_inv cls_name (aend:associationend) =
|
||||||
val range_constraints = map (range_to_inv cls_name aend)
|
val range_constraints = map (range_to_inv cls_name aend)
|
||||||
(#multiplicity aend)
|
(#multiplicity aend)
|
||||||
fun ocl_or (x,y) =
|
fun ocl_or (x,y) =
|
||||||
ocl_term.OperationCall (x,ocl_type.Boolean,
|
Rep_OclTerm.OperationCall (x,Rep_OclType.Boolean,
|
||||||
["oclLib","Boolean","or"],
|
["oclLib","Boolean","or"],
|
||||||
[(y,ocl_type.Boolean)],ocl_type.Boolean)
|
[(y,Rep_OclType.Boolean)],Rep_OclType.Boolean)
|
||||||
in if range_constraints = []
|
in if range_constraints = []
|
||||||
then (SOME inv_name, ocl_term.Literal ("true",ocl_type.Boolean))
|
then (SOME inv_name, Rep_OclTerm.Literal ("true",Rep_OclType.Boolean))
|
||||||
else (SOME inv_name, foldr1 ocl_or range_constraints)
|
else (SOME inv_name, foldr1 ocl_or range_constraints)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ val OclAnyC = Class{name=["OclAny"],parent=NONE,attributes=[],
|
||||||
activity_graphs=nil}
|
activity_graphs=nil}
|
||||||
|
|
||||||
|
|
||||||
fun string_of_path (path:ocl_type.Path) = case path of
|
fun string_of_path (path:Rep_OclType.Path) = case path of
|
||||||
[] => ""
|
[] => ""
|
||||||
| p => foldr1 (fn (a,b) => a^"."^b) p
|
| p => foldr1 (fn (a,b) => a^"."^b) p
|
||||||
|
|
||||||
|
@ -299,27 +299,27 @@ fun p_invariant_of (Class{invariant,...}) = invariant
|
||||||
| p_invariant_of (Primitive{invariant,...}) = invariant
|
| p_invariant_of (Primitive{invariant,...}) = invariant
|
||||||
|
|
||||||
fun invariant_of C = case p_invariant_of C of
|
fun invariant_of C = case p_invariant_of C of
|
||||||
[] => [(NONE, ocl_term.Literal ("true",ocl_type.Boolean))]
|
[] => [(NONE, Rep_OclTerm.Literal ("true",Rep_OclType.Boolean))]
|
||||||
| il => il
|
| il => il
|
||||||
|
|
||||||
|
|
||||||
fun precondition_of_op ({precondition,...}:operation) = case precondition of
|
fun precondition_of_op ({precondition,...}:operation) = case precondition of
|
||||||
[] => [(NONE, ocl_term.Literal ("true",ocl_type.Boolean))]
|
[] => [(NONE, Rep_OclTerm.Literal ("true",Rep_OclType.Boolean))]
|
||||||
| il => il
|
| il => il
|
||||||
|
|
||||||
|
|
||||||
fun postcondition_of_op ({postcondition, ...}:operation) = case postcondition of
|
fun postcondition_of_op ({postcondition, ...}:operation) = case postcondition of
|
||||||
[] => [(NONE, ocl_term.Literal ("true",ocl_type.Boolean))]
|
[] => [(NONE, Rep_OclTerm.Literal ("true",Rep_OclType.Boolean))]
|
||||||
| il => il
|
| il => il
|
||||||
|
|
||||||
fun name_of_op ({name,...}:operation) = name
|
fun name_of_op ({name,...}:operation) = name
|
||||||
|
|
||||||
fun mangled_name_of_op ({name,arguments,result,...}:operation) =
|
fun mangled_name_of_op ({name,arguments,result,...}:operation) =
|
||||||
let
|
let
|
||||||
val arg_typestrs = map (fn a => (ocl_type.string_of_OclType o snd ) a ) arguments
|
val arg_typestrs = map (fn a => (Rep_OclType.string_of_OclType o snd ) a ) arguments
|
||||||
in
|
in
|
||||||
foldr1 (fn (a,b) =>(a^"_"^b))
|
foldr1 (fn (a,b) =>(a^"_"^b))
|
||||||
((name::arg_typestrs)@[ocl_type.string_of_OclType result])
|
((name::arg_typestrs)@[Rep_OclType.string_of_OclType result])
|
||||||
end
|
end
|
||||||
|
|
||||||
fun result_of_op ({result,...}:operation) = result
|
fun result_of_op ({result,...}:operation) = result
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
******************************************************************************)
|
******************************************************************************)
|
||||||
|
|
||||||
signature OCL_TYPE =
|
signature REP_OCL_TYPE =
|
||||||
sig
|
sig
|
||||||
|
|
||||||
type Path = string list
|
type Path = string list
|
||||||
|
@ -38,9 +38,9 @@ sig
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
signature OCL_TERM =
|
signature REP_OCL_TERM =
|
||||||
sig
|
sig
|
||||||
include OCL_TYPE
|
include REP_OCL_TYPE
|
||||||
|
|
||||||
datatype OclTerm =
|
datatype OclTerm =
|
||||||
Literal of string * OclType
|
Literal of string * OclType
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
******************************************************************************)
|
******************************************************************************)
|
||||||
|
|
||||||
structure ocl_type : OCL_TYPE =
|
structure Rep_OclType : REP_OCL_TYPE =
|
||||||
struct
|
struct
|
||||||
|
|
||||||
type Path = string list
|
type Path = string list
|
||||||
|
@ -56,9 +56,9 @@ fun string_of_OclType Integer = "Integer"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
structure ocl_term : OCL_TERM =
|
structure Rep_OclTerm : REP_OCL_TERM =
|
||||||
struct
|
struct
|
||||||
open ocl_type
|
open Rep_OclType
|
||||||
|
|
||||||
datatype OclTerm =
|
datatype OclTerm =
|
||||||
Literal of string * OclType
|
Literal of string * OclType
|
||||||
|
|
|
@ -41,9 +41,9 @@ datatype Action = create
|
||||||
datatype StateMachine = SM_mk of {top : StateVertex_Id,
|
datatype StateMachine = SM_mk of {top : StateVertex_Id,
|
||||||
transition : Transition_Id list}
|
transition : Transition_Id list}
|
||||||
|
|
||||||
datatype Guard = G_mk of {expression : ocl_term.OclTerm}
|
datatype Guard = G_mk of {expression : Rep_OclTerm.OclTerm}
|
||||||
|
|
||||||
type Parameter = ocl_type.OclType
|
type Parameter = Rep_OclType.OclType
|
||||||
|
|
||||||
datatype Event = SignalEvent of Parameter list
|
datatype Event = SignalEvent of Parameter list
|
||||||
| CallEvent of Parameter list
|
| CallEvent of Parameter list
|
||||||
|
@ -86,7 +86,7 @@ datatype StateVertex =
|
||||||
| SimpleState_ObjectflowState (* from ActivityGraphs *)
|
| SimpleState_ObjectflowState (* from ActivityGraphs *)
|
||||||
of {isSynch : bool,
|
of {isSynch : bool,
|
||||||
parameter : Parameter list,
|
parameter : Parameter list,
|
||||||
types : ocl_type.Path list (* Classifier_Id *)}
|
types : Rep_OclType.Path list (* Classifier_Id *)}
|
||||||
| State_FinalState
|
| State_FinalState
|
||||||
of {outgoing : Transition_Id list,
|
of {outgoing : Transition_Id list,
|
||||||
incoming : Transition_Id list,
|
incoming : Transition_Id list,
|
||||||
|
|
|
@ -41,9 +41,9 @@ datatype Action = create
|
||||||
datatype StateMachine = SM_mk of {top : StateVertex_Id,
|
datatype StateMachine = SM_mk of {top : StateVertex_Id,
|
||||||
transition : Transition_Id list}
|
transition : Transition_Id list}
|
||||||
|
|
||||||
datatype Guard = G_mk of {expression : ocl_term.OclTerm}
|
datatype Guard = G_mk of {expression : Rep_OclTerm.OclTerm}
|
||||||
|
|
||||||
type Parameter = ocl_type.OclType
|
type Parameter = Rep_OclType.OclType
|
||||||
|
|
||||||
datatype Event = SignalEvent of Parameter list
|
datatype Event = SignalEvent of Parameter list
|
||||||
| CallEvent of Parameter list
|
| CallEvent of Parameter list
|
||||||
|
@ -86,7 +86,7 @@ datatype StateVertex =
|
||||||
| SimpleState_ObjectflowState (* from ActivityGraphs *)
|
| SimpleState_ObjectflowState (* from ActivityGraphs *)
|
||||||
of {isSynch : bool,
|
of {isSynch : bool,
|
||||||
parameter : Parameter list,
|
parameter : Parameter list,
|
||||||
types : ocl_type.Path list (* Classifier_Id *)}
|
types : Rep_OclType.Path list (* Classifier_Id *)}
|
||||||
| State_FinalState
|
| State_FinalState
|
||||||
of {outgoing : Transition_Id list,
|
of {outgoing : Transition_Id list,
|
||||||
incoming : Transition_Id list,
|
incoming : Transition_Id list,
|
||||||
|
|
|
@ -35,16 +35,16 @@ struct
|
||||||
exception IllFormed of string
|
exception IllFormed of string
|
||||||
exception NotYetImplemented
|
exception NotYetImplemented
|
||||||
|
|
||||||
datatype HashTableEntry = Package of ocl_type.Path
|
datatype HashTableEntry = Package of Rep_OclType.Path
|
||||||
| Type of (ocl_type.OclType *
|
| Type of (Rep_OclType.OclType *
|
||||||
(XMI.AssociationEnd list))
|
(XMI.AssociationEnd list))
|
||||||
| Generalization of (string * string)
|
| Generalization of (string * string)
|
||||||
| Constraint of XMI.Constraint
|
| Constraint of XMI.Constraint
|
||||||
| Stereotype of string
|
| Stereotype of string
|
||||||
| Variable of XMI.VariableDeclaration
|
| Variable of XMI.VariableDeclaration
|
||||||
| Attribute of ocl_type.Path
|
| Attribute of Rep_OclType.Path
|
||||||
| Operation of ocl_type.Path
|
| Operation of Rep_OclType.Path
|
||||||
| AssociationEnd of ocl_type.Path
|
| AssociationEnd of Rep_OclType.Path
|
||||||
|
|
||||||
fun find_generalization t xmiid =
|
fun find_generalization t xmiid =
|
||||||
(case valOf (HashTable.find t xmiid)
|
(case valOf (HashTable.find t xmiid)
|
||||||
|
@ -96,7 +96,7 @@ fun find_package t xmiid =
|
||||||
| _ => raise Option)
|
| _ => raise Option)
|
||||||
handle Option => raise IllFormed ("expected Path "^xmiid^" in table")
|
handle Option => raise IllFormed ("expected Path "^xmiid^" in table")
|
||||||
|
|
||||||
fun path_of_classifier (ocl_type.Classifier x) = x
|
fun path_of_classifier (Rep_OclType.Classifier x) = x
|
||||||
|
|
||||||
fun find_constraint t xmiid =
|
fun find_constraint t xmiid =
|
||||||
(case valOf (HashTable.find t xmiid)
|
(case valOf (HashTable.find t xmiid)
|
||||||
|
@ -133,19 +133,19 @@ fun find_classifier_type t xmiid
|
||||||
= let val ocltype = case valOf (HashTable.find t xmiid) of (Type (x,xs)) => x
|
= let val ocltype = case valOf (HashTable.find t xmiid) of (Type (x,xs)) => x
|
||||||
| _ => raise Option
|
| _ => raise Option
|
||||||
in
|
in
|
||||||
case ocltype of ocl_type.Integer => ocltype
|
case ocltype of Rep_OclType.Integer => ocltype
|
||||||
| ocl_type.String => ocltype
|
| Rep_OclType.String => ocltype
|
||||||
| ocl_type.Real => ocltype
|
| Rep_OclType.Real => ocltype
|
||||||
| ocl_type.Boolean => ocltype
|
| Rep_OclType.Boolean => ocltype
|
||||||
| ocl_type.Classifier x => ocltype
|
| Rep_OclType.Classifier x => ocltype
|
||||||
| ocl_type.OclVoid => ocltype
|
| Rep_OclType.OclVoid => ocltype
|
||||||
| ocl_type.OclAny => ocltype
|
| Rep_OclType.OclAny => ocltype
|
||||||
| ocl_type.DummyT => ocltype
|
| Rep_OclType.DummyT => ocltype
|
||||||
| ocl_type.Collection (ocl_type.Classifier [x]) => ocl_type.Collection (find_classifier_type t x)
|
| Rep_OclType.Collection (Rep_OclType.Classifier [x]) => Rep_OclType.Collection (find_classifier_type t x)
|
||||||
| ocl_type.Sequence (ocl_type.Classifier [x]) => ocl_type.Sequence (find_classifier_type t x)
|
| Rep_OclType.Sequence (Rep_OclType.Classifier [x]) => Rep_OclType.Sequence (find_classifier_type t x)
|
||||||
| ocl_type.Set (ocl_type.Classifier [x]) => ocl_type.Set (find_classifier_type t x)
|
| Rep_OclType.Set (Rep_OclType.Classifier [x]) => Rep_OclType.Set (find_classifier_type t x)
|
||||||
| ocl_type.Bag (ocl_type.Classifier [x]) => ocl_type.Bag (find_classifier_type t x)
|
| Rep_OclType.Bag (Rep_OclType.Classifier [x]) => Rep_OclType.Bag (find_classifier_type t x)
|
||||||
| ocl_type.OrderedSet (ocl_type.Classifier [x]) => ocl_type.OrderedSet (find_classifier_type t x)
|
| Rep_OclType.OrderedSet (Rep_OclType.Classifier [x]) => Rep_OclType.OrderedSet (find_classifier_type t x)
|
||||||
| _ => raise Option
|
| _ => raise Option
|
||||||
end
|
end
|
||||||
handle Option => raise IllFormed ("expected Classifier "^xmiid^" in table")
|
handle Option => raise IllFormed ("expected Classifier "^xmiid^" in table")
|
||||||
|
@ -178,20 +178,20 @@ fun insert_classifier table package_prefix class =
|
||||||
val path = package_prefix @ [name]
|
val path = package_prefix @ [name]
|
||||||
val ocltype = if (package_prefix = ["oclLib"]
|
val ocltype = if (package_prefix = ["oclLib"]
|
||||||
orelse package_prefix = ["UML_OCL"])
|
orelse package_prefix = ["UML_OCL"])
|
||||||
then if name = "Integer" then ocl_type.Integer
|
then if name = "Integer" then Rep_OclType.Integer
|
||||||
else if name = "Boolean" then ocl_type.Boolean
|
else if name = "Boolean" then Rep_OclType.Boolean
|
||||||
else if name = "String" then ocl_type.String
|
else if name = "String" then Rep_OclType.String
|
||||||
else if name = "Real" then ocl_type.Real
|
else if name = "Real" then Rep_OclType.Real
|
||||||
else if name = "OclVoid" then ocl_type.OclVoid
|
else if name = "OclVoid" then Rep_OclType.OclVoid
|
||||||
else if name = "OclAny" then ocl_type.OclAny
|
else if name = "OclAny" then Rep_OclType.OclAny
|
||||||
(* now this is really ugly... *)
|
(* now this is really ugly... *)
|
||||||
else if String.isPrefix "Collection(" name then ocl_type.Collection (ocl_type.Classifier [XMI.classifier_elementtype_of class])
|
else if String.isPrefix "Collection(" name then Rep_OclType.Collection (Rep_OclType.Classifier [XMI.classifier_elementtype_of class])
|
||||||
else if String.isPrefix "Sequence(" name then ocl_type.Sequence (ocl_type.Classifier [XMI.classifier_elementtype_of class])
|
else if String.isPrefix "Sequence(" name then Rep_OclType.Sequence (Rep_OclType.Classifier [XMI.classifier_elementtype_of class])
|
||||||
else if String.isPrefix "Set(" name then ocl_type.Set (ocl_type.Classifier [XMI.classifier_elementtype_of class])
|
else if String.isPrefix "Set(" name then Rep_OclType.Set (Rep_OclType.Classifier [XMI.classifier_elementtype_of class])
|
||||||
else if String.isPrefix "Bag(" name then ocl_type.Bag (ocl_type.Classifier [XMI.classifier_elementtype_of class])
|
else if String.isPrefix "Bag(" name then Rep_OclType.Bag (Rep_OclType.Classifier [XMI.classifier_elementtype_of class])
|
||||||
else if String.isPrefix "OrderedSet(" name then ocl_type.OrderedSet (ocl_type.Classifier [XMI.classifier_elementtype_of class])
|
else if String.isPrefix "OrderedSet(" name then Rep_OclType.OrderedSet (Rep_OclType.Classifier [XMI.classifier_elementtype_of class])
|
||||||
else raise IllFormed ("didn't recognize ocltype "^name)
|
else raise IllFormed ("didn't recognize ocltype "^name)
|
||||||
else ocl_type.Classifier path
|
else Rep_OclType.Classifier path
|
||||||
(* This function is called before the associations are handled, *)
|
(* This function is called before the associations are handled, *)
|
||||||
(* so we do not have to take care of them now... *)
|
(* so we do not have to take care of them now... *)
|
||||||
val aends = nil
|
val aends = nil
|
||||||
|
@ -212,13 +212,13 @@ fun insert_classifier table package_prefix class =
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
val triv_expr = ocl_term.Literal ("true",ocl_type.Boolean)
|
val triv_expr = Rep_OclTerm.Literal ("true",Rep_OclType.Boolean)
|
||||||
|
|
||||||
fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
||||||
ocl_term.Literal (symbol,find_classifier_type t expression_type)
|
Rep_OclTerm.Literal (symbol,find_classifier_type t expression_type)
|
||||||
| transform_expression t (XMI.IfExp {condition,thenExpression,
|
| transform_expression t (XMI.IfExp {condition,thenExpression,
|
||||||
elseExpression,expression_type}) =
|
elseExpression,expression_type}) =
|
||||||
ocl_term.If (transform_expression t condition,
|
Rep_OclTerm.If (transform_expression t condition,
|
||||||
find_classifier_type t (XMI.expression_type_of condition),
|
find_classifier_type t (XMI.expression_type_of condition),
|
||||||
transform_expression t thenExpression,
|
transform_expression t thenExpression,
|
||||||
find_classifier_type t (XMI.expression_type_of thenExpression),
|
find_classifier_type t (XMI.expression_type_of thenExpression),
|
||||||
|
@ -227,7 +227,7 @@ fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
||||||
find_classifier_type t expression_type)
|
find_classifier_type t expression_type)
|
||||||
| transform_expression t (XMI.AttributeCallExp {source,referredAttribute,
|
| transform_expression t (XMI.AttributeCallExp {source,referredAttribute,
|
||||||
expression_type}) =
|
expression_type}) =
|
||||||
ocl_term.AttributeCall (transform_expression t source,
|
Rep_OclTerm.AttributeCall (transform_expression t source,
|
||||||
find_classifier_type t (XMI.expression_type_of source),
|
find_classifier_type t (XMI.expression_type_of source),
|
||||||
find_attribute t referredAttribute,
|
find_attribute t referredAttribute,
|
||||||
find_classifier_type t expression_type)
|
find_classifier_type t expression_type)
|
||||||
|
@ -237,7 +237,7 @@ fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
||||||
let val arglist = map (transform_expression t) arguments
|
let val arglist = map (transform_expression t) arguments
|
||||||
val argtyplist = map ((find_classifier_type t) o XMI.expression_type_of) arguments
|
val argtyplist = map ((find_classifier_type t) o XMI.expression_type_of) arguments
|
||||||
in
|
in
|
||||||
ocl_term.OperationCall (transform_expression t source,
|
Rep_OclTerm.OperationCall (transform_expression t source,
|
||||||
find_classifier_type t (XMI.expression_type_of source),
|
find_classifier_type t (XMI.expression_type_of source),
|
||||||
find_operation t referredOperation,
|
find_operation t referredOperation,
|
||||||
ListPair.zip (arglist, argtyplist),
|
ListPair.zip (arglist, argtyplist),
|
||||||
|
@ -246,7 +246,7 @@ fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
||||||
| transform_expression t (XMI.OperationWithTypeArgExp {source,name,
|
| transform_expression t (XMI.OperationWithTypeArgExp {source,name,
|
||||||
typeArgument,
|
typeArgument,
|
||||||
expression_type}) =
|
expression_type}) =
|
||||||
ocl_term.OperationWithType (transform_expression t source,
|
Rep_OclTerm.OperationWithType (transform_expression t source,
|
||||||
find_classifier_type t (XMI.expression_type_of source),
|
find_classifier_type t (XMI.expression_type_of source),
|
||||||
name,
|
name,
|
||||||
find_classifier_type t typeArgument,
|
find_classifier_type t typeArgument,
|
||||||
|
@ -254,16 +254,16 @@ fun transform_expression t (XMI.LiteralExp {symbol,expression_type}) =
|
||||||
| transform_expression t (XMI.VariableExp {referredVariable,expression_type})=
|
| transform_expression t (XMI.VariableExp {referredVariable,expression_type})=
|
||||||
let val var_dec = find_variable_dec t referredVariable
|
let val var_dec = find_variable_dec t referredVariable
|
||||||
in
|
in
|
||||||
ocl_term.Variable (#name var_dec,find_classifier_type t expression_type)
|
Rep_OclTerm.Variable (#name var_dec,find_classifier_type t expression_type)
|
||||||
end
|
end
|
||||||
| transform_expression t (XMI.AssociationEndCallExp {source, referredAssociationEnd, expression_type}) =
|
| transform_expression t (XMI.AssociationEndCallExp {source, referredAssociationEnd, expression_type}) =
|
||||||
ocl_term.AssociationEndCall (transform_expression t source,
|
Rep_OclTerm.AssociationEndCall (transform_expression t source,
|
||||||
find_classifier_type t (XMI.expression_type_of source),
|
find_classifier_type t (XMI.expression_type_of source),
|
||||||
find_associationend t referredAssociationEnd,
|
find_associationend t referredAssociationEnd,
|
||||||
find_classifier_type t expression_type
|
find_classifier_type t expression_type
|
||||||
)
|
)
|
||||||
| transform_expression t (XMI.IteratorExp {name,iterators,body,source,expression_type}) =
|
| transform_expression t (XMI.IteratorExp {name,iterators,body,source,expression_type}) =
|
||||||
ocl_term.Iterator (name,
|
Rep_OclTerm.Iterator (name,
|
||||||
map (fn x => (#name x, find_classifier_type t (#declaration_type x))) iterators,
|
map (fn x => (#name x, find_classifier_type t (#declaration_type x))) iterators,
|
||||||
transform_expression t source, find_classifier_type t (XMI.expression_type_of source),
|
transform_expression t source, find_classifier_type t (XMI.expression_type_of source),
|
||||||
transform_expression t body, find_classifier_type t (XMI.expression_type_of body),
|
transform_expression t body, find_classifier_type t (XMI.expression_type_of body),
|
||||||
|
@ -306,8 +306,8 @@ fun transform_attribute t ({xmiid,name,type_id,changeability,visibility,
|
||||||
in
|
in
|
||||||
(name,if multiplicity = [(1,1)]
|
(name,if multiplicity = [(1,1)]
|
||||||
then cls_type
|
then cls_type
|
||||||
else if ordering = XMI.Ordered then ocl_type.Sequence cls_type
|
else if ordering = XMI.Ordered then Rep_OclType.Sequence cls_type
|
||||||
else ocl_type.Set cls_type)
|
else Rep_OclType.Set cls_type)
|
||||||
end
|
end
|
||||||
|
|
||||||
fun transform_aend t ({xmiid,name,ordering,multiplicity,participant_id,
|
fun transform_aend t ({xmiid,name,ordering,multiplicity,participant_id,
|
||||||
|
@ -324,7 +324,7 @@ fun transform_classifier t (XMI.Class {xmiid,name,isActive,visibility,isLeaf,
|
||||||
invariant}) =
|
invariant}) =
|
||||||
let val parents = map ((find_classifier_type t) o (find_parent t))
|
let val parents = map ((find_classifier_type t) o (find_parent t))
|
||||||
generalizations
|
generalizations
|
||||||
val filtered_parents = filter (fn x => x <> ocl_type.OclAny) parents
|
val filtered_parents = filter (fn x => x <> Rep_OclType.OclAny) parents
|
||||||
in
|
in
|
||||||
Rep.Class {name = path_of_classifier (find_classifier_type t xmiid),
|
Rep.Class {name = path_of_classifier (find_classifier_type t xmiid),
|
||||||
parent = case filtered_parents
|
parent = case filtered_parents
|
||||||
|
@ -343,7 +343,7 @@ fun transform_classifier t (XMI.Class {xmiid,name,isActive,visibility,isLeaf,
|
||||||
end
|
end
|
||||||
| transform_classifier t (XMI.Primitive {xmiid,name,generalizations,
|
| transform_classifier t (XMI.Primitive {xmiid,name,generalizations,
|
||||||
operations,invariant}) =
|
operations,invariant}) =
|
||||||
Rep.Primitive {name = case find_classifier_type t xmiid of ocl_type.Classifier x => x
|
Rep.Primitive {name = case find_classifier_type t xmiid of Rep_OclType.Classifier x => x
|
||||||
| _ => raise Option,
|
| _ => raise Option,
|
||||||
parent = NONE, (* FIX *)
|
parent = NONE, (* FIX *)
|
||||||
operations = map (transform_operation t) operations,
|
operations = map (transform_operation t) operations,
|
||||||
|
@ -356,7 +356,7 @@ fun transform_classifier t (XMI.Class {xmiid,name,isActive,visibility,isLeaf,
|
||||||
thyname = NONE}
|
thyname = NONE}
|
||||||
| transform_classifier t (XMI.Enumeration {xmiid,name,generalizations,
|
| transform_classifier t (XMI.Enumeration {xmiid,name,generalizations,
|
||||||
operations,literals,invariant}) =
|
operations,literals,invariant}) =
|
||||||
Rep.Enumeration {name = case find_classifier_type t xmiid of ocl_type.Classifier x => x
|
Rep.Enumeration {name = case find_classifier_type t xmiid of Rep_OclType.Classifier x => x
|
||||||
| _ => raise Option,
|
| _ => raise Option,
|
||||||
parent = NONE, (* FIX *)
|
parent = NONE, (* FIX *)
|
||||||
literals = literals,
|
literals = literals,
|
||||||
|
@ -426,7 +426,7 @@ fun transform_assocation t (assoc:XMI.Association) =
|
||||||
fun add_aend_to_type (id,ae) =
|
fun add_aend_to_type (id,ae) =
|
||||||
let val type_of_id = find_classifier_type t id
|
let val type_of_id = find_classifier_type t id
|
||||||
val aends_of_id = ae::(find_aends t id)
|
val aends_of_id = ae::(find_aends t id)
|
||||||
val path_of_id = case type_of_id of ocl_type.Classifier x => x
|
val path_of_id = case type_of_id of Rep_OclType.Classifier x => x
|
||||||
val path_of_ae = path_of_id @ [#name ae]
|
val path_of_ae = path_of_id @ [#name ae]
|
||||||
in
|
in
|
||||||
(HashTable.insert t (id,Type (type_of_id,aends_of_id));
|
(HashTable.insert t (id,Type (type_of_id,aends_of_id));
|
||||||
|
@ -457,7 +457,7 @@ fun transformXMI ({classifiers,constraints,packages,
|
||||||
let val (xmiid_table: (string,HashTableEntry) HashTable.hash_table) =
|
let val (xmiid_table: (string,HashTableEntry) HashTable.hash_table) =
|
||||||
HashTable.mkTable (HashString.hashString, (op =)) (101, Option)
|
HashTable.mkTable (HashString.hashString, (op =)) (101, Option)
|
||||||
(* hack: insert a dummy type into the table *)
|
(* hack: insert a dummy type into the table *)
|
||||||
val _ = HashTable.insert xmiid_table ("DummyT",Type (ocl_type.DummyT,nil))
|
val _ = HashTable.insert xmiid_table ("DummyT",Type (Rep_OclType.DummyT,nil))
|
||||||
(* for some reasons, there are model elements outside of the top-level *)
|
(* for some reasons, there are model elements outside of the top-level *)
|
||||||
(* model the xmi-file. So we have to handle them here seperately: *)
|
(* model the xmi-file. So we have to handle them here seperately: *)
|
||||||
val _ = map (insert_classifier xmiid_table nil) classifiers
|
val _ = map (insert_classifier xmiid_table nil) classifiers
|
||||||
|
|
Loading…
Reference in New Issue