Modern firms use complex business systems to define and perform the business processes used by the firms. The business system typically includes a variety of backend applications to perform related tasks and define related processes, such as inventory management, employee management, customer relations, etc. Each application makes use of a variety of business objects, which contain data and business logic to manipulate the data.
Typically, the user interface used to access these backend applications does not include any business or functional logic itself. Rather, the backend applications provide functions and services to the user interface, which provides communication between a user and the applications using the services provided by the applications. Thus, the functionality presented by the user interface is limited by the services exposed by the backend applications.
In many cases the user interface may be created by a different entity than the backend applications. For example, a customer might purchase a generic business system from a supplier, then create (or have created by a second supplier) a customized user interface. Creating the client (frontend) interface may be problematic for a variety of reasons. Often, it requires creating large amounts of functionality to interface with various data sources in the business system. Since each business object and/or backend application might have a different interface, this can require large amounts of time and work. Similarly, data received from various data sources in the business system may have different formatting and structure. To present a consistent user interface, client applications may have to harmonize data received from these disparate sources.
A second problem that may be encountered is that the backend applications may return too much data. Since the services exposed by the backend applications are fixed, there is no way for a frontend client application to define the amount or granularity of data that is received in response to a request. For example, a client application may want to know only those financial transactions that occurred in the last day. If the relevant backend application is only configured to provide transaction data grouped by week, a large amount of unnecessary data will be transmitted to the client. This extraneous data can consume network and local computer resources, in addition to requiring extra processing at the client end.
Another problem can occur when the services exposed by the backend application are designed specifically for creating user interfaces. In some cases, a client interface may want to perform extensive retrieval of data stored in the business objects, such as for data mining operations. Since the exposed services are not designed specifically for data retrieval, it may be computationally prohibitive make a sufficient number of requests to retrieve the desired data. This problem may be compounded when data from multiple business objects and/or nodes is required, since many requests to each node may be necessary.
Thus there is a need in the art for a uniform, flexible way to access the data stored in and services provided by business objects without creating a node- or business object-specific implementation for each node.
Methods and systems for building client-defined queries from structured business object data are provided. The queries may be defined in a business object-specific structured query language (BQL). The BQL engine can translate the structured query into a query suited for use by the appropriate business object. In an embodiment, the BQL engine and the related query language provide the primary interface to backend applications and business objects. Embodiments may include a search infrastructure to create indexed views of business objects and a local client proxy to handle requests that are not handled by indexed views, by operating on a business object directly.
Since the structured query is written in a pre-defined structured language, relatively little code or processing is required to construct the query in a client application. Similarly, a developer or user of the client application can use the structured language to specify the amount and format of data desired, which can decrease the amount of data sent by a backend application in response to the query. Thus, embodiments of the present invention may allow for faster and more efficient client applications.
When a client application 170 sends a request for data and/or services to be provided by the backend applications 150, the request may be formulated using a structured query language. The BQL engine may receive the structured request, and translate it into a native request that can be understood by the target applications and/or business objects contained in the applications. The backend applications 150 may contain typical business objects 190, with each business object having nodes 191, 195, each node storing various elements 192, 193. As described in further detail below, a structured request sent by a client application may reference a specific business object, node, and/or property within one or more of the backend applications.
The BQL engine 100 may include sub-components to realize various functions performed by the engine. For example, a parser 101 may receive, analyze, and/or decompose structured queries received from various requesters 170, 120, 130, 140. An execution decider 102 may determine appropriate business objects to receive translated queries, perform tests to determine efficient query execution strategies, and/or otherwise route translated queries to backend applications. It also may formulate an estimated execution process or time, such as when an “explain plan” request is received with the structured query, and determine whether an indexed view exists that can be used to provide results for the structured query. A native query translation engine 105 may translate the a query into a query format native to a target business object. For example, if the parser 101 decomposes a structured query, the components of the query may be passed to the native translation engine 105, which can use the components to construct a query for processing by a business object, node, or backend application. Other components may be included in or in communication with the BQL engine, such as a fast search infrastructure (FSI) 103 and/or a local client proxy (LCP) 104. The FSI 103 and LCP 104 may provide indexing and other services to enhance query execution within the business system. For example, additional service interfaces may be provided to streamline queries sent to business objects, such as where a FSI engine is used to index data or data structures within business objects. The FSI may maintain indexed views of data stored in the backend, allowing for faster access by a client. The indexed views may be particularly useful when data is requested from multiple business objects and/or nodes. The FSI may be part of the BQL engine or, as further described below, it may be resident on a separate index server.
A structured query such as a BQL call 220 may then be sent to the BQL engine from the client application or the service layer. Generally, the BQL engine may receive structured queries and determine whether to utilize an indexed view or translate them into native queries appropriate for a target application, business object, and/or business object node. In the exemplary process shown in
As a specific non-limiting example,
When a client application, service layer, or other requester 310 wants to extract information from a business object, it may construct a structured query. Still referring to the specific non-limiting example of
When the native queries 340, 345 are received by the backend application 350, a service associated with the native query (such as a “Get_Order” service) may be executed for each query. In this example, the service extracts the information from the nodes and properties identified in the native queries 340, 345. The extracted information typically is returned in a format native to the service, such as the native results 360, 365. Since the backend application, business object, and related services are only aware of the native queries 340, 345 (and not the structured query 300), a separate result may be generated for each query. The native format may use a flat file, data stream, or other data transfer format with a specific structure. The native results 360, 365 may be returned to the BQL engine as the requesting entity. The native results can then be translated into structured results 301 before being sent to the client application or other requester 310. For example, the results may be placed in a table showing related values in common rows, as shown in
It will be understood that the system and communication shown in
The projection clause may include a column specification 411 to identify the part of a business object that should be included in a result, including a business object node or attribute. The column specification may include an identification of the appropriate business object 413 and an identification 412 of the node or part of the business object to be included in the result. The column specification also may identify the node 413 to which the query is directed, as well as any associations 416 desired in the query. Attributes 414 and sub-attributes 415 of the column may be specified. Aliases may be specified for the headings of the result set.
The from clause 420 may specify a business object node from which data is selected by including a name or other identifier 421 of the appropriate node.
The where clause 430 may restrict tuples returned in the result set by specifying one or more conditions that must be met by result tuples. For example, boolean expressions may be included, in which case only the data sets matching the boolean expressions will be included in the result set. As a specific example, if the where clause is “WHERE ID<20,” then only data sets having an attribute ID with a value less than 20 are returned.
In an embodiment, the BQL engine may be configured to perform query responses using search indices and other structures. For example,
Additional exemplary structured queries are presented below. The examples make use of two exemplary business objects, SupplierInvoice and Product, with the structures shown below:
For demonstration purposes, the following exemplary data set will be used. Each table shows the data for one business object node:
A structured query may be used to select all Header nodes of the Supplier Invoice business object. For example, the following query may be used:
SELECT siv˜ID AS id FROM SupplierInvoice.Header AS siv
The result set for such a query contains the IDs of all SupplierInvoice business objects. The type of the result structure may be derived from the projection part of the structured query (i.e., “siv.ID”). In this case, the result structure may contain one element with a simple type. Hence, the result can be represented as a single-column result table, specified by the alias ‘id’:
More complex structured queries may be used, such as queries that include an implicit join of multiple elements. For example, the query
SELECT siv.Party˜Name AS name FROM SupplierInvoice.Header AS siv
provides the Name attribute of the Party node. When the query is translated to a native query format, queries sufficient to extract the relevant data from multiple nodes may be constructed. First, instances of the Supplier Invoice Root node may be selected. For these Root node instances, all Party node instances may be retrieved. The result structure includes the Name attribute of the Party node, which has a simple data type and thus can be represented as a single-column table with one column. The alias for the selected attribute provides the column name for the result table:
A similar structured query may include a further restriction in the WHERE clause:
In this case, only Supplier Invoice Header nodes are selected which have the ID 1:
A system according to the present invention may also return query results in a structured format. Structured results may be suitable for services that allow for structured data, such as a Web Service based query service. In an embodiment, XML or a similar representation format may be used for structured results. For example, the following query may select Supplier Invoice Header nodes and the Item nodes associated with each:
In this query, all attributes of the Header node may be transported. The attributes ProductID and Quantity are returned for the implicitly-joined Item nodes. In XML notation, the results of this query using the above sample data set may be returned as:
As another example, the following query demonstrates the use of an alias in a structured result:
The alias name “MySIV” in the projection provides the name for the element in the structured result set:
The various computer systems described herein may each include a storage component for storing machine-readable instructions for performing the various processes as described and illustrated. The storage component may be any type of machine readable medium (i.e., one capable of being read by a machine) such as hard drive memory, flash memory, floppy disk memory, optically-encoded memory (e.g., a compact disk, DVD-ROM, DVD±R, CD-ROM, CD±R, holographic disk), a thermomechanical memory (e.g., scanning-probe-based data-storage), or any type of machine readable (computer readable) storing medium. Each computer system may also include addressable memory (e.g., random access memory, cache memory) to store data and/or sets of instructions that may be included within, or be generated by, the machine-readable instructions when they are executed by a processor on the respective platform. The methods and systems described herein may also be implemented as machine-readable instructions stored on or embodied in any of the above-described storage mechanisms.
Although the present invention has been described with reference to particular examples and embodiments, it is understood that the present invention is not limited to those examples and embodiments. The present invention as claimed therefore includes variations from the specific examples and embodiments described herein, as will be apparent to one of skill in the art.