diff --git a/su4sml/src/wfcpog/library.sml b/su4sml/src/wfcpog/library.sml index 1be830d..41be491 100644 --- a/su4sml/src/wfcpog/library.sml +++ b/su4sml/src/wfcpog/library.sml @@ -65,8 +65,10 @@ sig val disjugate_terms : Rep_OclTerm.OclTerm list -> Rep_OclTerm.OclTerm (** Get an attribute by name. *) val get_attribute : string -> Rep_Core.Classifier -> Rep.Model -> Rep_Core.attribute + (** Get an associationend by name.*) + val get_associationend : string -> Rep_Core.Classifier -> Rep.Model -> Rep_Core.associationend (** Get an operation by name. *) - (* val get_operation : string -> Rep_Core.Classifier -> Rep.Model -> Rep_Core.operation *) + (* val get_operation : string -> Rep_Core.Classifier -> Rep.Model -> Rep_Core.operation *) (** *) val class_contains_op : Rep_Core.operation -> Rep.Model -> Rep_Core.Classifier -> bool (** *) @@ -220,10 +222,29 @@ fun get_attribute s classifier model = val x = List.find (fn a => if ((#name a) = s) then true else false) (all_attributes_of classifier model) in case x of - NONE => raise WFCPOG_LibraryError ("No attribute found using 'get_attribute'.\n") + NONE => + let + val _ = trace exce ("No such Attribute: \n In Classifier "^(string_of_path (name_of classifier))^" in attribute "^s) + in + raise WFCPOG_LibraryError ("No attribute found using 'get_attribute'.\n") + end | SOME (x) => x end +fun get_associationend s classifier model = + let + val x = List.find (fn a => if ((List.last(#name a)) = s) then true else false) (all_associationends_of classifier model) + in + case x of + NONE => + let + val _ = trace exce ("No such associationend: \n In Classifier "^(string_of_path (Rep_Core.name_of classifier))^" no associationend called "^(s)^".\n") + in + raise WFCPOG_LibraryError ("No attribute found using 'get_attribute'.\n") + end + | SOME(x) => x + end + fun go_up_hierarchy location func (model as (clist,alist)) = let diff --git a/su4sml/src/wfcpog/status.txt b/su4sml/src/wfcpog/status.txt index 395d434..abeb190 100644 --- a/su4sml/src/wfcpog/status.txt +++ b/su4sml/src/wfcpog/status.txt @@ -1,8 +1,7 @@ -"visibilityconsistency.sml" ===> [DONE (class: support for -assocends)] ==> MANUEL -"liskovconstraint.sml" ===> [DONE (invariants)] +"visibilityconsistency.sml" ===> [DONE] +"liskovconstraint.sml" ===> [DONE] "datamodelconsistency.sml" ===> [DONE] "constructorconsistency.sml" ===> [DONE (force_initialize_attributes still left] diff --git a/su4sml/src/wfcpog/test-data.sml b/su4sml/src/wfcpog/test-data.sml index ad3c888..3a37c30 100644 --- a/su4sml/src/wfcpog/test-data.sml +++ b/su4sml/src/wfcpog/test-data.sml @@ -96,6 +96,6 @@ val pos = [po_lsk_pre,po_lsk_post,po_lsk_inv,po_cm,po_sm,po_om,po_cstr_post,po_cstr_attribute,po_cstr_all] (* -val wfcs = [wfc_vis_class] +val wfcs = [wfc_vis_runtime] val pos = [po_lsk_inv] *) diff --git a/su4sml/src/wfcpog/test-suite.sml b/su4sml/src/wfcpog/test-suite.sml index 26c6d3a..2f8bd76 100644 --- a/su4sml/src/wfcpog/test-suite.sml +++ b/su4sml/src/wfcpog/test-suite.sml @@ -204,8 +204,8 @@ fun test (tc:testcase) wfs pos = let val i_model = ModelImport.import (#uml tc) (#ocl tc) [] val (clist,alist) = Rep_Core.normalize_ext i_model -(* val model = (((#1 i_model)@oclLib),(#2 i_model)) *) - val model = ((clist@oclLib),alist) + val model = (((#1 i_model)@oclLib),(#2 i_model)) +(* val model = ((clist@oclLib),alist) *) val _ = trace wgen ("Model of testcase loaded ...\n") val x = start_tests model (wfs@pos) val _ = trace wgen ("Test finished ...\n") diff --git a/su4sml/src/wfcpog/visibility_consistency.sml b/su4sml/src/wfcpog/visibility_consistency.sml index f11862b..c93484e 100644 --- a/su4sml/src/wfcpog/visibility_consistency.sml +++ b/su4sml/src/wfcpog/visibility_consistency.sml @@ -122,8 +122,8 @@ and expr_is_visible modif (Literal(s,typ)) model = true val _ = trace wgen ("start expr_is_visible") val cl = class_of_term src model val att_name = List.last(path) - val _ = trace wgen ("start get_attribute ") - val att = get_attribute att_name cl model + val _ = trace wgen ("start get_associationends ") + val att = get_associationend att_name cl model val _ = trace wgen ("end expr_is_visible") in if (visibility_conforms_to (#visibility att) modif) @@ -173,9 +173,7 @@ fun check_entity_classifier class model = let val vis_ops = List.map (fn (a:operation) => ((#visibility a),SOME(a),NONE,NONE)) (all_operations_of class model) val vis_atts = List.map (fn (a:attribute) => ((#visibility a),NONE,SOME(a),NONE)) (all_attributes_of class model) -(* val vis_assocs = List.map (fn (a:associationend) => ((#visibility a),NONE,NONE,SOME(a))) (all_associationends_of class model) - handle Bind => raise WFCPOG.WFCPOG_Exception ("Bind exception\n") -*) + val vis_assocs = List.map (fn (a:associationend) => ((#visibility a),NONE,NONE,SOME(a))) (all_associationends_of class model) val vis_class = visibility_of class val check = List.map (fn ((a:Visibility),x,y,z) => @@ -198,7 +196,7 @@ fun check_entity_classifier class model = in raise WFCPOG.WFC_FailedMessage (s1^s2^s3^s4^s5^s6) end - ) ((vis_ops)@(vis_atts)) + ) ((vis_ops)@(vis_atts)@(vis_assocs)) in List.all (fn a => a = true) check end