A database language is extended to define constraints on a data model (e.g., entity-relationship model) rather than the concrete database. The constraints can be declarative (e.g., constraints that are defined using expressions of the database language) or programmatic (e.g., constraints that are defined as a stored procedure implemented in a domain specific language). By storing the constraints at a higher level than the database level, the constraints can be performed without changing the persistency of the database. Also disclosed are techniques for handling of constraints on partially loaded entities.

Patent
   9176801
Priority
Sep 06 2013
Filed
Sep 06 2013
Issued
Nov 03 2015
Expiry
Apr 02 2034
Extension
208 days
Assg.orig
Entity
Large
23
139
currently ok
1. A computer-implemented method comprising:
defining, by a computer, a constraint on an object of a data model, the data model being configured to define the object as a logical grouping of elements from an underlying database and the constraint being configured to execute a routine to validate an element of the object when a triggering event associated with the object is detected;
compiling, by the computer, the constraint into a runtime artifact associated with the object;
querying, by the computer, the underlying database to form a projection of the object that includes a subset of the logical grouping of elements; and
executing, by the computer, the runtime artifact when the triggering event is detected on the projection.
19. A computer system comprising:
a processor; and
a non-transitory computer readable medium having stored thereon one or more programs, which when executed by the processor, causes the processor to:
define, by a computer, a constraint on an object of a data model, the data model being configured to define the object as a logical grouping of elements from an underlying database and the constraint being configured to execute a routine to validate an element of the object when a triggering event associated with the object is detected;
compile, by the computer, the constraint into a runtime artifact associated with the object;
query, by the computer, the underlying database to form a projection of the object that includes a subset of the logical grouping of elements; and
execute, by the computer, the runtime artifact when the triggering event is detected on the projection.
12. A non-transitory computer readable storage medium storing one or more programs, the one or more programs comprising instructions for:
defining a constraint on an object of a data model specified in a domain specific language, the data model being configured to define the object as a logical grouping of elements from an underlying database and the constraint being configured to execute a routine to validate an element of the object without changing the persistency of the underlying database when a triggering event associated with the object is detected, the routine being expressed using expressions from the domain specific language;
compiling the constraint into a runtime artifact associated with the object;
querying the underlying database to form a projection of the object that includes a subset of the logical grouping of elements; and
executing the runtime artifact when the triggering event is detected on the projection.
2. The computer-implemented method of claim 1, wherein the data model is specified in a domain specific language and the routine is expressed using expressions from the domain specific language.
3. The computer-implemented method of claim 1, wherein the triggering event is explicitly calling the constraint.
4. The computer-implemented method of claim 1, wherein the triggering event is one of saving, modifying, and deleting the object.
5. The computer-implemented method as in claim 1, wherein the triggering event does not change the persistency of the underlying database.
6. The computer-implemented method of claim 1, wherein the triggering event is a change to the underlying database.
7. The computer-implemented method of claim 1, wherein validating the element includes checking a dependency between the element and another element.
8. The computer-implemented method of claim 7, wherein the another element belongs to another object of the data model.
9. The computer-implemented method of claim 1, wherein the routine is configured to output an error or warning according to a setting on the constraint.
10. The computer-implemented method of claim 1, wherein executing the runtime artifact comprises:
determining that the element of the object to be validated by the constraint is missing from the projection of the object;
loading the element into the projection; and
performing the routine on the projection.
11. The computer-implemented method of claim 1, wherein executing the runtime artifact comprises:
determining that the element of the object to be validated by the constraint is missing from the projection of the object;
loading the object into the projection; and
performing the routine on the projection.
13. The non-transitory computer readable storage medium of claim 12, wherein the triggering event is explicitly calling the constraint.
14. The non-transitory computer readable storage medium of claim 12, wherein the triggering event is one of saving, modifying, and deleting the object.
15. The non-transitory computer readable storage medium of claim 12, wherein validating the element includes checking a dependency between the element and another element.
16. The non-transitory computer readable storage medium of claim 15, wherein the another element belongs to another object of the data model.
17. The non-transitory computer readable storage medium of claim 12, wherein performing the runtime artifact comprises:
determining that the element of the object to be validated by the constraint is missing from the projection of the object;
loading the element into the projection; and
performing the routine on the projection.
18. The non-transitory computer readable storage medium of claim 12, wherein executing the runtime artifact comprises:
determining that the element of the object to be validated by the constraint is missing from the projection of the object;
loading the object into the projection; and
performing the routine on the projection.
20. The computer system of claim 19, wherein the data model is specified in a domain specific language and the routine is expressed using expressions from the domain specific language.

Many database structures rely upon Structured Query Language (SQL) as the standard approach to define, read, and manipulate data within a database. The database can include constraints and triggers used to specify rules for data in a database table. A constraint defines properties that data stored in a database must comply with. The constraint can be applied to a column, table, multiple tables, or an entire database schema.

A database trigger is code that is automatically executed in response to an event for the purpose of maintaining the integrity of data on the database. For example, when a new record is added to an employees' table, a new record should also be added in the salaries table for the new employee. The constraints and triggers belong to a Data Manipulation Language (DML) and are used to add data level validation checks (i.e., checks are added to concrete database tables) that are executed when data is modified on a database table. Modification can include executing insert, update, and delete statements.

Violation of a constraint results in reverting the change in the database and writing out a corresponding error message. By definition these constraints and triggers are only applied when data changes in the database table. Thus, there is a need for techniques for expanding the use of constraints and triggers beyond when data is modified within a database table.

A database language (e.g., Structured Query Language or SQL) is extended to recognize declarative and programmatic constraints that are definable on the data model. In one embodiment, a constraint is defined on a data model. For example, the constraint can be defined on an object, such as an entity, that belongs to the data model. The data model can define the object as a logical grouping of elements from an underlying database. The constraint can be configured to execute a routine to validate an element of the object when a triggering event associated with the object is detected. The constraint can be expressed using expressions from a domain specific language associated with the data model. Alternatively, the constraint logic can be expressed as a stored procedure embedded into the program logic. In one example, the domain-specific language can be the domain definition language (DDL).

A computer compiles the constraint into a runtime artifact associated with the object. The computer can then query the underlying database to form a projection of the object that includes a subset of the plurality of elements. When the triggering event is detected on the projection, the computer executes the runtime artifact. In one example, the triggering event can be an explicit call to the constraint in application logic. In another example, the triggering event can be a system event such as saving, updating, or deleting a view or elements in the projection.

Depending on implementation details, execution of a runtime artifact to validate an element not present in the projection can be handled in a variety of ways. In one example, the missing element can be added into the view. In another example, the entity in its entirety can be loaded into the view. In yet another example, a constraint that relies upon a missing element can be skipped.

The following detailed description and accompanying drawings provide a better understanding of the nature and advantages of the present invention.

FIG. 1 shows a simplified view of a database system, according to an embodiment;

FIG. 2 shows an enlarged view of the database structure of FIG. 1;

FIG. 3 illustrates relationships between individual languages making up a language family useful for interacting with a database;

FIG. 4 is a simplified view showing an approach for extending SQL, according to embodiments;

FIG. 5 is a simplified diagram illustrating a process flow, according to an embodiment;

FIG. 6 illustrates hardware of a special purpose computing machine configured to extend database entity-relationship models execution, according to an embodiment;

FIG. 7 illustrates an example of a computer system;

FIG. 8 illustrates the syntax for defining constraints in a data model, according to one embodiment;

FIG. 9A illustrates a programmatic validation invocation scenario, according to one embodiment;

FIG. 9B illustrates a detailed programmatic validation invocation scenario, according to one embodiment; and

FIG. 10 illustrates a simplified view of a process flow, according to an embodiment.

Described herein are techniques for extending a database language to accommodate constraint definitions on enhanced data models. The defined constraints can be used to validate data in a database. By adding the constraint at a higher level (e.g., the data model rather than the database table), data can be validated without changing the persistency of the database. In the following description, for purposes of explanation, numerous examples and specific details are set forth in order to provide a thorough understanding of the present invention. 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 first part of the detailed description describes techniques for defining constraints on an extended data model. The second part of the detailed description describes an exemplary extended data model that accommodates entity-relationship models (ERMs).

Defining Constraints on an Extended Data Model

According to embodiments, a database language is extended such that constraints can be defined on the data model. For example, a domain specific language (e.g., Data Design Language (DDL), Query Language (QL), Expression Language (EL), and Programming Language (PL)) in the family of Core Data Services (CDS) can be extended for constraint definitions. By defining constraints on a higher level than the database table, the constraints can be executed not only during system events that are triggered when data is modified (e.g., inserted, updated, or deleted) in the database, but also manually through explicit calls in application logic to the constraint. This can provide upfront data validation that notifies a user of potential violations that may result from modifying the database without committing the changes thereby affecting the persistency of the database. The database language can be extended to include constraint syntax for defining constraints on the data model. The constraint syntax can specify when the constraint is to be validated (i.e., triggering event). For example, the constraint can be set to only validate data being inserted in the database, data being updated in the database, data being deleted from the database, or a combination of the above. In general, defining constraints as part of the data model has the benefit that the constraints are transparently defined and potentially can be evaluated not only by the engines on the backend but also by other engines. For example, a constraint can validate data received from a user interface. The constraint can be explicitly called by application coding of the user interface to check on entered data before the data is inserted into the database.

Examples of different categories of constraints that can be defined on the data model is given below. Typically, a constraint can be defined as part of a data structure that belongs to the data model. Basic and simple constraints are defined as declarative constraints (i.e., constraints that are defined on the data model using expressions of the database language) while complex constraints are defined as programmatic constraints (i.e., constraints that are defined on the data model via coding). The decision regarding whether to define a constraint using expressions of the database language associated with the data model or as a stored procedure written code of the database language can depend on whether the expressions of the database language can easily express the constraint in a manner that is easy for a developer to read and comprehend. Constraints that are not easily expressed using expressions can be coded in a stored procedure.

Category Examples
Basic NOT NULL
Key fields of entities
SalesOrder → Customer ID must be there
NOT INITIAL (MANDATORY)
Last Change Date must be set (no blank field)
Simple Enum checks (field value part of enum (incl. extensions))
→ Relevance for LLVM/HANA Engine and possible benefits due to
compiling → no dictionary lookup
Which ENUMS → stable lists → not too many values
Foreign key → Difference between Associations/Compositions → Severity of check
existence checks SalesOrder has to have at least one item (associated entity
(associations? (composition)) → Cardinality check
Compositions!)
Dependent values Amount has to have a currency if the amount value is not initial
or value domains Currency to be checked against the allowed currencies (value
domain)
Currencies that are set via configuration as allowed
currencies
Some product is only allowed to be shipped into defined countries
(e.g. guns not into near-east)
salesOrder.Product.allowedShipmentCountries ~=
salesOrder.deliverAdress.country
Field dependencies German address (country code = DE), the postal code has to be set
(values of one field (NOT INITIAL), for US address (country code = US), the zipcode has to
depend on values of be set (NOT INITIAL)
other fields)
Application SalesOrder.Customer has to exist (existence check on customer ID)
Constraints and customer has to have status “released”
To allow shopping on invoice, a customer has to have at least one
other order where he paid
Discount 10% only allowed if order volume >500$ (configurable) and
customer has A-Rating, else only 5% discount

Defining Constraints on an Extended Data Model

A domain-specific language is extended to accommodate the definition of constraints on a database object of the data model. The database object can be an entity or other data structure of the data model. A constraint can be defined using expressions of the domain specific language (e.g., declarative constraints) or as a stored procedure (e.g., programmatic constraint). While the examples herein discuss defining constraints on an entity of the data model, it is understood by one of ordinary skill in the art that the constraints can also be defined on other database objects of the data model.

FIG. 8 illustrates the syntax for defining constraints in a data model according to one embodiment. Constraint syntax 800 can be defined on an entity of a data model and be invoked automatically by the system as part of a validation process, part of a save process, or manually through explicit calls to the entity. The constraint would be saved as a function of the entity and can be called by an instance of the entity. In one example, a domain specific language such as the data definition language (DDL) can be extended to include constraint syntax 800.

Constraint syntax 800 includes a plurality of fields for defining a constraint to be stored on the entity. In some embodiments, one or more of these fields can be optional. Constraint syntax 800 includes name field 810. Name field 810 can specify the name of the constraint. In one embodiment, the value given to name field 810 can be checked to ensure that the value is unique within the surrounding construct (e.g., entity). In other words, the name of the constraint can be verified as being unique with respect to the elements and actions associated with the entity. If name field 810 is not set, the constraint is an anonymous constraint that cannot be explicitly called.

Constraint syntax 800 further includes on-clause 820. On-clause 820 is configured to define when the constraint is to be applied based on logical events of the database. If on-clause 820 is set to “on validate,” the constraint is applied according to programmatic validation checks. Thus, the application logic can explicitly call the constraint to be applied. Alternatively, setting on-clause 820 to “on validate” can result in the constraint being applied as part of a built-in validation function that belongs to the entity. For example, the entity can be validated automatically according to validation logic. When the on-clause of an entity is set to “on validate,” the constraint can also be applied during validation of the entity. In some examples, “on validate” can be the default setting if on-clause 820 is not set. If on-clause 820 is set to “on save”, the constraint is applied when a save occurs on the entity. In some examples, saving an entity includes validating the entity first and thus, constraints that have been set to “on validate” are also performed along with the constraints that have been set to “on save” when data is saved on the entity. If on-clause 820 is set to “on change,” the constraint is validated when data changes are made on the entity. The change can be an insert, update, or delete of data related to the entity.

Constraint syntax 800 further includes for-clause 830. As described above, a constraint can be validated when a change is made to an entity if on-clause 820 is set to “on change.” For-clause 830 can further define when the constraint is to be validated by specifying what type of change triggers the constraint. If for-clause 830 is set to “for insert,” the constraint is validated when a new record is created. If for-clause 830 is set to “for update,” the constraint is validated when a data associated with the entity changes. If for-clause 830 is set to “for delete,” the constraint is validated when a record is deleted. This cause can be useful for constraints that validate across multiple entities. For example, the for-clause can be set to “for delete” when the constraint checks if deletion of one record can lead to a violation with another record. For instance, deleting an employee record should also lead to the deletion of a salary record that is associated with the deleted employee.

Constraint syntax 800 further includes output field 840. Output field 840 can specify the severity of the constraint by setting what is output when the constraint is violated. Output field 840 can be set to “error” when violation of the constraint leads to outputting an error message. In one embodiment, the modification that induced the violation can also be reverted to avoid the error in the database. Alternatively, output field 840 can be set to “warning” when violation of the constraint leads to outputting a warning. In one embodiment, modifications that lead to issuing a warning are still committed into the database. Thus, a warning may not revert a modification to the database since the modification is committed.

The validation to be performed when a constraint is triggered can be expressed in a declarative or programmatic manner. Depending on the complexity of the constraint, one manner may be selected over the other. For example, simple constraints can be expressed in a declarative manner since they can be easily written using expressions native to the domain specific language. In contrast, complex constraints are expressed in a programmatic manner since they cannot be easily expressed using expressions native to the domain specific language. Examples of simple constraints (e.g., category simple and basic) and complex constraints (e.g., field dependencies and application constraints) are shown in the table above.

A declarative constraint can be expressed using if-clause 850 of constraint syntax 800. If-clause 850 is configured to store an expression that is validated when the constraint is triggered. The expression can be expressed using expressions native to the domain specific language. In contrast, a programmatic constraint can be expressed using check-clause 860 of constraint syntax 800. Check-clause 860 is configured to store a name of a procedure that is called when the constraint is triggered. The procedure, which is configured to validate one or more elements of the entity, can be written using code and called on by the constraint when the constraint is triggered. Thus, the programmatic constraint is bound to the data model and uses a stored procedure to implement the logic for the constraint validation rather than an expression. In other embodiments, more or fewer fields can define the constraint syntax.

In one embodiment, a shorthand version of constraint syntax is be available to simplify the creation of constraints. A shorthand version of constraint syntax 800 is given below:

constraint [<name>] “{” <expression> “}”;

This shorthand version is equal to the constraint below:

constraint [<name>] on validate error if “{” <expression> “}”

An example of constraints defined on an entity is given below. As shown, the entity definition includes five constraints. The first four are declarative constraints expressed using expressions of the domain specific language while the last one is a programmatic constraint that calls procedure “myProcedure.” As shown, the constraints do not specify a triggering event and thus are triggered manually using explicit calls to the constraint.

entity salesOrder {
key ID : integer NOT NULL;
customer : association to customer;
OrderDate : date;
createdBy : string;
lastChangeDate : date;
amount : amount {
value : float
currency : currency
}
// Assert: lastChangeDate NOT INITIAL
 constraint ChangeDateMissing error if { this.lastChangeDate = 0 }
// constraints on amout
constraint CurrencyMissing
error if {this.amount.value != ∅ and this.amount.currency = ‘’ }
constraint InvalidCurrency
error if {this.amount.currency != ‘’ and
!exists(this.amount.currency) }
// expressions navigating to associated entities
constraint InvalidProductCategory error if
{this.item.product.category = ‘foo’) };
 // code-based constraint via procedure
constraint complexValidationLogic error check ‘myProcedure’;
}

An example of a stored procedure that is registered with the above procedural constraint “complexValidationLogic” is given below. A stored procedure can receive one or more inputs and output a result. The domain specific language can be extended to include a result type for outputting the result of validating a constraint. As shown, the procedure “myProcedure” receives theRecord salesOrder as an input and outputs a result $salesOrderCheckResult. The constraint can be implemented using coding within the stored procedure.

CREATE PROCEDURE myProcedure (
IN theRecord salesOrder // $this: the entity on which the constraint
is checked
OUT result $salesOrderCheckResult )
LANGUAGE SQLSCRIPT READS SQL DATA
{WITH RESULT VIEW <view_name>}}
AS
BEGIN
[...] // constraint implementation
END

Consuming Constraints Stored on the Extended Data Model

After the constraints are stored on the extended data model, they can be consumed during processing of the database. In one embodiment, programmatic validation invocations can be added to the code of the application logic to explicitly call constraints stored on the data model. In another embodiment, system controlled validations can ensure that data being saved in the database remains consistent to preserve the integrity of the database.

Programmatic validation invocations include explicitly calling a constraint in the code of the application logic to validate an entity. In one example, a programmatic validation invocation can be performed when creating or changing a record or when one entity calls another entity, particularly when there is encapsulation between the entities. For example, a check function in one entity can result in calling a constraint in another entity. These constraint checks can be performed on the data records without saving the data in the database. Thus, the constraints can serve to verify that modifying the database will not

generate constraint violations. FIG. 9A illustrates a programmatic validation invocation scenario according to one embodiment. Scenario 900 includes user interface 910 that includes button 915. A user can enter data in input fields of user interface 910 and select button 915 to check the data for consistency before committing the data into the database. In one example, the entered data can be values for elements of an entity. The entered data is submitted to server 920 as OData and is validated using validation process 925. OData is a web protocol standard providing platform-agnostic interoperability for querying and updating data. OData leverages web technologies such as HTTP, Atom Publishing Protocol (AtomPub), and JSON (JavaScript Object Notation) in order to provide access to information from a variety of applications. The simplicity and extensibility of OData can provide consumers with a predictable interface for querying a variety of data sources. Validation process 925 can include validating the data by calling one or more constraints. In one example, the validation process may not change the persistency of the database. The results of the validation process are presented to the user on user interface 910. Thus, the appropriate warning and error messages can be presented to the user without storing the data on the database.

FIG. 9B illustrates a detailed programmatic validation invocation scenario according to one embodiment. Scenario 900 is a detailed flow diagram of the scenario described in FIG. 9A. As shown, user interface 910 transmits a check/submit request to server 920. The check/submit request includes data entered into the data fields of user interface 910. In response to the request, server 920 calls one or more constraints to validate the entered data. For example, a constraint having a built in function such as check ( ) function can be called to validate the entered data. As another example, a specific stored procedure can be used for validation. An example of a stored procedure is given below.

CREATE PROCEDURE <schema>.SalesOrderValidate (
IN entity SalesOrder
OUT result <CommonValidationResult> )
OUT Boolean Boolean// could be used to return if check was ok ...
could also be error level
LANGUAGE SQLSCRIPT READS SQL DATA
AS
BEGIN
// the logic of the constraint expressions or calls to the coded
constraints
// goes here
END

Calling the procedure and manually validating the results can look like:

mySalesOrders = ...
CALL SalesOrderValidate( mySalesOrders, result );
If result.length( ) > 0 {
// there has been some validation issue
}

While programmatic validation invocations provide the option for adding explicit checks, system controlled validations can ensure that data saved to the database will not affect the integrity of the database. System controlled validations can be provided to ensure that basic data level constraints and application level constraints are validated before data is modified on the database. In one example, a validation constraint can be explicitly tied to commands on the CDS level such that a constraint is first validated before modifying the database through a SQL level modification statement. In other words, the system controlled validation is performed before modifying the database. In another example, the validation constraint can be explicitly added to a SQL statement associated with a command so that the validation constraint is integrated into the DB/SQL execution on a low level.

In some embodiments, a constraint stored on the data model can be compiled into a runtime artifact. For example, a constraint can be compiled into a runtime artifact that is executable by SAP's HANA engine such as an SQL script. Declarative constraints can be translated into queries and SQL-script procedures that are associated with the entity. A result type can also be generated to output the result from the constraint validation. In one example, the result type can be a container configured to store the records that violate the constraint. In another example, the result type can be an array configured to store points to the records that violate the constraint. Programmatic constraints can also be compiled into runtime artifacts. In some examples, a declarative constraint and a programmatic constraint can exist for the same procedure. In these scenarios, a wrapper procedure can be generated that wraps together both the declarative constraint and the programmatic constraint. This can allow the code for both the programmatic constraint and the declarative constraint to remain stable.

Typically, if a new entity record is being added to the database, all the constraints associated with the entity are validated. However, when modifying the entity only affects a subset of the elements in the entity, all the constraints associated with the entity may not be applicable. For instance, constraints that are associated with non-selected elements may optionally be skipped. In one example, a projection of an entity, which contains a subset of the elements in the entity, can be loaded in a query. Changes to the entity that are based off the query may not require validating a constraint that is associated with an element not loaded in the query. The validation of these partially loaded entities can vary depending on implementation details.

In one embodiment, the compiler can load an element of the entity that is missing in the view so that the constraint can be performed. The loading of an element can be an implicit action taken by the compiler. As such, the developer may not be aware of the loading of an additional element.

In another embodiment, the compiler can omit the execution of a constraint that relies on an element missing in a view. Since the element to be validated is missing in the view, it is presumed that the constraint is not violated and thus does not need to be performed. For example, a constraint that relies upon an element of the entity that is not loaded in a view can be skipped. As another example, a constraint that is based on three related elements where two of the elements are present in the view but one is not can also be skipped. In another example, a constraint that is based on three unrelated elements where two of the elements are present in the view but one is not can be validated since validating the constraint can still validate two of the three elements.

In yet another embodiment, the compiler can load all the elements of an entity into the view when performing a constraint that relies on an element missing in the view. The entire entity is loaded by the compiler so that the constraint can be applied to a view containing all the elements of the entity. This is the best option for ensuring the integrity of the database since the constraint is performed on the entity in its entirety.

FIG. 10 illustrates a simplified view of a process flow 1000 according to an embodiment. Process 1000 begins by defining, by a computer, a constraint on an object of a data model at 1002. The data model, which can be an entity-relationship model, is configured to define the object as a logical grouping of elements from an underlying database. The constraint can be configured to execute a routine to validate an element of the object when a triggering event associated with the object is detected. In one example, the data model is specified in a domain-specific language and the routine is expressed using expressions from the domain-specific language. In one example, the triggering event is explicitly calling the constraint. In another example, the triggering event is one of saving, modifying, and deleting the object. In yet another example, the triggering event does not change the persistency of the underlying database. In yet another example, the triggering event is a change to the underlying database. In one example, validating the element includes checking a dependency between the element and another element. The another element can belong to another object of the data model.

Process 1000 then continues by compiling, by the computer, the constraint into a runtime artifact associated with the object at 1004. Once the constraint has been compiled, process 1000 continues by querying, by the computer, the underlying database to form a projection of the object that includes a subset of the plurality of elements at 1006. Process 1000 then continues by executing, by the computer, the runtime artifact when the triggering event is detected on the projection at 1008. Execution of the routine can output an error or warning depending on a setting of the constraint. In one example, executing the runtime artifact includes determining that the element of the object to be validated by the constraint is missing from the projection of the object, loading the element into the projection, and performing the routine on the projection. In another example, executing the runtime artifact includes determining that the element of the object to be validated by the constraint is missing from the projection of the object, loading the object in its entirety into the project, and performing the routine on the projection.

Extended Data Model to Accommodate ERMs

Described herein are techniques for extending a relational model-based database language (e.g., Structured Query Language known as SQL), to accommodate higher level entity-relationship models. In the following description, for purposes of explanation, numerous examples and specific details are set forth in order to provide a thorough understanding of the present invention. 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.

FIG. 1 shows a simplified view of a database system 100, according to an embodiment. In particular, the database system 100 comprises data 105 of the database itself, organized according to a relational model.

A lower layer 106 of the database system comprises calculation logic 108 that is designed to interact with the data 105 itself. Such calculation logic 108 may be performed by various engines (e.g., SQL engine, calculation engine, SQL script) in order to provide basic data definition and processing based on the relational model. Such basic data definition can include defining of data types making up the database, associated metadata, and the database structure (e.g. columns, tables). The lower layer 106 of the database system may include SQL script 110, as well as data structures such as tables 112, views 114, and calculation views 116.

The embodiment presented in FIG. 1 shows HANA, the in-memory database available from SAP AG of Walldorf, Germany, implemented as the database. However, embodiments are not limited to use with this particular database. Examples of other in-memory databases include, but are not limited to, the SYBASE IQ database also available from SAP AG; the Microsoft Embedded SQL for C (ESQL/C) database available from Microsoft Corp. of Redmond, Wash.; the Exalytics In-Memory database available from Oracle Corp. of Redwood Shores, Calif., etc.

Further, while the embodiment presented in FIG. 1 shows the database as comprising an in-memory database, various embodiments could be employed in conjunction with conventional disk-based database systems.

An application layer 118, overlying the calculation logic 108 of the database system 100 comprises control flow logic 120. The control flow logic 120 may be implemented utilizing River Definition Language (RDL) 122 and JavaScript (JS) 124 to reference model concepts such as entities and relationships that are not reflected in basic SQL. This control flow logic 120 may further comprise common languages for defining and consuming data across different containers (e.g. native, ABAP, Java).

As shown in FIG. 1, in order to facilitate the sharing of information across such different containers and thereby promote a more unified environment, the database system 100 may further comprise a Core Data Services (CDS) component 130. CDS component 130 comprises a common set of domain-specific languages (DSL) and services. The CDS component 130 may allow defining and consuming semantically rich data models as an integral part of the database structure, thereby permitting data modeling as well as the retrieval and processing of data to be raised to a higher semantic level that is closer to the conceptual thinking of domain experts. The role of the CDS component 130 is discussed in detail further below.

FIG. 1 further shows client 150 in communication with the HANA in-memory database appliance available from SAP AG. The client 150 includes presentation logic 152 to provide an output 154 comprising data 105 of the underlying database structure in a form desired by a user. Here, the output 154 is shown as a vertical bar chart, but of course this represents only one of a multitude of different ways in which the data may be communicated to a user. The presentation logic 152 may communicate such output in the form of HTML 156, cascading style sheets (CSS) 158, and/or JavaScript 160, or a variety of other user interface technologies.

FIG. 2 shows an enlarged view of the HANA in-memory database structure of FIG. 1. In particular, FIG. 2 shows SQL engine 200, calculation engine 202, and SQL script 204, as part of the lower layer 106 that performs basic data definition and processing based upon the relational model, according to which the data 105 of the database is organized. FIG. 2 also shows the application layer 118 of the database structure of FIG. 1, including the RDL and JS elements of a query engine 119. The application layer 118 further comprises application containers and other host languages 220, including ABAP 222, Java 224, and others 226.

FIG. 2 further shows the CDS component 130 situated between the lower layer 106 and the application layer 118. As illustrated in this figure, the CDS component 130 can be leveraged in any consuming stack variant (stack of software layers located on top of each other), as implemented through the application layer 118. Specifically, services in higher layers can use/consume the services of lower layers. Here, because the application layer sits on top of a data layer in which the CDS component 130 resides, definition and consumption of the semantically rich higher-level models is allowed.

In particular, the CDS component 130 implements higher-level Domain Specific Languages (DSLs) and services based on an entity-relationship model (ERM). The Data Definition Language (DDL) 230 is used for defining semantically rich data models, including the data types, associated metadata, and database organization (e.g., columns and tables). As mentioned throughout, according to embodiments, the DDL may be extended to further enrich these data models through the use of entities and annotations.

The Query Language (QL) 232 is used to conveniently and efficiently read data based on data models. It is also used to define views within data models. The role of the QL 232 and its relation to the DDL 230 is further illustrated in connection with FIG. 3.

The Expression Language (EL) 234 is used to specify calculated fields, default values, constraints, etc., within queries. Calculated fields, default values, and constraints may be specified as well as for elements in data models.

Other elements of the CDS component 130 can include Data Manipulation Language (DML) 236 and a Data Control Language (DCL) 237, both of which may be used to control access to data.

Embodiments as described herein may distinguish between the domain-specific languages DDL, QL, and EL as members of a language family. This approach fosters considerations such as modular design, incremental implementation, and reuse. FIG. 3 is a simplified view illustrating relationships between these language family members. A consistent language experience across the members of the family of FIG. 3 can be achieved by ensuring the languages follow a common style. This can extend to the host programming language, with expressions in DDL, QL, and EL code adopting the same syntax. Utilization of application level domain language(s) as has been described above, can offer certain benefits. One possible benefit is that the application domain level language can avoid the use of “inefficient” and error-prone code.

Take, for example, the following simple data model describing employee information:

entity Employee {
name : String(77);
salary : Amount; // a structured type
orgunit : Association to OrgUnit;
addresses : Association to Address[∅..*] via entity
Employee2Address;
homeAddress = addresses[kind=home]; // introduced later on
}
entity OrgUnit {
name : String(111);
costcenter : String(44);
manager: Association to Employee;
parent: Association to OrgUnit;
}
entity Address {
key streetAddress; key zipCode; city; // omitted type defs
kind : enum { home; business; }
}

Under some circumstances, it may be desired to write a query statement as follows: SELECT id, name, homeAddress.zipCode FROM Employee WHERE . . .

Within that sample snippet, path expressions along relationships are used to fetch data from an associated entity. In the simple data model above, the above query statement is equivalent to the following standard SQL statement:

SELECT e.id, e.name, a.zipCode FROM Employee e
LEFT OUTER JOIN Employee2Address e2a ON e2a.employee = e.id
LEFT OUTER JOIN Address a ON e2a.address = a.id AND
a.type=’homeAddr’
WHERE ...

This statement, however, may already be too complex for many application developers. Thus, code patterns similar to that given below, may be used in some pseudo languages:

customers = SELECT * FROM Customer
foreach c in customers do
write c.id
write c.name
addresses = SELECT * FROM Address a, $Customer2Address c2a
 WHERE a.id = c2a.address AND c2a.customer = :c.id
foreach a in addresses do
if a.type = ‘homeAddr’ then write a.zipCode
end
end

There are several issues with the code presented immediately above. One issue is the use of an imperative coding style with loops in loops, resulting in 1+n queries being executed or too much data being fetched with a SELECT * statement.

The above code represents only a relatively simple case. A more complex case is found in the following example:

SELECT FROM OrgUnit[boardarea= ‘TIP’]
.employees[salary>‘$100,000’] {
addresses[kind=home].city, count(*)
}

The preceding cases illustrate the importance of increasing expressiveness of the languages used in application development (here, the query language). This allows the intent of application developers to be captured, rather than being buried under substantial volumes of imperative boilerplate coding.

Such expressiveness is in turn is fundamental to having optimizations applied by the query engine (in a manner analogous to functional programming vs. imperative programming). This can affect system characteristics, such as its overall performance and scalability. Further, a language's ability to allow developers to draft concise and comprehensive code, can increase developer productivity. It can also reduce the risk of mistakes and also enhance readability, and thus increase the maintainability of the code.

In order to write concise and readable query statements, it is desirable to enrich the data definitions with sufficient metadata (e.g., about associations, semantic types, etc.). Accordingly, embodiments seek to extend the DDL to define data definitions with sufficient metadata, and seek to extend the QL to leverage such definitions.

DDL and QL are declarative, domain-specific languages providing developers with concise ways to express their models and queries. Certain concepts may originate from entity-relationship modeling (ERM). By adding native support for such concepts in the underlying engine of the database, embodiments avoid the impedance mismatch induced by the translation of conceptual models based on ERM into implementations based upon a plain relational model. In particular, writing concise and comprehensive code reduces risks of mistakes and increases readability and maintainability.

Moreover, as the concepts of entity-relationship models may lie at the core of many higher-level models, embodiments are able to capture the semantics of other data models (e.g., RDL-based data models), and share those semantics with database modelers, and/or ABAP of SAP AG, or Java consumers. This reduces fragmentation and the loss of semantics. In addition, since ERM is also the chosen basis for technologies like OData EDM, embodiments can facilitate mapping entities and views to OData entity sets.

Embodiments may employ a functional approach that is based on standard SQL. In particular, the comprehensive, domain-specific nature of DDL and QL allows capturing the intent of application developers, thus avoiding a lack of clarity regarding that intent which can result from large volumes of imperative boilerplate coding. This follows the principles of functional programming and is important for optimizations.

The functional approach may be inherited from SQL. A SQL SELECT statement declares which sub-set of an overall data model is of interest as projections and selections. It may be left to the query engine to determine optimal execution, including parallelizing as appropriate.

In contrast with imperative object traversion patterns, embodiments can speed up many data retrieval use cases. While many of those retrieval cases are not individually expensive, the cumulative impact of this streamlining can have significant impacts on scalability, as it affects all requests over long periods of time.

Embodiments address some of the complexity offered by standard SQL to typical application developers by raising the basis of SQL from plain relational models to the level of conceptual models. This is done by providing native support for ERM in the database system. In this manner, the use of SQL may be reestablished for most application developers, not only for those with the SQL expertise for specific optimization tasks.

Embodiments employ associations in DDL. Specifically, the DDL allows definition of data models as entity-relationship models on a semantically rich level that is close to actual conceptual thought. To achieve this over the conventional relational model of standard SQL, certain concepts are captured by the embodiments described herein.

FIG. 4 is a simplified view showing an approach for extending SQL according to embodiments. As shown in the system 400 of FIG. 4, one concept underlying embodiments as described herein, is the use of entities 401 with structured types, in contrast with a conventional relational database which uses only flat tables. Entities are structured types with an underlying persistency and a unique key 402. Structured types are records of named and typed elements. An entity key is formed of a subset of the elements of the entity that uniquely identify instances. Views are entities defined by a query, which essentially defines a projection on underlying entities.

Another concept underlying entities as described herein, involves employing associations 404 on a conceptual level. This approach contrasts with the conventional use of hand-managed foreign keys. Associations define relationships between entities, and are specified by adding an element with an association type to a source entity 408 that points to a target entity 410. As shown in the FIG. 4, the relationship implemented by the association type, between source entity type and the target entity type, reflects the actual relationship between entities in the overlying ERM model 420. Using the type definition, associations may capture metadata about relationships present in the ERM in a ‘reflectable’ way. According to such a reflectable characteristic, a consuming portion of code receiving a piece of data from the database can get back to the type information (i.e., metadata) provided for the respective elements in the data model.

The association may be complemented by optional further information (e.g., regarding cardinality, which keys to use, additional filter conditions, etc.) up to a complete JOIN condition. According to embodiments, the clause-based syntax style of standard SQL may be adopted for specifying the various parameters without sacrificing readability.

In addition, the extended DDL works with custom-defined Types instead of being limited to primitive types only. The extended DDL may also add other enhancements, such as annotations, to enrich the data models with additional metadata, constraints, or calculated fields.

FIG. 5 is a simplified diagram illustrating a process flow 500 according to an embodiment. In a first step 502, a database is provided comprising data organized according to a relational model.

In a second step 504, a database engine is provided in communication with a database utilizing a language describing the relational model. In a third step 506, an application is provided comprising an entity-relationship model (ERM) including a first entity, a second entity, and a relationship between the first entity and the second entity.

In a fourth step 508, a query engine of the application communicates a query to the database engine utilizing a language extension providing the entity and relationship components of the ERM. The language extension may comprise a first structured entity type including a first key and indicating the first entity, a second structured entity type including a second key and indicating the second entity, and a third structured association type reflecting the relationship. The association type may be complemented with further additional information.

In a fifth step 510, the database engine returns a query result to the query engine based upon the language extension.

Some examples of extension of the SQL database language to provide entities and associations of ERMs, are now given below.

entity Address {
owner : Association to Employee; // can be used for :m associations
streetAddress; zipCode; city; // snipped type defs
kind : enum { home, business };
}
entity Employee {
addresses : Association[∅..*] to Address via backlink owner;
homeAddress = addresses[kind=home]; // → using XPath-like filter.
}
Association to Address;
Association to Address { zipCode, streetAddress };
Association [∅..*] to Address via backlink owner;
Association [∅..1] to Address via backlink owner where kind=home;
Association [∅..*] to Address via backlink owner where zipCode like
‘76*’;
Association [∅..*] to Address via entity Emp2Adr;
Association [∅..1] to Address via entity Emp2Adr where kind=home;
Association [∅..*] to Address on owner=this;
Association [∅..*] to Address on Address.owner._id = Employee._id;
Association to Address on owner=this AND kind=home;

For specifying syntax, embodiments may use a derivate of the Backus Naur Form (BNF) family of metasyntax notations used to express a context-free grammar, and which can be relied upon to make a formal description of a computer language. The basic constructs may be summarized as follows:

Construct Notation Comments
definition = Definitions are written with a single equals
sign, e.g. Rule = ...
extension += Extends a definition introduced before by
additional rules
terminal keyword Language keywords are set in bold red
symbol
terminal “.” Single-character language symbols are set in
character double quotes
alternation ... | Pipe symbols separate alternatives, e.g. foo
... and bar | zoo w/ car
grouping ( ... ) Parenthesis group constructs, e.g. (foo |bar)
with car
option [ ... ] Square brackets designate optional constructs,
e.g. [optional]
repetition ...* 0+ repetitions are indicated by appended “*”,
e.g. zeroOrMore*
repetition ...+ 1+ repetitions are indicated by appended “+”,
e.g. oneOrMore+
comment -- ... Comments start with a double-dash, e.g. -- this
is a comment

Syntax for SQL extended to include entities and associations as described herein, may be described as follows:

AssignedType += | AssociationType
AssociationType = Association [ cardinality ] ( to targetEntity ) [
 managedJoin | unmanagedJoin ]
cardinality = “[” [( maxs |* ) “,” ] [ min .. ] ( max|* ) “]” | “[ ]”
targetEntity = QualifiedName
managedJoin = ( forwardLink | backwardLink | mediatedLink ) [ where
 filterClause ]
forwardLink = “{” foreignKeys “}”
backwardLink = via backlink reverseKeys
mediatedLink = via entity entityName
foreignKeys = targetKeyElement [ AS alias ] [ “,” foreignKeys ]
reverseKeys = targetKeyElement [ “,” reverseKeys ]
targetKeyElement = elementName ( ″,″ elementName )*
unmanagedJoin = on filterClause

From DDL perspective, association is a new primitive type that is specified with the type name Association, followed by several parameter clauses to specify requisite metadata. These parameter clauses are as follows:

Cardinality allows specifying the relationship's cardinality in the form of [min .. max], with max=*denoting infinity and “[ ]” as a shorthand for [0.. *]. As a default, if omitted [0..1] is used as the default cardinality. An example is:

Association[ ] to Address via backLink owner;

To targetEntity specifies the association's target entity. A qualified name is expected, referring to another entity (incl. views). Specifying the target is mandatory—there is no default.

{foreignKeys} allows specifying a combination of alternative key elements in the target entity, to be used to establish the foreign key relationship. Where a key element is in a substructure on the target side, an alias name is to be specified. Further details are provided below regarding associations represented as foreign key relationships.

If omitted, the target entity's designated primary key elements are used. The following are examples:

Association to Address { zipCode, streetAddress };
Association to Address { some.nested.key AS snk };

Another parameter clause is VIA backlink: reverseKeys. For l:m associations, it is mandatory to specify target elements, which are expected to be a key combination matching the source's primary keys or an association referring to the source entity. An example is:

Association to Address via backLink owner;

Another parameter clause is VIA entity: entityName. For m:m associations, it is mandatory to specify a link table's entity name. That name can either refer to a defined entity or a new entity will be created as follows:

entity <entityName> {
<nameOfSourceEntity> : Association to <SourceEntity>;
<nameOfTargetEntity> : Association to <TargetEntity>;
}

If the data model contains an explicit definition of the link table entity, that entity must adhere to the template shown above. It can, in addition, add other elements. An example is given below:

Association to Address via entity Employee2Address;
entity Employee2Address {
employee : Association to Employee;
address : Association to Address;
}

The WHERE filterClause allows specifying additional filter conditions that are to be combined with the JOIN conditions. This can be especially relevant in combination with VIA backlink or entity clauses. Depending on the filterCondition this can reduce a base :m relationship to one with a:l cardinality. An example is given below:

Association to Address[Ø..1] via backLink owner where kind=home;

The ON filterClause allows fully specifying an arbitrary join condition, which can be any standard SQL filter expression. Using this option results in the respective association being user-managed. That is, no foreign key elements/fields are created automatically. The developer is expected to explicitly manage the foreign key elements, including filling them with appropriate foreign key values in write scenarios. An example is given below:

Association to Address on owner=this;

Element names showing up in VIA, WHERE, and ON clauses, are resolved within the scope of the target entity's type structure. Siblings can be referred to by prefixing an element with a “.”. Elements from the scope above can be referred to by prefixing an element with “. . . ”, etc.

In addition, the outer entity's top-level scope can be referred through the pseudo variable “this”, which is described further below in connection with Pseudo Variables in QL.

According to embodiments, associations are represented as foreign key relationships. In the relational model, associations are mapped to foreign key relationships. The foreign key elements are usually created automatically as described in the following sections. In particular, an element with association type is represented as a nested structure type containing foreign key elements corresponding to the target entity's primary key elements—i.e. having the same names and types. The following are examples of definitions which may be given:

entity Employee { ...
address1 : Association to Address;
address2 : Association to Address { zipCode, streetAddress };
addresses : Association to Address[∅..*] via backlink owner;
}

In this example, the association elements would implicitly be defined with a nested structure type containing foreign key elements in the :1 cases (plus additional metadata about the association) as follows:

entity Employee { ...
address1 {
_ID : type of Address._ID;
}
address2 {
zipCode : type of Address.zipCode;
streetAddress : type of Address.streetAddress;
}
addresses { /* none at all since :m */ }
}

Following the rules for mapping structured types to the relational model as specified above, the underlying table would be created:

CREATE TABLE Employee ( ...
“address1._ID” Integer,
“address2.zipCode” String(...),
“address2.streedAddress” String (...)
)

Rules for representing associations in the persistence model may apply, as indicated in the table below:

If . . . is for to-one cases, e.g. [0 . . . 1] for to-
specified many cases
<no join Nested foreign key elements are created not allowed
clause> for target's primary key elements.
{ foreignKeys } Nested foreign key elements are created
for the elements specified in
foreignKeys.
VIA backlink No nested foreign keys are created; instead the
reverseKeys reverseKeys are expected to link back from
target to source.
VIA entity No nested foreign keys are created; instead the link
entityName table named entityName is created/used as
described above.
ON No nested foreign key elements are created; managing
joinCondition the foreign key relationship is completely
up to the developer.

Consistent with the approach in SQL, no plausibility checks are enforced (e.g., checking whether target key elements specified in {foreignKeys} fulfill the uniqueness requirements). Also, no implicit referential integrity checks are enforced at runtime.

According to embodiments, associations may be in custom-defined types. As associations are special types, they can principally be defined not only for elements in entity definitions, but in type definitions in general. For example, the following definition of the association Amount.currency is valid DDL content:

entity Currency { // List of pre-defined Currencies
key code : String(3);
description : String(33);
}
type Amount {
value : Decimal(10,2);
currency : Association to Currency;
}

An actual relationship between entities is established when using the type Amount for an element within an entity definition, as in:

entity Employee {
salary : Amount;
address : Association to Address;
}

The code shown above essentially indicates that the entity Employee has two associations—one association is to Address and another association is to Currency within its salary element.

Associations in custom-defined types may only be supported for a simple “to-one” relationship with a foreign key on the source side. That is, associations with via backlink or via entity clauses may not be supported for elements in custom-defined types.

Associations in Query Language (QL) are now discussed.

Querying Associations with :m Cardinality

Resolving associations or compositions with l:m cardinality using path expressions or nested projection clauses with the flattening operator “.” in place results in flat result sets with duplicate entries for the 1: side, which is in line with standard SQL JOINs and the relational model.

As examples, in the following queries, “addresses” refers to an association with “to-many” cardinality [0..*]:

SELECT name, addresses.city FROM Employee;
SELECT name, addresses.{ zipCode, city } FROM Employee;

The result sets for the example queries above, are shown below, each with the same value for name repeated/duplicated for each found entry on the :m Address side:

<Result Set 1> { name, city }
<Result Set 2> { name, zipCode, city }

Embodiments also allow the return of ‘Deep’ Result Sets. Specifically, in addition to the standard flattening behavior, the introduction of nested projection clauses and structured result sets principally allows expression of ‘deep’ queries along :m associations. These deep queries return ‘real deep’ result sets having the l: sides elements on a top level, with nested tables/sets for the :m sides.

For example, the deep query:

SELECT name, addresses {zipCode, city} FROM Employee;

would be expected to return a result set with a nested collection as shown below:

<Result Set> {
name,
addresses : <collection of> Address { zipCode, city }
}

Such deep querying may provide certain benefits. One possible benefit is to allow retrieving larger structures through a single query.

Currently, in the absence of deep querying, such larger structures may frequently be obtained in a brute-force approach, through 1+n queries with n being the number of records returned by a 1: side query. This is detrimental to performance, particularly if such a query spans several levels of to-many associations.

While the other extensions can be realized by translating to standard SQL queries, this one requires adding special support deep within the query engine. The absence of such support may preclude using to-many associations in the non-flattened way. This is discussed further below in the associations of FROM clauses, regarding how association trees can be traversed.

Associations in WHERE Clauses

Associations can arise not only in projection clauses but also in filter conditions in WHERE clauses. Respective comparison operators may be enhanced to support associations, as depicted in the following examples:

1. SELECT ... from Emloyee WHERE orgunit={ _id: ‘4711’ };
2. SELECT . . . from Emloyee WHERE homeAddress={
zipCode: ‘76149’, streetAddress: ‘Vermontring 2’
};
3. SELECT ... from Emloyee WHERE orgunit=‘4711’;
4. SELECT ... from Emloyee WHERE homeAddress.city like
‘Wall%’;
5. SELECT ... from Emloyee WHERE homeAddress.city IN
( ‘Walldorf’, ...);
6. SELECT ... from Emloyee WHERE address IS NULL;
7. SELECT ... from Emloyee WHERE
address[kind=home].city = Walldorf’;
8. SELECT ... from Emloyee WHERE homeAddress =
addresses[kind=home];

Several issues arising within the examples immediately above, may be worthy of note. In connection with:

The above provides just a few examples to give the idea. In general, every condition that is possible with standard SQL expressions shall be possible to do with associations as well, including sub queries with exists and not exists, etc.

Associations in FROM Clauses

Embodiments may also allow associations in FROM clauses. Specifically, host languages may provide support for representing associations as typed variables or elements. This is described below in connection with association types in host languages.

Accordingly, one can traverse along associations, as shown in the following examples (in some pseudo language):

var daniel = SELECT name, homeAddress FROM Employee WHERE
name=’Daniel’;
// ... and somewhat later, maybe at some other place in an
application...
var addresses = SELECT * FROM Address WHERE
this=daniel.homeAddress;

The expression this=<an association> can be used. The comparison this=<an association> can be retrieve an entity by a given association. The pseudo variable this is always an alias for the entity given in the FROM clause. Therefore, the statement above actually resolves to:

SELECT * FROM Address this WHERE this=daniel.homeAddress;

The comparison this=<an association> compares a queried entity with a given association—the association must be of type Association to <queried entity>[. . . ]. This expands to a WHERE clause corresponding to the ON condition resolved from the association. In this case it would actually resolve to:

SELECT * FROM Address this
WHERE this.zipCode = daniel.homeAddress.zipCode
AND this.streetAddress = daniel.homeAddress.streetAddress
AND this.type = ‘home’;

Embodiments may also allow the use of SELECT from association. Specifically, association-traversal code patterns like the one below are frequently seen:

SELECT * from Address WHERE this=daniel.homeAddress;

An association in general, and a programming language variable with association type support in particular, carries all information about a target record—essentially providing information as to which entity goes with which key. Thus equivalent to the query above, embodiments allow the shorthand below for traversing associations:

SELECT * from daniel.homeAddress;

In general, a query statement of the form SELECT . . . from <someAssociation> expands to:

SELECT ... from <someAssociation>.<targetEntity> WHERE
this=<someAssociation>;

Here, <targetEntity> signifies the metadata associated with the association corresponding to the target entity specified in the association's declaration using the ON targetEntity clause.

JOINs Declare ad-hoc Associations

Embodiments allow JOINs to declare ad-hoc associations. In the case of a missing association, the standard JOIN <target> ON <join condition> clauses as introduced in SQL-92 are still supported, which align with the extensions introduced above, as they naturally introduce associations in an ad-hoc fashion.

For example, in the data model given above, the entity Employee has an association homeAddress, but is lacking a similar association for businessAddress, which can be compensated for using a standard JOIN clause as follows:

SELECT FROM Employee e
ASSOCIATION TO Employee2Address e2a ON
e2a.employee = e
ASSOCIATION TO Address businessAddress ON _id =
e2a.address._id AND kind=business
{
ID, name,
businessAddress { streetAddress, zipCode, city }
}

The expression may follow the syntax below:

JoinClause += | JOIN targetEntity [[AS] Identifier ]
JoinConditionClauses

Other syntax is as discussed above in connection with associations in DDL.

JOIN clauses fit easily into the extensions in DDL and QL. JOIN clauses can be interpreted as an ad-hoc definition of missing associations.

In the example immediately above, the association businessAddress is added. This result is recognized if the projection clause of the example above, is compared to that of the query applied to the domain model if the association were in place (below):

SELECT FROM Employee {
ID, name,
businessAddress { streetAddress, zipCode, city }
}

Embodiments also allow the use of simplified JOIN clauses. In particular, following the observation that JOINs essentially declare ad-hoc associations, embodiments JOINs to be declared using the same clauses that are used to declare associations in DDL. Given this, the above example can be written more easily as follows:

SELECT FROM Employee e
ASSOCIATION TO Address businessAddress VIA entity
Employee2Address
WHERE kind=business
{
ID, name,
businessAddress { streetAddress, zipCode, city }
}

FIG. 6 illustrates hardware of a special purpose computing machine configured to extend database entity-relationship models according to an embodiment. In particular, computer system 600 comprises a processor 602 that is in electronic communication with a non-transitory computer-readable storage medium 603. This computer-readable storage medium has stored thereon code 604 corresponding to a query engine. Code 605 corresponds to a database engine. Code may be configured to reference data stored in a database of a non-transitory computer-readable storage medium, for example as may be present locally or in a remote database server. 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 in order to process requests.

An example system 700 is illustrated in FIG. 7. Computer system 710 includes a bus 705 or other communication mechanism for communicating information, and a processor 701 coupled with bus 705 for processing information. Computer system 710 also includes a memory 702 coupled to bus 705 for storing information and instructions to be executed by processor 701, 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 701. 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 703 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 703 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 mediums.

Computer system 710 may be coupled via bus 705 to a display 712, such as a cathode ray tube (CRT) or liquid crystal display (LCD), for displaying information to a computer user. An input device 711 such as a keyboard and/or mouse is coupled to bus 705 for communicating information and command selections from the user to processor 701. The combination of these components allows the user to communicate with the system. In some systems, bus 705 may be divided into multiple specialized buses.

Computer system 710 also includes a network interface 704 coupled with bus 705. Network interface 704 may provide two-way data communication between computer system 710 and the local network 720. The network interface 704 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 704 sends and receives electrical, electromagnetic, or optical signals that carry digital data streams representing various types of information.

Computer system 710 can send and receive information, including messages or other interface actions, through the network interface 704 across a local network 720, an Intranet, or the Internet 730. For a local network, computer system (710 may communicate with a plurality of other computer machines, such as server 715. Accordingly, computer system 710 and server computer systems represented by server 715 may form a cloud computing network, which may be programmed with processes described herein. In the Internet example, software components or services may reside on multiple different computer systems 710 or servers 731-735 across the network. The processes described above may be implemented on one or more servers, for example. A server 731 may transmit actions or messages from one component, through Internet 730, local network 720, and network interface 704 to a component on computer system 710. 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.

Bader, Andreas, Hutzel, Daniel, Falter, Timm, Schejter, Lior, Baeuerle, Stefan, Zoch, Daniel

Patent Priority Assignee Title
10318253, May 13 2016 SAP SE Smart templates for use in multiple platforms
10346184, May 13 2016 SAP SE Open data protocol services in applications and interfaces across multiple platforms
10353534, May 13 2016 SAP SE Overview page in multi application user interface
10353564, Dec 21 2015 SAP SE Graphical user interface with virtual extension areas
10452646, Oct 26 2017 SAP SE Deploying changes in a multi-tenancy database system
10482080, Oct 26 2017 SAP SE Exchanging shared containers and adapting tenants in multi-tenancy database systems
10579238, May 13 2016 SAP SE Flexible screen layout across multiple platforms
10592509, Mar 01 2017 SAP SE Declarative rules for optimized access to data
10621167, Oct 26 2017 NETWORK NEXT, INC Data separation and write redirection in multi-tenancy database systems
10649611, May 13 2016 SAP SE Object pages in multi application user interface
10657276, Oct 26 2017 SAP SE System sharing types in multi-tenancy database systems
10713277, Oct 26 2017 SAP SE Patching content across shared and tenant containers in multi-tenancy database systems
10733168, Oct 26 2017 SAP SE Deploying changes to key patterns in multi-tenancy database systems
10740315, Oct 26 2017 SAP SE Transitioning between system sharing types in multi-tenancy database systems
10740318, Oct 26 2017 SAP SE Key pattern management in multi-tenancy database systems
10915303, Jan 26 2017 SAP SE Run time integrated development and modification system
10915551, Jun 04 2018 SAP SE Change management for shared objects in multi-tenancy systems
10936624, Jun 12 2018 SAP SE Development and productive use of system with parallel use of production data and zero downtime of software changes
10942892, May 18 2018 SAP SE Transport handling of foreign key checks
11360977, Apr 01 2019 SAP SE Selectively allowing query optimization in query processing
11561956, Oct 26 2017 SAP SE Key pattern management in multi-tenancy database systems
11860715, Nov 08 2021 SAP SE Messaging for OData error targets
9442977, Sep 06 2013 SAP SE Database language extended to accommodate entity-relationship models
Patent Priority Assignee Title
5761493, Apr 30 1990 Texas Instruments Incorporated Apparatus and method for adding an associative query capability to a programming language
5999908, Aug 06 1992 LODSYS GROUP, LLC Customer-based product design module
6038558, Oct 17 1997 GROUP 1 SOFTWARE, INC Extensible database retrieval and viewing architecture
6195709, Jul 24 1997 International Business Machines Corporation Method of providing persistency for transient objects in object oriented technology
6516310, Dec 07 1999 iAnywhere Solutions, Inc System and methodology for join enumeration in a memory-constrained environment
6560598, Sep 21 1998 Microsoft Technology Licensing, LLC Internal database validation
6567798, Sep 29 1999 International Business Machines Corporation Method and system for consistent updates of redundant data in relational databases
6631382, Jan 02 1996 SALESFORCE COM, INC Data retrieval method and apparatus with multiple source capability
6732084, Dec 22 1999 TERADATA US, INC Method and apparatus for parallel execution of trigger actions
6799184, Jun 21 2001 SYBASE, INC Relational database system providing XML query support
6836777, Nov 15 2001 WHOWHATWARE, LLC System and method for constructing generic analytical database applications
6898603, Oct 15 1999 Microsoft Technology Licensing, LLC Multi-dimensional data structure caching
6938041, Apr 30 1999 SYBASE, INC Java-based data access object
6996568, Jun 20 2001 MICROSTRATGEGY INCORPORATED System and method for extension of data schema
7107497, Sep 30 2002 Oracle America, Inc Method and system for event publication and subscription with an event channel from user level and kernel level
7194744, Dec 17 2002 International Business Machines Corporation System and method for dynamic exception handling using an external exception handler
7225197, Oct 31 2002 ElecDeCom, Inc. Data entry, cross reference database and search systems and methods thereof
7290181, Jan 05 2004 GOOGLE LLC Apparatus and method for context-sensitive error event notification
7302447, Jan 14 2005 ServiceNow, Inc Virtual columns
7305414, Apr 05 2005 Oracle International Corporation Techniques for efficient integration of text searching with queries over XML data
7340451, Dec 16 1998 SACCO, GIOVANNI Dynamic taxonomy process for browsing and retrieving information in large heterogeneous data bases
7380169, Sep 24 2004 Intel Corporation Converting merge buffer system-kill errors to process-kill errors
7398530, Nov 20 2001 Cisco Technology, Inc. Methods and apparatus for event handling
7421448, Dec 20 2004 SAP SE System and method for managing web content by using annotation tags
7434230, Dec 02 2004 International Business Machines Corporation Method and system for time bounding notification delivery in an event driven system
7481368, Dec 14 2004 Siemens Corporate Research, Inc Systems, devices, and methods for managing RFID data
7505983, Jun 26 2006 SAP SE Extending data flows
7523090, Jan 23 2004 Niku Creating data charts using enhanced SQL statements
7640357, Apr 30 2004 SAP SE Transmitting enterprise messages based on buffer sizes
7653828, May 28 2004 SAP SE Timeout manager
7680782, Oct 18 2006 TWITTER, INC Method to generate semantically valid queries in the XQuery language
7689612, Apr 19 2007 SAP SE Handling of queries of transient and persistent data
7693819, Dec 29 2005 SAP SE Database access system and method for transferring portions of an ordered record set responsive to multiple requests
7761481, Mar 14 2005 Microsoft Technology Licensing, LLC Schema generator: quick and efficient conversion of healthcare specific structural data represented in relational database tables, along with complex validation rules and business rules, to custom HL7XSD with applicable annotations
7765222, May 27 2003 SAP SE Query transformation
7765224, Nov 18 2005 Microsoft Technology Licensing, LLC Using multi-dimensional expression (MDX) and relational methods for allocation
7788241, Mar 01 2006 International Business Machines Corporation Method for reducing overhead of validating constraints in a database
7805433, Oct 14 2005 Microsoft Technology Licensing, LLC Multidimensional cube functions
7818754, Nov 30 2000 Microsoft Technology Licensing, LLC Operating system event tracking and logging
7836070, Apr 30 2007 SAP SE Automatic event registration during query execution
7885840, Jan 07 2003 SAP SE System and method of flexible workflow management
7895226, Nov 30 2007 SAP SE System and method for translating and executing update requests
7937401, Jul 09 2004 Microsoft Technology Licensing, LLC Multidimensional database query extension systems and methods
7970823, Sep 02 2004 BLOOMBERG GP FINANCE LLC; BLOOMBERG FINANCE HOLDINGS L P ; BLOOMBERG FINANCE L P System for sharing data objects among applications
7975254, Jun 27 2007 SAP Portals Israel Ltd.; SAP LABS ISRAEL LTD ; SAP Portals Israel Ltd Design-time rules mechanism for modeling systems
7996443, Feb 28 2005 Microsoft Technology Licensing, LLC Schema grammar and compilation
8005850, Mar 15 2004 R2 SOLUTIONS LLC Search systems and methods with integration of user annotations
8010521, Mar 23 2009 SAP SE Systems and methods for managing foreign key constraints
8065323, Feb 23 2009 Oracle International Corporation Offline validation of data in a database system for foreign key constraints
8069184, Dec 29 2006 SAP SE Systems and methods to implement extensibility of tenant content in a provider-tenant environment
8078643, Nov 27 2006 REGIONAL RESOURCES LIMITED Schema modeler for generating an efficient database schema
8122009, Mar 31 2003 HUAWEI TECHNOLOGIES CO , LTD Dealing with composite data through data model entities
8146103, Sep 06 2007 SAP SE Aggregation and evaluation of monitoring events from heterogeneous systems
8185508, Aug 08 2008 Oracle International Corporation Adaptive filter index for determining queries affected by a DML operation
8191081, Sep 06 2007 SAP SE Condition-based event filtering
8209280, May 07 2003 Oracle International Corporation Exposing multidimensional calculations through a relational database server
8214877, May 22 2006 Troux Technologies System and method for the implementation of policies
8219919, Feb 06 2006 JPMORGAN CHASE BANK, N A , AS SUCCESSOR AGENT Method for automating construction of the flow of data driven applications in an entity model
8250094, Jul 19 2006 Microsoft Technology Licensing, LLC Relational lockdown for an item store
8255368, Feb 15 2008 SAP FRANCE S A Apparatus and method for positioning user-created data in OLAP data sources
8281283, Sep 13 2007 SAP SE Model-based integration of business logic implemented in enterprise javabeans into a UI framework
8286916, Jul 13 2007 Airbus Operations SAS Retractable aerodynamic device permitting the control of the wake trajectory of an aircraft trap
8327260, Oct 28 1999 International Business Machines Corporation System for annotating a data object by creating an interface based on a selected annotation structure
8347207, Jul 16 2007 International Business Machines Corporation Automatically moving annotations associated with multidimensional data between live datacubes
8364300, Oct 03 2008 Schneider Electric Software, LLC Retrieving and navigating through manufacturing data from relational and time-series systems by abstracting the source systems into a set of named entities
8364724, Sep 16 2003 The Board of Trustees of the Leland Stanford Jr. University Computer systems and methods for visualizing data
8370400, Jul 19 2010 SAP SE Solution-specific business object view
8375041, Aug 31 2006 Business Objects Software Ltd Processing queries against combinations of data sources
8386916, Dec 29 2008 SAP FRANCE S A Systems and methods to create a multidimensional expression calculated member in a spreadsheet cell
8407215, Dec 10 2010 SAP SE Text analysis to identify relevant entities
8407237, Dec 20 2011 SAP SE System and method of connecting legacy database applications and new database systems
8407262, Aug 30 2007 Industrial Technology Research Institute Systems and methods for generating an entity diagram
8407309, Dec 22 2004 SAP SE Techniques for specifying and determining property information for portal entities using attributes
8412673, Jul 30 2010 SAP SE Persistence of master data in a multi-tenant software delivery architecture
8417732, Feb 04 2004 SAP SE Methods, systems, and software applications for event based data processing
8429176, Mar 28 2008 R2 SOLUTIONS LLC Extending media annotations using collective knowledge
8473506, May 20 2009 Oracle International Corporation Type system for building extensible business applications
8478515, May 23 2007 GOOGLE LLC Collaborative driving directions
8484210, Jun 19 2009 SYBASE, Inc. Representing markup language document data in a searchable format in a database system
8489649, Dec 13 2010 Oracle International Corporation Extensible RDF databases
8504522, Aug 08 2008 Oracle International Corporation Automated topology-based statistics monitoring and performance analysis
8504568, Jan 08 2009 Veritas Technologies LLC Collaborative workbench for managing data from heterogeneous sources
8505032, Jun 23 2010 International Business Machines Corporation Operating system notification of actions to be taken responsive to adapter events
8510296, Sep 24 2010 Hyundai Motor Company; Kia Corporation Lexical answer type confidence estimation and application
8515982, Nov 11 2011 GOOGLE LLC Annotations for three-dimensional (3D) object data models
8805875, Oct 04 2008 STRATACLOUD, INC Systems and methods for information retrieval
20020100014,
20030009649,
20030135850,
20030140036,
20030145255,
20040122817,
20040153435,
20050004904,
20050010565,
20050065958,
20050187952,
20050256889,
20050283459,
20060195460,
20060195476,
20060224634,
20060242104,
20070118501,
20070219976,
20080065862,
20080071799,
20080091691,
20080120604,
20080133530,
20080222159,
20080301168,
20090292730,
20100082646,
20100114935,
20100131568,
20100241637,
20100318499,
20110154226,
20110161371,
20110225176,
20110231454,
20110238437,
20120054142,
20120109661,
20120130942,
20120131392,
20120215768,
20120239987,
20130110879,
20130111310,
20130117346,
20130151560,
20130159354,
20130166602,
20130246355,
20140149180,
20140245079,
20140258777,
////////
Executed onAssignorAssigneeConveyanceFrameReelDoc
Aug 30 2013BAEUERLE, STEFANSAP AGASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0311880471 pdf
Aug 30 2013FALTER, TIMMSAP AGASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0311880471 pdf
Aug 30 2013HUTZEL, DANIELSAP AGASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0311880471 pdf
Aug 30 2013ZOCH, DANIELSAP AGASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0311880471 pdf
Sep 01 2013SCHEJTER, LIORSAP AGASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0311880471 pdf
Sep 06 2013SAP SE(assignment on the face of the patent)
Sep 06 2013BADER, ANDREASSAP AGASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0311880471 pdf
Jul 07 2014SAP AGSAP SECHANGE OF NAME SEE DOCUMENT FOR DETAILS 0336250223 pdf
Date Maintenance Fee Events
Oct 06 2016ASPN: Payor Number Assigned.
Apr 22 2019M1551: Payment of Maintenance Fee, 4th Year, Large Entity.
Apr 26 2023M1552: Payment of Maintenance Fee, 8th Year, Large Entity.


Date Maintenance Schedule
Nov 03 20184 years fee payment window open
May 03 20196 months grace period start (w surcharge)
Nov 03 2019patent expiry (for year 4)
Nov 03 20212 years to revive unintentionally abandoned end. (for year 4)
Nov 03 20228 years fee payment window open
May 03 20236 months grace period start (w surcharge)
Nov 03 2023patent expiry (for year 8)
Nov 03 20252 years to revive unintentionally abandoned end. (for year 8)
Nov 03 202612 years fee payment window open
May 03 20276 months grace period start (w surcharge)
Nov 03 2027patent expiry (for year 12)
Nov 03 20292 years to revive unintentionally abandoned end. (for year 12)