The present invention relates to storage of data in databases, and in particular, to extension of a data definition language (DDL) to introduce a new column type: a rule type column.
Unless otherwise indicated herein, the approaches described in this section are not prior art to the claims in this application and are not admitted to be prior art by inclusion in this section.
Databases comprising are highly useful tools allowing users to manage complex relationships between different types of data. For example, a business rule is a composition of single or multiple logical or computational expressions. Such rules may find expression within database structures comprising rows and columns.
Existing database systems, however, generally do not provide the capability of defining derived columns based on certain complex rule evaluation. Rather, in many cases derived or transient columns need to be defined at the application layer. As the database user may not be fluent in the language of the application layer, this can reduce flexibility of the database.
In certain cases, databases may allow simple calculations to be encapsulated in column definitions. For example, a virtual column may be defined by evaluating an expression, the result of which becomes the metadata of the column. However, a virtual column is defined only during table creation or modification. Specifically, a virtual column is derived using the logic contained in the expression and other column values. The expressions deriving the value of a virtual column are statically defined during the table creation and are not reused from a repository. The expressions are limited to computations or condition evaluation, rather than complex business logic. In this manner, virtual columns are static and cannot be modeled based on complex business rules.
Certain conventional approaches may provide the use of a CREATE RULE SQL statement. This feature allows creation of rules, which when bound to a database column will restrict the values that can be inserted into that column. Once a rule is created using a CREATE RULE statement, it can be bound to a column of a table. However, binding a rule does not affect the current data in the database table.
Certain database applications may also rely on stored procedures or functions to encapsulate many of rules. However, such reliance upon stored rules permits less reusability of the database. Moreover the semantics of such stored rules are less transparent, again reducing flexibility of the database for the business users.
Finally, placing the rules remote from a user in storage and/or within the application layer, can interfere with the ongoing relevance of the database to the user. In particular, maintaining the accuracy of such rules is cumbersome, and changing them is difficult and typically requires intervention by one fluent in the language of the database application layer.
Instead, it is desirable that users should be able to maintain rules in a separate repository. This will permit reusability of rules.
The present disclosure addresses these and other issues with systems and methods for extending a data definition language (DDL) to introduce a new column type known as the rule type column, which can be readily accessed by a database user.
A data definition language (DDL) may be extended by introducing a new column type: a rule type column. Rules in a database are modeled using patterns such as a decision table or a decision tree, by specifying rule content through accessible user interfaces instead of programming constructs. A rule type column can be created using the DDL statements to define its storage type (transient or permanent), and/or whether it is generic or non-generic. A transient rule column will be populated only when a query is performed. A non-transient rule column will be populated when an insert is performed, and may be re-triggered during an update. A generic rule type column allows a user to define a specific rule each time an insert is performed (e.g. each row might trigger a different rule). A non-generic rule type column allows definition of one rule statically during the initial creation, with this rule being the same for all rows. The system of rules evaluation can be integrated with the language processor. Rule processing can be triggered whenever a query is fired or during an insert/update operation, depending on whether the rule type column is transient or persistent.
An embodiment of a computer-implemented method, comprises, providing in a non-transitory computer readable storage medium, a database created in an application level language and comprising data organized in rows and columns; expressing a rule modeled from data patterns, in a statement in a data design language; posing a query to the database; causing the statement in the data design language to communicate with the database to create a rule type column; deriving a value based on the query and a row intersecting the rule type column; and displaying the value for the rule type column in response to the query.
An embodiment of a non-transitory computer readable storage medium embodies a computer program for performing a method, said method comprising providing a database created in an application level language and comprising data organized in rows and columns; expressing a rule modeled from data patterns, in a statement in a data design language; posing a query to the database; causing the statement in the data design language to communicate with the database to create a rule type column; deriving a value based on the query and a row intersecting the rule type column; and displaying the value for the rule type column in response to the query.
An embodiment of a computer system comprises one or more processors; a software program, executable on said computer system, the software program configured to access in a non-transitory computer readable storage medium, a database created in an application level language and comprising data organized in rows and columns; express a rule modeled from data patterns, in a statement in a data design language; pose a query to the database; cause the statement in the data design language to communicate with the database to create a rule type column; derive a value based on the query and a row intersecting the rule type column; and display the value for the rule type column in response to the query.
According to certain embodiments, the value may be persisted in the database. In other embodiments, the value is not persisted in the database.
According to some embodiments, the rule type column is the same for all of the rows.
In some embodiments, the rule is expressed at a time of creation of the database. In certain embodiments, the rule is expressed at a time of an insert or update operation.
The following detailed description and accompanying drawings provide a better understanding of the nature and advantages of the present invention.
Described herein are techniques for providing a new column type, a rule type column, in a database structure. Rules in a database are modeled using patterns such as a decision table, decision tree, or formula, by specifying rule content through accessible user interfaces instead of programming constructs.
A rule type column can be created using statements in a data definition language (DDL) to define characteristics such as storage type, for example whether the rule type column is transient or permanent.
In particular, a transient rule column will be populated only when a query is performed. A non-transient rule column will be populated when an insert is performed, and may be re-triggered during an update.
Statements in the data definition language may also determine whether the rule type column is generic or non-generic. A generic rule column allows a user to define a specific rule each time an insert is performed (e.g. each row might trigger a different rule). A non-generic rule column allows definition of one rule statically during the initial creation, with this rule being the same for all rows.
The system of rules evaluation can be integrated with the language processor. Rule processing can be triggered whenever a query is fired or during an insert/update operation, depending on whether the rule type column is transient or persistent.
As mentioned above, a business rule is a composition of single or multiple logical or computational expressions. The logic of a business rule can be modeled using various types of rule based constructs.
One example of a rule based construct is a decision table.
Decision table 100 comprises of a set of condition columns 102 and a result column 104. In this particular decision table, the condition columns (Number of Products 102a and Number of Delayed Payments 102b) are used to determine the value in the result column 104 (here an Intermediate Value).
The rows are processed in order from top to bottom and left to right. Once a match is detected, the corresponding result columns are returned.
Another example of a rule based construct is a decision tree.
Still another example of a rule based construct is a formula expression.
Embodiments of the present invention allow rules to be modeled and stored in the database, in the form of DDL statements rather than in the application layer. This renders the rules accessible to the user, for easy reference, reuse, and updating.
Code stored on the non-transitory computer-readable storage medium provides instructions to the processor to perform one or more functions. For example, certain code defines a graphic user interface (GUI) 407 allowing the user to formulate and communicate the query to the database via the data design level 410.
While
As described below, statements 411 in the data design language of the level 410, may reflect the logic of a business rule. Such rules may be modeled from patterns in the database using a decision table, decision tree, or formula. Beneficially, according to embodiments of the present invention, this rule can be expressed in the higher level DDL, rather than as a construct of a lower level programming language.
Expression of the rule in the DDL, allows for the creation of a corresponding rule type column in 404c. As discussed below, this rule type column may or may not be persisted in the database.
Alternatively, a rule type column may be non-transient.
According to certain embodiments, a rule type column may be generic.
A rule type column may alternatively be non-generic.
Processes according to certain embodiments of the present invention may be summarized in the highly simplified flow chart shown in
A second step 484 comprises modeling a business rule from patterns in the data of the database. This modeling can be done utilizing structures such as decision trees, decision tables, or formulas.
A third step 486 comprises expressing the rule in a statement of a data design language. A fourth step 488 comprises posing a query to the database.
A fifth step 490 comprises causing the DDL statement to create a rule type column. A sixth step 492 comprises deriving a value from the database based upon the query and the rule type column. A seventh step 494 of the process comprises displaying the value to a database user in response to the query.
Embodiments of the present invention may offer certain advantages over conventional approaches. One possible benefit is to facilitate creation of rule type columns as part of data definition language. This allows complex rules to be modeled inside the database, and used as part of the column type definition.
Moreover, the rule type columns created a part of the data definition language can reduce the complexity of the database, and also the time consumed during operation (TCO). For example application code logic is minimized, and instances of the processor having to reference the application code are reduced. Moreover, stored procedures and triggers associated with conventional database approaches can be eliminated.
Implementation of the rule type columns in the database also allows more transparency to business users. This is because the rules are now accessible in the higher level DDL, rather than deep within the application code. Because managing complex logic in the form of business rules is much easier than writing code, this accessibility enables users to design and model the rules in an intuitive and non-programmable way.
Furthermore, the rule based approach offered by embodiments of the present invention can facilitate data migration. For example, during data migration columns may have to be migrated from a source to a target based on certain rules. Usually such rules are modeled using a design workbench available with standard tools. One example is the SAP Business Objects Data Services tool. However, utilizing a rule type column expressed by DDL statements, this process can be integrated into the target database itself.
The apparatuses, methods, and techniques described herein may be implemented as a computer program (software) executing on one or more computers. The computer program may further be stored on a non-transitory computer readable medium. The non-transitory computer readable medium may include instructions for performing the processes described.
In the following description, for purposes of explanation, examples and specific details are set forth in order to provide a thorough understanding of various embodiments. It will be evident, however, to one skilled in the art that the present invention as defined by the claims may include some or all of the features in these examples alone or in combination with other features described below, and may further include modifications and equivalents of the features and concepts described herein.
The computer system may comprise a software server. A number of software servers together may form a cluster, or logical network of computer systems programmed with software programs that communicate with each other and work together to process requests.
An example computer system 510 is illustrated in
Computer system 510 also includes a memory 502 coupled to bus 505 for storing information and instructions to be executed by processor 501, including information and instructions for performing the techniques described above, for example. This memory may also be used for storing variables or other intermediate information during execution of instructions to be executed by processor 501. Possible implementations of this memory may be, but are not limited to, random access memory (RAM), read only memory (ROM), or both.
A storage device 503 is also provided for storing information and instructions. Common forms of storage devices include, for example, a hard drive, a magnetic disk, an optical disk, a CD-ROM, a DVD, a flash memory, a USB memory card, or any other medium from which a computer can read.
Storage device 503 may include source code, binary code, or software files for performing the techniques above, for example. Storage device and memory are both examples of computer readable media.
Computer system 510 may be coupled via bus 505 to a display 512, such as a cathode ray tube (CRT) or liquid crystal display (LCD), for displaying information to a computer user. An input device 511 such as a keyboard and/or mouse is coupled to bus 505 for communicating information and command selections from the user to processor 501. The combination of these components allows the user to communicate with the system. In some systems, bus 505 may be divided into multiple specialized buses.
Computer system 510 also includes a network interface 504 coupled with bus 505. Network interface 504 may provide two-way data communication between computer system 510 and the local network 520. The network interface 504 may be a digital subscriber line (DSL) or a modem to provide data communication connection over a telephone line, for example. Another example of the network interface is a local area network (LAN) card to provide a data communication connection to a compatible LAN. Wireless links are another example. In any such implementation, network interface 504 sends and receives electrical, electromagnetic, or optical signals that carry digital data streams representing various types of information.
Computer system 510 can send and receive information, including messages or other interface actions, through the network interface 504 across a local network 520, an Intranet, or the Internet 530. For a local network, computer system 510 may communicate with a plurality of other computer machines, such as server 515. Accordingly, computer system 510 and server computer systems represented by server 515 may form a cloud computing network, which may be programmed with processes described herein.
In an example involving the Internet, software components or services may reside on multiple different computer systems 510 or servers 531-535 across the network. The processes described above may be implemented on one or more servers, for example. A server 531 may transmit actions or messages from one component, through Internet 530, local network 520, and network interface 504 to a component on computer system 510. The software components and processes described above may be implemented on any computer system and send and/or receive information across a network, for example.
The above description illustrates various embodiments of the present invention along with examples of how aspects of the present invention may be implemented. The above examples and embodiments should not be deemed to be the only embodiments, and are presented to illustrate the flexibility and advantages of the present invention as defined by the following claims. Based on the above disclosure and the following claims, other arrangements, embodiments, implementations and equivalents will be evident to those skilled in the art and may be employed without departing from the spirit and scope of the invention as defined by the claims.