1. Field of the Invention
Embodiments of the invention are in the field of natural language processing and relate more specifically to generation of database models from business rules expressed in a natural language.
2. Description of Related Art
Natural language used by humans to communicate tends to be contextual and imprecise. To automate natural language processing using computerized methods, certain rules are usually imposed to confine the natural language expressions to a well-defined format. There are several applications that can provide an environment where natural language expressions may be expressed in an unambiguous format. One such application is business rules.
When business services or transactions are automated in a computer system, business rules provide business requirements on the automated system. These requirements dictate what the system should and should not do, or who can provide information to the system and who can request information from the system. However, the process of translating business rules expressed in business language into software components using human software developers tends to be error-prone and time-consuming. Automatic generation of software systems from business rules will save time and avoid the problem of errors that would occur in manual translation. One of the important parts of the generation of a software system from business rules is the generation of a database model that represents what information is stored by software components in a database for later retrieval.
There are known methods for generating a relational data model from a business vocabulary that is a set of terms and other symbols such as verbs or prepositions or combinations of these that represent fact types. When taking such a vocabulary as a conceptual schema, a relational data model can be generated following the well documented techniques described in “Information Modeling and Relational Databases From Conceptual Analysis to Logical Design”, pages 412-454, by Terry Halpin, Morgan Kaufmann Publishers, 2001. However, the approach described does not account for business rules that establish what kinds of facts are provided as source information. Therefore, a relational model generated in this way can be impractical when used as a database model because it does not fully distinguish the kinds of information provided as source data from other kinds of information that are derived or computed from source data. Without this distinction, a database model would likely define storage of an impractical amount of redundant information. To generate a database model that defines storage of source information only, a method is needed for discovering from the business rules of a business what types of facts are provided as source information.
One embodiment of the invention is a method for generating a database model from a set of business rules. For a business rule given as input, an empty list of fact types is created. A determination of whether the business rule is a definitional rule defining that one or more propositions become true upon occurrence of an event is made. If the business rule is a definitional rule, the fact type of each of the propositions is added to the list of fact types. Otherwise, a determination of whether the business rule is an authorization rule for provision of information that comprises one or more authorized provisions of information corresponding to one or more fact types is made. If the business rule is an authorization rule for provision of information, the corresponding fact types are added to the list of fact types. For each fact type in the list of fact types, the fact type having at least one role, the role having a type, if the type of the role is not a lexical type, the type is added to a list of types. The types in the list of types are processed and the fact types in the list of fact types are processed.
The invention may best be understood by referring to the following description and accompanying drawings that are used to illustrate embodiments of the invention.
In the drawings:
An embodiment of the invention is a method for generating a database model from a set of business rules. For a business rule given as input, an empty list of fact types is created. A determination of whether the business rule is a definitional rule defining that one or more propositions become true upon occurrence of an event is made. If the business rule is a definitional rule, the fact type of each of the propositions is added to the list of fact types. Otherwise, a determination of whether the business rule is an authorization rule for provision of information that comprises one or more authorized provisions of information corresponding to one or more fact types is made. If the business rule is an authorization rule for provision of information, the corresponding fact types are added to the list of fact types. For each fact type in the list of fact types, the fact type having at least one role, the role having a type, if the type of the role is not a lexical type, the type is added to a list of types. The types in the list of types are processed and the fact types in the list of fact types are processed.
In the method of the present invention, fact types and classifications are determined from authorization rules and definitional rules. A database column type is determined from a reference scheme that may be defined for a role of a fact type. If a business rule imposes a limit of 1 on the cardinality of a role of a fact type, a corresponding uniqueness constraint is created and spans the database columns that correspond to the remaining roles of such fact type.
Database models resulting from the application of the method of the present invention correspond to normalized databases. By normalized database, it is meant that information data that are related are kept in separate database tables.
In the following description, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In other instances, well-known circuits, structures, and techniques have not been shown in order not to obscure the understanding of this description.
Business rules include authorization rules and definitional rules which affect the source information that is to be stored in a database system.
The method of the present invention considers the part of an authorization rule that expresses what information may be provided, apart from any consideration of who provides it or conditions under which it may be provided. The method of the present invention examines propositional expressions of authorized provisions of information in the authorization rule with respect to the use of propositional demonstrative operators, propositional interrogative operators and the interrogative operators.
The method of the present invention further considers each definitional rule which defines that one or more propositions become true upon occurrence of an event.
The method of the present invention considers these propositions apart from any consideration of the description of the triggering event or of any condition that limits applicability of the rule. The method of the present invention also considers business rules that impose a uniqueness constraint. Such uniqueness constraint does affect the source information that is to be stored in a database system.
Many relevant linguistic concepts are used in the following description. These concepts are developed using a linguistic terminology that includes a number of terms. These terms include “expression”, “nominal expression”, “term”, “name”, “numerical literal”, “textual literal”, “role expression”, “sentence”, “simple sentence”, “complex sentence”, “function form”, “sentence form”, “parametric operator”, “interrogative operator”, “propositional interrogative”, “reference scheme”, “type”, “category”, “role”, “supertype”, and “subtype”.
An expression is a symbol or combination of symbols that means something. The meaning can be anything, including a proposition, a rule, a number, etc.
A nominal expression is a category of expression that names a thing or things.
A term is a category of symbol, a symbol that denotes being of a type, i.e., a common noun. Examples: “car” denoting a category of vehicle, “bank account”.
A name is a category of symbol and of nominal expression; a symbol that names an individual thing, i.e., a proper noun. Examples: “California” naming a state of the United States, “Unisys” naming the company Unisys.
A numerical literal is a category of name that denotes a number using numerals. For example, “123” meaning the number 123.
A textual literal is a category of symbol and of nominal expression; a symbol that represents words, punctuation, textual characters or a sequence of any of these by literal presentation, as in quotation marks. For example, “hello” representing the word “hello”.
A role expression is a category of nominal expression. A nominal expression consists primarily of a term given in place of a placeholder in an expression based on a function form, and consists secondarily of each operator (e.g., quantifier, pronominal operator, parametric operator, interrogative operator) and object modifier applied to the term together with any expression of instances specifically referenced by the term, or, if the denoted type's range is restricted using a nominal restrictive form, that nominal restrictive form along with the expression of each argument to the function delineated by that form. Examples: “a checking account” in the expression “a checking account has the overdraw limit ($1000.00)”; “the overdraw limit ($1000.00)” in the expression “a checking account has the overdraw limit ($1000.00)”.
A sentence is a category of expression; an expression that denotes a proposition (possibly an open or interrogative proposition).
A simple sentence is a category of sentence; a sentence that is stated using a single sentence form (having no logical connectives). It includes a nominal expression for each placeholder of the sentence form. Example: “Each person has a name”.
A complex sentence is a category of sentence. It is a sentence that combines other sentences using a logical connective such as “if”, “and”, “or”, etc. Example: “Each American citizen has a name and a social security number”.
A function form is a category of symbol and of expression; a complex symbol that is a sequence of typed placeholders and words interspersed that delineates a function and serves as a form for invoking the function in expressions. Each typed placeholder appears in the sequence as a term denoting the placeholder's type specially marked in some way (such as by underlining).
A sentence form is a category of function form that delineates a propositional function. Example: “vendor charges price for product”.
A parametric operator is a category of operator that when expressed with a term denotes a discourse referent determined by future discourse context, with singular quantification. Example: “a given” in “Each medical receptionist is authorized to provide what doctor sees a given patient”.
An interrogative operator is a category of operator that, when expressed with a term in a role expression, denotes a discourse referent determined by future discourse context. The role expression is therefore a name for satisfiers in the encompassing sentence. Examples: the operator “what” in “What doctor sees what patient”, the operators “which” and “what” in “Which doctor sees what patient”. Note that “what” carries the meaning of “who”, “when”, “how”, “where”, “why”, etc. when used as an operator on a term, e.g., in “what person”, “what time” or “what date”, “what method”, “what location”, “what purpose”, etc.
A propositional interrogative is a category of operator that when expressed with a proposition denotes the truth-value of the proposition with regard to future discourse context. Example: the operator “whether” in “whether each doctor is licensed”.
A reference scheme (also called an identification scheme, or an identity criterion) is a scheme by which a thing of some type can be identified by facts about the thing that relate the thing to signifiers or to other things identified by signifiers. The identifying scheme comprises the set of terms that correspond to the signifiers. Example: an employee may be identified by employee number.
A type is a classification of things (often by category or by role). A category is a role of a type in a categorization relation to a more general type. The category classifies a subset of the instances of the more general type based on some delimiting characteristic. Example: checking account is a category of account.
A role is a role of a type whose essential characteristic is that its instances play some part, or are put to some use, in some situation. The type classifies an instance based, not on a distinguishing characteristic of the instance itself (as with a category), but on some fact that involves the instance. Example: destination city is a role of a city.
A supertype is a role of a type used in relation to another type such that the other type is a category or role of the supertype, directly or indirectly. Each instance of the other type is an instance of the supertype. Examples: animal is a supertype of person (assuming person is a category of animal) and person is a supertype of driver (assuming driver is a role of a person).
A subtype is a role of a type used in relation to another type such that the subtype is a category or role of the other type, directly or indirectly. Each instance of the subtype is an instance of the other type. This is the inverse of supertype. Examples: person is a subtype of animal (assuming person is a category of animal) and driver is a subtype of person (assuming driver is a role of a person).
A fact type is a type that is a classification of facts. A fact type may be represented by a form of expression such as a sentence form, restrictive form or a mathematical form. A fact type has one or more roles, each of which is represented by a placeholder in a sentence form. Each instance of a fact type is a fact that involves one thing for each role. Example: a fact type ‘person drives car’ has placeholders person and car. An instance of the fact type is a fact that a particular person drives a particular car.
In one embodiment, the invention is implemented using relational data modeling. Relational modeling concepts of table and column are widely understood, so they are not discussed here.
The business rule generator 110 generates a business vocabulary 112 and a set of business rules 115 as input to the database model generator 120. The database model generator 120 creates a database model from the input. The database model is used to define information storage in the database system 130. The system 100 may be implemented by software or hardware, or a combination of hardware and software.
The business vocabulary 112 defines terms, names and function forms. The vocabulary input further includes reference schemes for terms that are not implicitly understood to denote data values.
The business rules 115 are in a linguistic form having a predefined syntax or format that conforms to the grammatical rules of a natural language such as English. In one embodiment, these business rules may represent any of the following:
1. Obligations on the behavior of business actors. Example: “It is required that each employee wear a hardhat if the employee is in a construction zone”.
2. Definitional rules that define how information is derived or computed from other information. Example: “The sales tax rate charged on a sale is the sales tax rate at the location of the sale at the time of the sale.”
3. Definitional rules that define how certain propositions become facts upon the occurrence of some event. Example: “Upon the death of the president, given that the vice president remains alive, it is thereby the case that the vice president becomes the president”.
4. authorizations for business actors to provide information.
5. authorizations for business actors to request information.
The database model generator 120 translates the business rules given as input 115 into a database model that can be used to describe a database in the database system 130. The database system can be used by software components that automate business activity based on the business rules. The database system 130 can be any database product that can implement an arbitrary database model such as a relational database schema.
Most business rules of type 1 and business rules of type 2 and 5 do not affect the source information that is to be stored in a database. However, rules of type 1 (if strictly enforced) and 2 can affect the normalization of the database model. Some of the business rules of type 1 as described above may affect some source information that is to be stored in the database. Examples of such affecting business rules of type 1 are those that impose a constraint of uniqueness on a role of a fact type. Business rules of types 3 and 4 as described above generally affect the source information that is to be stored in the database.
A definitional rule that defines how certain propositions become true upon the occurrence of some event has at least two parts: a description of the event and the declaration, which is a statement of a proposition that becomes true upon the event. The rule may also include as a third part a condition indicating additional circumstances that are satisfied in order for the rule to be in force. These parts can occur in any order. They are detected because they use distinct linguistic elements. The declaration is the significant part of the rule for generation of a database model. The other parts have no affect on the database model. The declaration is detected within the rule based on the grammatical structure of the language and the appearance of a word or phrase that introduces it, such as, in English, “it is thereby the case that”.
The part of the rule that expresses the proposition that becomes true can use conjunction in order to assert multiple facts. For example, consider the rule “Upon a salesperson reaching $1 M in sales, it is thereby the case that the salesperson is in the Gold Club and the name of the salesperson is noted on the company website.” The rule above uses the word “and” to indicate conjunction, which causes two different kinds of facts to become true upon an occurrence of the triggering event. Note that conjunction can occur using other words or forms. It is a general linguistic concept found in all natural languages.
A business rule that authorizes provision of information by a business actor indicates what information can be provided. Such indications build on three linguistic concepts (1) propositional demonstratives, (2) propositional interrogatives, and (3) interrogative operators. These concepts are easily exemplified in English or other languages. Examples in English follow:
Propositional demonstrative: “A bank manager may provide that an account is suspended.” In this example, the word “that” is a propositional demonstrative for the proposition “an account is suspended”. This rule allows a bank manager to provide a fact about an account, i.e., that it is suspended.
Propositional interrogative: “A bank manager may provide whether an account is suspended.” In the above example, the word “whether” is a propositional interrogative for the proposition “an account is suspended”. This rule allows a bank manager to provide a fact about an account (i.e., that it is suspended) and also allows a bank manager to provide the opposite fact about an account (i.e., that it is not suspended).
Interrogative operator: “A bank manager may provide what account is suspended.” In the above example, the word “what” is an interrogative operator acting on the term “account” in the scope of the proposition “account is suspended”. This rule allows a bank manager to provide which accounts are suspended, and by omission, which are not.
The three concepts are distinct in usage and are not mixed except when using conjunction (explained below). For example, a propositional interrogative (such as “whether”) is not used in an authorization rule on a proposition containing an interrogative operator (such as “what”). However, multiple interrogative operators can occur in a single proposition. For example: “A bank manager may provide which loan officer is assigned to what loan.” In the above example, “which” and “what” are both interrogative operators indicating that a bank manager can provide the overall assignment of loan officers to loans.
In each of the three cases above it is possible for the rule to be conditioned on other information. For example, the first rule could be: “A bank manager may provide whether an account is suspended if the account is with a bank managed by the bank manager.” The condition does not affect what information can be provided other than to limit the circumstances in which the provision of information is allowed. Such conditions do not affect the model of a database that stores the information. For this reason, conditions placed on authorization rules can be ignored in the method of the present invention.
Note that the three linguistic concepts above are represented by many different words in English (e.g., “which” for “what”) and by many different words in other languages. The present invention does not consider specific words, but the three specific linguistic concepts described above.
A single authorization rule can use conjunction in order to authorize multiple kinds of information. For example, consider the rule “A bank manager may provide what credit limit is on an account and whether the account is suspended.” The rule above uses the word “and” to indicate conjunction, which causes authorization to be granted, in this case, for two kinds of facts. Note that conjunction can occur using other words or forms. It is a general linguistic concept found in all natural languages.
Rules of types 3 and 4 determine what types of facts can be stored using the method of the present invention. Rules of type 1 and 2 can affect the resulting data structures. A rule of type 1, if it is strictly enforced, or of type 2 that limits the cardinality of a fact type role to be single-valued allows facts of that fact type to be combined with other fact types in a single table. For example, the rule, “it is required that each employee has exactly one employee number”, affects the generated database model by allowing facts relating employees to their employee numbers to be combined into the same table as one used to indicate that an employee exists.
Elements of one embodiment of the invention may be implemented by hardware, firmware, software or any combination thereof. When implemented in software or firmware, the elements of an embodiment of the present invention are essentially the code segments to perform the necessary tasks. The software/firmware may include the actual code to carry out the operations described in one embodiment of the invention, or code that emulates or simulates the operations. The program or code segments can be stored in a processor or machine accessible medium or transmitted by a computer data signal embodied in a carrier wave, or a signal modulated by a carrier, over a transmission medium. The “processor readable or accessible medium” or “machine readable or accessible medium” may include any medium that can store, transmit, or transfer information. Examples of the processor readable or machine accessible medium include an electronic circuit, a semiconductor memory device, a read only memory (ROM), a flash memory, an erasable ROM (EROM), a floppy diskette, a compact disk (CD) ROM, an optical disk, a hard disk, a fiber optic medium, a radio frequency (RF) link, etc. The computer data signal may include any signal that can propagate over a transmission medium such as electronic network channels, optical fibers, air, electromagnetic, RF links, etc. The code segments may be downloaded via computer networks such as the Internet, Intranet, etc. The machine accessible medium may be embodied in an article of manufacture. The machine accessible medium may include data that, when accessed by a machine, cause the machine to perform the operations described above. The machine accessible medium may also include program code embedded therein. The program code may include machine-readable code to perform the operations described above. The term “data” here refers to any type of information that is encoded for machine-readable purposes. Therefore, it may include program, code, data, file, etc.
One embodiment of the invention may be described as a process, which is usually depicted as a flowchart, a flow diagram, a structure diagram, or a block diagram. Although a flowchart may describe the operations as a sequential process, many of the operations can be performed in parallel or concurrently. A loop or iterations in a flowchart may be described by a single iteration. It is understood that a loop index or loop indices or counter or counters are maintained to update the associated counters or pointers. In addition, the order of the operations may be re-arranged. A process terminates when its operations are completed. A process may recursively call itself. When the called process terminates, control is returned to the calling process. When all the recursive calls have ended, control is returned to the initial calling process. A process may correspond to a method, a program, a procedure, etc.
Upon Start, process 300 sets a current type to the type (block 302). Process 300 checks whether the current type has a supertype (block 304). If it does, process 300 sets the current type to be the supertype (block 306) and loops back to block 304 to check whether this current type has a supertype. This looping back is done until the highest level supertype is reached. If the current type does not have a supertype, process 300 determines whether the current type is already processed (block 308). If it is, process 300 terminates. Otherwise, process 300 creates an empty column list (block 310). Process 300 processes the column list for the current type (block 312). An embodiment of this processing is as shown in
Upon Start, process 500 determines whether the fact type is a basis for describing a reference scheme for a type (block 502). If it is, process 500 terminates. If it is not, process 500 creates a database table for the fact type (block 504). For a role of the fact type, process 500 determines whether the type of the role is a lexical type (block 506). If it is, process 500 adds a column of the corresponding lexical type to the database table (block 508) then continues at block 512. Otherwise, process 500 adds an identity-type column to refer to the database identity of the corresponding type (block 510). Next, process 500 determines whether the role is in the list of singled-valued roles of fact types (block 512). If it is not, process 500 continues at block 516. Otherwise, process 500 creates a uniqueness constraint spanning the columns that correspond to the remaining roles of the fact type (block 514) then continues at block 516. Next, process 500 repeats block 506 onward to 516 for each of the remaining roles of the fact type (block 516). Process 500 then terminates.
The technique of generating a database model from a set of business rules and vocabulary may be further described by the following pseudo code.
Code Section 1: Processing Business Rules
Step 3 of Code Section 1 will Result in the Following Table(s) being Created:
Step 4 of Code Section 1 will Result in the Following Database Tables being Created (from the List of Fact Types):
The following table is created for the fact type of the authorized provision of information “employee has name” in the authorization rule 2:
No database table is created for the fact type of the proposition “employee is assigned an employee number” in the definitional rule 3 because this fact type is the basis for describing the reference scheme for the type “employee”.
No database table is created for the fact type of the authorized provision of information “customer has name” in the authorization rule 4 because this fact type is the basis for the reference scheme of the type “customer”.
The following table is created for the fact type of the authorized provision of information “employee served customer on date” in the authorization rule 5:
Code Section 4 will Result in the Following Uniqueness Constraint:
Due to the single-valued role “customer” of the fact type of the proposition “employee serves customer on date” in the obligation rule 1, a uniqueness constraint on Employee_Served_Customer_On_Date is created, spanning the columns “identity_from_business_actor_for_employee” and “date_served” which correspond to the remaining roles of the fact type.
The computer system 600 includes a processor 612, a memory 614, and a mass storage device 616. The computer system 600 receives a stream of input representing a set of business rules and vocabulary, processes the business rules and the vocabulary in accordance to the method of the present invention, and outputs a database model.
The processor 612 represents a central processing unit of any type of architecture, such as embedded processors, mobile processors, micro-controllers, digital signal processors, superscalar computers, vector processors, single instruction multiple data (SIMD) computers, complex instruction set computers (CISC), reduced instruction set computers (RISC), very long instruction word (VLIW), or hybrid architecture.
The memory 614 stores system code and data. The memory 614 is typically implemented with dynamic random access memory (DRAM) or static random access memory (SRAM). The system memory may include program code or code segments implementing one embodiment of the invention. The memory 614 includes a database model generator module 615 of the present invention when loaded from mass storage 616. The database model generator module 615 implements all or part of the database model generator 120 shown in
The mass storage device 616 stores archive information such as code, programs, files, data, databases, applications, and operating systems. The mass storage device 616 may include compact disk (CD) ROM, a digital video/versatile disc (DVD), floppy drive, and hard drive, and any other magnetic or optic storage devices such as tape drive, tape library, redundant arrays of inexpensive disks (RAIDs), etc. The mass storage device 616 provides a mechanism to read machine-accessible media. The machine-accessible media may contain computer readable program code to perform tasks as described above.
While the invention has been described in terms of several embodiments, those of ordinary skill in the art will recognize that the invention is not limited to the embodiments described, but can be practiced with modification and alteration within the spirit and scope of the appended claims. The description is thus to be regarded as illustrative instead of limiting.
This application is related to the following patent applications: Ser. No. 10/836,832 (Attorney Docket No. PQH03-057) entitled “Generating Programmatic Interfaces From Natural Language Expressions Of Authorizations For Provision Of Information”, filed on Apr. 30, 2004; and Ser. No. 10/860,672 (Attorney Docket No. PQH04-008) entitled “Generating A Logical Model Of Objects From A Representation Of Linguistic Concepts For Use In Software Model Generation”, filed on Jun. 3, 2004, both assigned to the same assignee as the present application.