<<

MODELING LEGISLATION BY USING UML STATE MACHINE DIAGRAMS

Vjeran Strahonja, PhD Faculty of Organization and Informatics University of Zagreb, Croatia email: [email protected]

Abstract procedural regulation is not focused on the quality of The basic idea of modeling law, as presented in this paper, substantial decisions, but on the quality of the process is capturing domain knowledge of legislation and specifying it (workflow, duration, delays, number of hearings etc.). In in a generic way by using commonly agreed and contrast to procedural, the substantive regulation (i.e. law or its understandable modeling concepts of the Unified Modeling part) deals with the "substance" of the matter. It defines crimes Language (UML). State machine diagrams provide a graphical and punishments, how the facts in some type of the case or notation for describing the dynamic (time-dependent) behavior of a system. Business oriented behavioral models of legislation legal procedure will be handled, how the crime will be enable to understand the system better, support the detection of charged, or the dispute will be resolved. anomalies and help to improve the quality of legislation by The basic idea of modeling law, as presented in this paper, is validation and verification. Different types of anomalies in capturing domain knowledge of procedural legislation and legislation are classified and described in the article. More specifying it in a generic way by using commonly accepted and specific, this paper presents a static analysis approach to the checking of correctness and consistency of the UML state understandable modeling concepts of the Unified Modeling machine diagrams specifications of legislation. The presented Language (UML) [1]. Currently, UML is de facto standard for framework includes semantic and syntactic anomalies. expressing object-oriented analysis, design modeling and Other motivation for modeling legislation is a desire to documenting object-oriented and -based system build court case management systems. The prerequisite of architectures. Although the strengths of UML are at software building such models is the transformation of legislation and regulations into system models that focus on different aspects development, it is commonly used for representing business of the system, such as programs that automates the domain. business process and business rules, database, user interface, In the context of modeling, a business domain has two system procedures etc. distinct aspects: the structural or static aspect (functionality, Based on empirical research, assessment of proposed business data etc.), and the behavioral or dynamic part (states, method is made. transitions, activities, sequences etc.). From the point of view Keywords: Modeling legislation; behavioral model; state of this paper, emphasis is on the behavioral features of the machine diagram; static and dynamic analysis; court case system, e.g. the ways a system behaves in response to certain management system events or actions. Dynamic models of legislation, in a form of UML state machine diagrams, provide a graphical notation for 1. Introduction – Modeling of Legislation describing the dynamic (time-dependent) behavior of a legal system and improve understanding of a legal domain. Traditionally, modeling is an essential part of business They also provide a framework for validation and verification analysis and reengineering, as well as software development. of legal regulation and its model. Sometimes the motivation for Specific modeling methods and techniques are enabling modeling legislation is a desire to build court case management specification, visualization, and documentation of business and systems. system models. Some of advantages of modeling may be used in domain of legislation. The term "legislation" in this paper 2. Behavioral Modeling and Analysis of refers to the set of laws, statutes and other legal acts that cover Legislation a particular subject of law or practice. Although the static aspects of legislation are also very The aim of this paper is to discuss modeling of procedural important, this paper focuses on behavioral modeling of aspects of legislation. The separation of substantive and legislation. More specific, this paper presents an analysis procedural aspects of legislation is well known. The procedural approach based on the UML state machine diagrams of regulation defines the "court procedure" in terms of the process legislation. Ideally, we would like to have such model of that the case will go through. From the point of view of parties legislation, even formal specifications, to check correctness and judge, procedural regulation sets the rules for proceedings and consistency of legal regulation and its model. and enforcement of substantive law. Application of the

State machines and other UML models offer over all: actions. - describing system behavior in an intuitive way by using Based on current research, we suggest the iterative process visual modeling of modeling legislation that consists of four steps (Figure 1.): - readability and understandability by other human readers, 1) Basic analysis of selected legislation (classification, and lower level of required expertise, as compared with conceptualization and refactoring) formal specifications 2) Transformation to UML constructs and representation in a - lower ambiguity, as compared with natural languages. form of diagrams State machine diagrams show the possible states of the 3) Validation and verification (detection of anomalies based object and the transitions that cause a change in state. In object on static and dynamic analysis) oriented approach, state modeling and state machines are 4) Improvement of model and legal sources. usually related to classes and class diagrams, and describes the Classification of statements must consider some allowable states a class or element may be in and the classification patterns (procedural / substantial, terms and transitions that allow the element to move there. State definitions, case management, court , decision making, modeling means discretization of continuous phenomena. conducting the procedure, document management, human Roots of the UML 1.x statecharts formalism [1] are communication …). traditional state-transition diagrams, which are developed as a Conceptualization comprises the identification of structural part of the structured system analysis. These are extended with and behavioral constructs of selected legal act. some new concepts taken from David Harel, such as the Refactoring is the process of rewriting of legal source to concurrent states and nesting of states. UML 2.0 introduces improve its readability and structure from the point of view of state machines with some new constructs [2]. Basic concepts of further modeling technique, with the explicit purpose of state machine diagrams are: state (simple, composite, keeping the meaning and behavior of the source. As presented submachine), transition, , pseudo-state (initial, final, on the Figure 1., the applied refactoring form was simple table, shallow history, deep history) and guard condition. Some of with columns: who/, facts and rules (time limit, initial them made some confusion and created discussions, such as state, event, action, final state), with reference on the legal act. entry and exit operations, or distinction between activities and As UML and its modeling techniques move from academic

BOOK OF RULES FOR THE COURT Chapter sixteen WORK IN COURT DEPARTMENTS 1. Chronology of solving the cases Article172 4. Improvement After the receipt of the file from the court registry office, the judge, court councilor or other official assigned for processing it shall review the received files, classify them according to their importance and urgency, determine the chronology of settling the said cases and make corresponding decisions and orders relating to a certain case.THE LAW on Article 173 The President of the investigating department monitors the work of the investigating judges and takes measures for maintaining legal dates to be kept while working on cases relatedBANKRUPTCY to preliminary criminal procedure. Article 174 Cases in which the defendant is in incarceration, casesArticle in which 63 minors are involved and cases of special importance, such as cases related to economic If, during the preliminary proceedings, it is established that the bankruptcy crime in transformation1) . estate is insufficient to cover the costs of the proceedings or that it is of 2. Schedulinginconsiderable sessions value, the bankruptcy and hearingstribunal shall render a decision to open and close bankrArticleuptcy 175proceedings. In this case the bankruptcy proceedings Investigating judge,shall reporting not be judge carried of through.the second -instance council, the President of the council or the judge working on settling the case, is obliged to The decisions from paragraph 1. of this Article shall be published in the study a certain case2) if further procedure is not required. Official Gazette 3) The petitioner from paragraph 4. of this Article (Republic of Croatia) may 3) Validation demand reimbursement for the advanced payments and damage suffered from any of the persons responsible for the fact that the petition has not been filed timely. & Verification

1) Basic analysis

BOOK of RULES 2) Transformation WHO FACTS RULES LAW ARTICLE

1 PARTY - Files pleading. ART. 39. - Pays court fees. BL 2 CLERK - Confirms the receipt of theTHE Immed LAW. ART .on 131. BANKRUPTCY pleading. 137. BoR - Opens a file and enters WHOIn 48 FACTS RULES LAW relevant data on the case hours ARTICLE - Gives the file to the judge.1 CREDITOR ART. 39. BL 3 JUDGE - Brings decision on procedure ART. 151. - Schedules hearing BRINGS154. BoR BANKRUPTCY PETITION

2 CLERK RECEIVES BANKRUPTCY 9.00- ART. 131. PETITION 15.00 WO 137. BoR 3 CLERK ENTERS DATA INTO IN 48 ART. 151. REGISTERS, CREATES A HOURS 154. BoR NEW CASE FILE 4 JUDGES MAKES DECISION 15 DAYS ART. 41 OF BINDING THE CREDITOR BL TO GIVE A DOWN PAYMENT FOR COVERING THE LAW-SUIT EXPENSES 5 CLERK WRITES, TRANSCRIPTS ART. 198- Figure 1. Iterative process of modeling legislation

institutions into commercial software development and domain enforcement. Many of the theories, methods and formal modeling, they have to fulfill stronger requirements concerning approaches in a field of business modeling and modeling of correctness and consistency. Therefore, verification and legislation originated in linguistics and in knowledge based validation are inherent activities of modeling. systems. Some general aspects are similar in both linguistics There are two basic complementary analysis techniques for and modeling theory, like syntax, semantics and pragmatics. modeling legislation: static and dynamic (Table 1.). As an analogue of linguistics, we can also define syntactic, The static analysis lies on the concept of class and gives a semantic and pragmatic anomalies of models. In the case of behavioral model that is valid for all possible case proceedings. models, modeling syntax comprises the set of allowed In our example, the Procedural Manual (the Book of Rules) modeling concepts, reserved words and their parameters and defines a general court procedure, valid for all courts and all the correct way in which modeling concepts are used. Syntactic types of case. The Bankruptcy Law, the Law on Civil anomalies are caused by a violation of the structural Proceedings, the Execution Law etc. define specific court (grammatical) rules for a modeling technique. procedure valid for all courts and for some specific type of In a modeling theory semantics deals with the meaning case. Static analysis as a process comprises modeling and systems of modeling language and concepts and their mapping evaluation of a model or system, based on its form, structure, to the real world. Semantic anomalies deal with violation of content, or documentation. The idea is to understand how the meaning and sense, for example conflicting truth conditions, system works and establish certain correctness criteria. This is name conflicts, dangling references etc. In a modeling theory, a conservative technique, where we analyze the semantic anomalies are mostly result of inconsistent or implementation to prove which states and transitions are inadequate use of modeling concepts. illegal. The static analysis checks those criteria that are not Pragmatics is the study of information structure and the use related with the global state space (an upper bound). of language in communicative context. Pragmatics is The dynamic analysis uses a specialization, i.e. an concerned with bridging the gap between a theory and its implementation sub model of the static analysis model that is implementation in some context. valid for one particular case proceeding. Conceptually, it lies Some other theories that we need for validation and on the object as an implementation of the class. In the dynamic verification of legislation and its models are traditionally analysis, we observe instances of states and transitions that are addressed in knowledge based systems. Although research of a subset (a lower bound) of the ideal, complete model. We use anomalies in legislation is still an attractive field for research, these specializations as proof of existence. For example, we use some common issues like consistency, completeness reachability analysis is detection of unreachable states, and logical/semantic contradiction, that are considered more undesired global states or illegal sequence of actions. then ten years ago [5]. Unfortunately, the examination of a global state space often Incompleteness means that there is at least one improvable results in a state space explosion [6]. schema (sentence, statement) that could be added as an axiom schema without creating simple inconsistency. Incompleteness Table 1. Comparison of static and dynamic analysis. issues are: dead-end rules, missing rules, unreachable rules, dangling references, unreferenced attribute values and other Static Analysis Dynamic Analysis unintentional non-determinism. Represents all possible states Represents one particular Inconsistency of the specification implies that there are and transitions in all possible case proceeding conflicting statements. Discrepancy is simply the difference case proceedings between conflicting statements, definitions or rules of the same Superset of ideal model, Subset of ideal model, fact or situation. Some of the appearances of inconsistency are generalization, upper bound specialization, lower bound redundancy, unnecessary IF conditions logical contradiction, Conservative analysis Proof of existence and subsumed rules, circular rule, name conflicts (synonyms, detects illegal states and reachability analysis detects homonyms), inconsistent generalization/specialization and transitions legal states and transitions other logical/semantic contradictions. Assumes that an exception Global state of space results Anomalies in legislation may be caused by different will be produced on an illegal in state space explosion semantic, syntactic or pragmatic reasons. For example, input homonyms are pure semantic anomalies (if they are not desired), but an unintentional non-determinism can occur in the 3. Anomalies in Legislation model as a semantic anomalism of the legal pattern, or a syntactic failure. The most desirable "technical" properties of legislation, but Anomalism can occur on two different levels, on the level of not all, are completeness, consistency and logical/semantic a model, or on the level of legislation itself. For example, some contradiction. Absence of this and other desirable properties missing rule can disappear during a modeling process, but can are anomalies in legislation. It's generally accepted that also be omitted in regulation during the legislative procedure. anomalies in legislation impact on law implementation and

4. The Approach to the Validation and 5. Conclusions and Motivation for Further Verification of Anomalies Research Since manual checking of anomalies in legislation is error- This work on the modeling legislation by using UML was prone and time-consuming, currently the development of motivated partially by experiences gathered during the computer supported and automated methods for validation and development project of the Croatian Court Case Management verification of legislation attract researchers and practitioners System. During the phase of project preparation (2000-2003), from all around the world. All these validation and verification business models of current legislation, court proceedings and methods lie on decreasing complexity of legislation, by using case management were developed, including business use-case some methods of modeling laws. model, domain class model and behavioral statecharts/activity In general, the detection of anomalies in legislation models. Statecharts were developed for general case comprises validation and verification. Although the objective is management procedures, as well as for specific bankruptcy, the same, the approaches to validation and verification differ in enforcement, litigation and criminal procedures. their orientation. In the field of software engineering, This was the prerequisite of system modeling and validation answers the question: "Are we building the right development phase (started in 2005), that focuses on different product?", and verification: "Are we building the product aspects of the computer system, such as programs that right?" [3]. Validation means testing a model or specification automate the business process and business rules, database, against the users’ requirements and expectations, and user interface, system procedures etc. During this phase verification means testing against the design specification, statecharts are refined and converted to state machine notation. methodology, use of modeling concepts, rules of design etc. Based on empirical research, assessment of used method is Validation is the process of checking if statements of some made. Some improvements of methodology, like semi- legal act are true and meet common regulatory requirements automated syntactical verification are promising but require and statutory compliance. Validation is based on human expert further research. opinion. The idea of validation, as applied in this paper, is to Other fields of further research are anomalies in legislation. transform legal structure and procedure into a visualization Different types of anomalies in legislation are classified and model, to enable experts to validate their scenarios. worked out. Visualization of legal structure and procedures can help the UML seems to be a cure-all with clearly described concepts, expert to make decision whether some potential anomaly standard notations and suggestions for implementation. But (redundancy, synonym, circular definition etc.) really is an application of UML in particular domains, such as modeling of anomaly in legislation or not. legislation, needs to be researched and evaluated. Validation should not be confused with verification. Verification is the act of proving or disproving the correctness References of a legal act with respect to a certain specification or property. Verification is the process of reviewing, auditing, inspecting, [1] J. Rumbaugh, I. Jacobson, G. Booch, "The Unified Modeling testing, checking, or otherwise establishing and documenting Language Reference Manual," Addison-Wesley, 1999. whether some specification or model conforms to [2]"Unifed Modeling Language (UML): Superstructure, version 2.0," predetermined requirement. In contrast of validation, that is a (OMG), http://www.omg.org, 2005- 11-08, August, 2005. human-directed proof, verification can be automated to some [3] B. Boehm, “Verifying and Validating Software Requirements and extend, as described in relevant papers [4] [6] [7]. First step of Design Specifications, ” IEEE Software, vol. 1, pp. 75-88, all automated methods of verification is the translation of January, 1984. legislation into formal models that are input for some tool [4] IEEE Expert. Special Issue: Validation & Verification of supporting automated-reasoning (model checking or theorem Knowledge- Based Systems, E. Plaza (ed.), vol. 3, 1993 proving). [5] M. Ayel, J. P. Laurent. (eds.), “Validation, Verification and Testing of Knowledge-Based Systems,” John Wiley & Sons Ltd., The current limitations of automated verification of Chichester, England, 1991. legislation are: [6] D. Latella, I. Majzik, M. Massink, "Towards a Formal Operational - These techniques need human assistance. Otherwise Semantics of UML Statechart Diagrams," In P. Ciancarini and model checkers and theorem provers can quickly mire in R. Gorrieri, editors, IFIP TC6/WG6.1 Third International millions of uninteresting states to be checked. Conference on Formal Methods for Open Object-Oriented - The automated verification is purely syntactical because Distributed Systems, Kluwer Academic Publishers, 1999. [7] T.M. Van Engers, R. Gerrits, M. Boekenoogen, E.J.J. Glassée, the legislator may intend to have some anomalies, e.g. P.J.M. Kordelaar, "POWER: Using UML/OCL for modeling redundant rules, synonyms, circularities) Legislation - an application report," Proceedings of the - Construction of formal specification, as well as automated International Conference on Artificial Intelligence and Law, checkers, requires significant efforts ACM 1-58113-368-5/01/0005, 2001. - Readability and understandability of formal specifications is limited by end non-experts.