CN111831684A - Data query method and device and computer readable storage medium - Google Patents

Data query method and device and computer readable storage medium Download PDF

Info

Publication number
CN111831684A
CN111831684A CN201910299095.4A CN201910299095A CN111831684A CN 111831684 A CN111831684 A CN 111831684A CN 201910299095 A CN201910299095 A CN 201910299095A CN 111831684 A CN111831684 A CN 111831684A
Authority
CN
China
Prior art keywords
query
attribute
repository
data
main
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910299095.4A
Other languages
Chinese (zh)
Other versions
CN111831684B (en
Inventor
刘荣华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Wodong Tianjun Information Technology Co Ltd
Priority to CN201910299095.4A priority Critical patent/CN111831684B/en
Publication of CN111831684A publication Critical patent/CN111831684A/en
Application granted granted Critical
Publication of CN111831684B publication Critical patent/CN111831684B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to a data query method, a data query device and a computer readable storage medium, and relates to the technical field of computers. The method comprises the following steps: determining the relationship among the business objects and the attribute of each business object according to the metadata of each business object in the received data query request; generating a repository query statement according to the relationship between the business objects and the attributes of the business objects; and executing the repository query statement, and acquiring query result data in the repository. The technical scheme of the data query method and the data query device can improve the applicability and efficiency of data query.

Description

Data query method and device and computer readable storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a data query method, a data query device, and a computer-readable storage medium.
Background
Most information systems have advanced or comprehensive query services. The advanced query or comprehensive query service mainly provides a data query service with customizable query conditions and configurable query results for specific business objects.
In the related art, a specific query condition and a query field are encoded as a query request; and sending the query request to a specified service query server to realize the query aiming at the specific service object.
Disclosure of Invention
The inventors of the present disclosure found that the following problems exist in the above-described related art: the query request cannot be flexibly expanded according to different business objects and business object relations, so that the applicability of data query is poor and the efficiency is low.
In view of this, the present disclosure provides a data query technical solution, which can improve the applicability and efficiency of data query.
According to some embodiments of the present disclosure, there is provided a method of querying data, including: determining the relationship among all the business objects and the attributes of all the business objects according to the metadata of all the business objects in the received data query request; generating a repository query statement according to the relationship among the business objects and the attributes of the business objects; and executing the repository query statement, and acquiring query result data in the repository.
In some embodiments, the attributes of a business object include at least one of a base attribute, a reference attribute, or a dependent attribute, the reference attribute being other business objects referenced by the business object, the dependent attribute being other business objects dependent on the business object; the relations among the business objects comprise reference relations and dependency relations.
In some embodiments, the data query request includes a query body, a query condition, and an output attribute, where the query body is a business object serving as a main query target, the query condition is a condition that an attribute of the query body needs to satisfy, and the output attribute is an attribute of the query body that needs to be output.
In some embodiments, in the case that the output attribute is a reference attribute or a dependent attribute, an attribute of a business object corresponding to the output attribute is nested in the output attribute.
In some embodiments, the generating the repository query statement comprises: analyzing the data query request to generate a corresponding query object group, wherein the query object group comprises a query main object, a query condition object and an output attribute object; and generating the storage library query statement according to the query object group.
In some embodiments, the generating the repository query statement from the query object group comprises: splitting the query object group into a main query segment and a sub query segment according to the relation between the business objects, wherein the main query segment is a query segment aiming at the query main body, and the sub query segment is a query segment aiming at the reference attribute or the subordinate attribute of the query main body; corresponding repository main query statements and repository sub-query statements are generated.
In some embodiments, the executing the repository query statement, and obtaining query result data in the repository comprises: sequentially executing the main query statement of the repository and the sub query statement of the repository, and respectively acquiring a main query result and a sub query result in the repository; and assembling the main query result and the sub-query result into the query result data.
In some embodiments, a business object has a primary key for identifying itself and a foreign key for identifying other business objects corresponding to its reference attribute or its dependent attribute; the assembling the main query result and the sub-query result into the query result comprises: and assembling the main query result and the sub-query result into the query result data according with the data query request according to the main key and the external key of the business object corresponding to the main query result and the sub-query result.
In some embodiments, the query object group is further split into conditional query segments according to the relationship between the business objects, the conditional query segments are query segments that can be completed without depending on other query segments, and the main query segment depends on the query result of the conditional query segment.
In some embodiments, the generating the repository query statement from the query object group comprises: generating a repository conditional query statement corresponding to the conditional query fragment; the executing the repository query statement, and the obtaining the query result data in the repository comprises: executing the repository conditional query statement before executing the repository main query statement, and acquiring a conditional query result in the repository; and assembling the conditional query result, the main query result and the sub-query result into the query result according to the main key and the external key of the business object corresponding to the conditional query result, the main query result and the sub-query result.
In some embodiments, the data query request further includes a query result processing field for at least one of sorting or screening the output attributes.
In some embodiments, the query object population further includes a query result processing object corresponding to the query result processing field.
In some embodiments, the query body further includes a reference attribute or a dependent attribute of the business object.
In some embodiments, the query condition is nested with respect to a dependent attribute or a reference attribute of the query subject.
In some embodiments, the output attribute includes a sub-query condition for determining a condition that an attribute of the query subject that needs to be output satisfies.
In some embodiments, the repository sub-query statement comprises a local repository sub-query statement and an external repository sub-query statement.
According to other embodiments of the present disclosure, there is provided a data query apparatus including: the determining unit is used for determining the relationship among all the business objects and the attributes of all the business objects according to the metadata of all the business objects in the received data query request; the generating unit is used for generating a storage library query statement according to the relation between the business objects and the attributes of the business objects; and the acquisition unit is used for executing the storage library query statement and acquiring query result data in the storage library.
According to still other embodiments of the present disclosure, there is provided a data query apparatus including: a memory; and a processor coupled to the memory, the processor configured to perform the method of querying data in any of the above embodiments based on instructions stored in the memory device.
According to still further embodiments of the present disclosure, there is provided a computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing the method of querying data in any of the above embodiments.
In the embodiment, the relationship between the business objects is determined according to the metadata of the business objects related to the query request, and then the corresponding repository query statement can be flexibly generated for different query requests, so that the applicability and the efficiency of data query are improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description, serve to explain the principles of the disclosure.
The present disclosure may be more clearly understood from the following detailed description, taken with reference to the accompanying drawings, in which:
FIG. 1 illustrates a flow diagram of some embodiments of a query method of data of the present disclosure;
FIG. 2 illustrates a flow diagram of some embodiments of step S2 in FIG. 1;
FIG. 3 illustrates a schematic diagram of some embodiments of query condition classes of the present disclosure;
FIG. 4 illustrates a flow diagram of some embodiments of step S22 in FIG. 2 and step S3 in FIG. 1;
FIG. 5 illustrates a block diagram of some embodiments of a querying device of data of the present disclosure;
FIG. 6 illustrates a block diagram of further embodiments of a querying device for data of the present disclosure;
FIG. 7 illustrates a block diagram of yet other embodiments of a querying device for data of the present disclosure.
Detailed Description
Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, the numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
Meanwhile, it should be understood that the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
In all examples shown and discussed herein, any particular value should be construed as merely illustrative, and not limiting. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
In view of the above technical problems, it is desirable to provide a unified data query method capable of querying different business objects. For example, the data query method can flexibly select a query subject, customize a multi-layer nested query condition and customize a multi-dimensional query result for different business object groups.
Therefore, the query statement with a uniform form suitable for different business objects can be generated based on the metadata for describing the business objects and the corresponding relations thereof, and a uniform data query engine can be realized based on the metadata and the query statement. This can be achieved, for example, by the following embodiments.
Fig. 1 illustrates a flow diagram of some embodiments of a query method of data of the present disclosure.
As shown in fig. 1, the method includes: step S1, determining the relationship and attribute of each service data; step S2, generating a repository query statement; and step S3, obtaining the query result data in the repository.
In step S1, the relationship between the business objects and the attributes of the business objects are determined according to the metadata of the business objects in the received data query request.
In some embodiments, the attributes of the business object may include at least one of a base attribute, a reference attribute, and a dependent attribute. For example, business objects are stored in a repository in the form of relational data tables, and the relationships between the business objects may include reference relationships, dependency relationships, and the like. A business object may have a primary key to identify itself and a foreign key to identify other business objects corresponding to its reference attribute or its dependent attributes.
In some embodiments, the base attribute may be a conventional type of attribute, such as numeric, string, date, etc.; the reference attribute is other business objects referenced (or directly associated) by the business object, for example, a "sales order" has a reference attribute of "customer" as the business object, the "customer" is also a business object, and a plurality of "sales orders" can reference (point to) the same "customer"; the dependent attribute is another business object that is dependent on the business object, e.g., "sales order" has one or more "order details" as its dependent attribute, which "order details" are also a business object itself.
In addition, a plurality of subordinate attributes "order details" can be the same main business object "sales order", that is, "sales order" is the reference attribute of "order details". Thus, the dependent attribute and the master business object together form a bi-directional association of the master business object with the dependent attribute. According to the incidence relation, query sentences in a unified form can be constructed for different business object queries, so that query applicability and efficiency are improved.
In some embodiments, the relationship of business objects may also include an inheritance relationship, i.e., another business object inherited by one business object is its parent business object, and both are parent-child relationships. The parent business object of the business object and the multi-level cascading parent business object of the parent business object can be used as the ancestral business object of the business object together. A business object can inherit all of the attributes of its ancestor business objects at the same time.
In some embodiments, the attributes and relationships of business objects may be obtained through metadata capable of expressing dependencies, reference relationships, and inheritance relationships between business objects. For example, a sales order business group may contain 8 business objects: commcategory (CommCatalogy),
Commodity, Customer, Room, Warehouse, SaleOrder, OrderDetail, CashOrder. The metadata for each business object is defined as follows:
CommMategory { id: character type, code: character type, description: character type };
commmodity { id: character type, code: character type, description: character type, category: Commcategory };
customer { id: character type, name: character type, level: character type };
from { id: character type, code: character type, description: character type, area: decimal type };
warehouse { id: character type, code: character type, description: character type, rooms: Room [ ] };
SaleOrder { id: character type, orderTime (order time): Time, Customer: Customer, Address: character type, PayType:charactertype, order details: OrderDetail [ ] };
OrderDetail { id: character, row No (order line number), comfort:Commodity, quantity:integer, order (master order): SaleOrder, forehouse:Warehouse, price:decimal, paytableAmount:decimal };
CashOrder [ id: character type, cashMode (cash settlement mode): character type, and pageAmount:decimal }.
Wherein, the 'indicates inheritance relationship, and the' indicates a father object; each attribute contained in the service object in the { }; the "()" is interpreted accordingly; "is followed by" is the dependent attribute, and "is the attributes that the dependent attribute contains; "after" indicates the type of the preceding attribute or "after" another business object as an attribute, the attribute is a reference attribute.
Therefore, the relation of the business objects can be obtained according to the metadata, a business object group with complex logic is established, and then the repository query statement aiming at different business objects is generated according to the relation of the business objects.
In some embodiments, the data query request includes a query body, a query condition, and an output attribute. For example, in the case where the output attribute is a reference attribute or a dependent attribute, the attribute of the business object corresponding to the output attribute is nested in the output attribute.
In some embodiments, the data query request further includes a query result handling field. The query result processing field is used for at least one of sorting processing or screening processing of the output attribute. For example, the filtering process may include a page-taking process (taking a certain page of the query result), a top-taking process (taking the first few items of the query result), and so on. For example, the query may be generated using the following formatted statements:
query principal (query filter request) { query output request } order request.
In some embodiments, the query body may be set in a manner that multiple levels of nested business objects are used. For example, the query body may be a business object as a main query target, and may also be a reference attribute, a dependent attribute, or a basic attribute of the business object. In a query statement, a business object and its attributes may be connected with a point number ". -. And the reference attribute or the subordinate attribute of the ancestor business object of the business object can be used as a query subject in a multi-level cascade mode.
In some embodiments, the data query request may be generated by a user according to a formatting statement preset by the system. The preset formatting statement can be set according to the relationship and the attribute between the business objects. For example, the query body may be generated using the following formatting statement:
single query principal | principal alias single query principal (query filter request). subquery principal.
The formatting statement of the single query body nested by the query bodies is: a word; the formatting statement of the sub-query body nested with the query body is:
object attribute name | object attribute name (query filter request). subquery principal.
"word" means a combined string of characters beginning with letters and containing any number of letters, numbers, and underlines; "|" indicates that the context is an "or" relationship.
In some embodiments, the query condition is a condition that the attribute of the query subject needs to satisfy. The query conditions can be set in a multi-azimuth combination nesting mode, namely the query conditions of the internal attributes of the dependent attributes or the reference attributes of the query subject can be nested in the query conditions.
For example, the query condition may be a nesting of a plurality of query requirements such as a relational expression, a combination of query conditions, a paging query condition, an arithmetic operation expression, a reference attribute condition, a dependent attribute condition, an object attribute query condition, and the like. The query terms are wrapped in parentheses and placed behind the query body.
For example, a reference attribute condition is a query for an internal attribute (base attribute, reference attribute, or dependent attribute) of the business object to which the reference attribute corresponds. A point number "may be employed to connect the reference property and its internal properties. The reference attribute condition may also be a query for the reference attribute of an ancestor business object of the master query object, i.e., multiple levels of nesting of reference attributes may occur (nesting may not end until the base attribute of the business object).
For example, a dependent attribute condition is a query for an internal attribute of the dependent attribute. It can be implemented in the form of dependent attribute { internal attribute condition }, which can still be a combination of multiple query conditions (which can be a relational expression). The dependent attribute condition participates in the combination of the query condition with the basic attribute and the reference attribute condition.
In some embodiments, the query conditions may be set using the following formatting statements:
(Single query Filter request) | (multiple query Filter request).
Wherein "" "indicates null. For example, a single query filter request may be generated using a formatted statement of "deduplication condition | attribute condition | paging condition"; the multi-query filtering request may employ a "deduplication condition; attribute condition | attribute condition; paging condition | filtering condition; an attribute condition; paging condition "is generated.
In some embodiments, the deduplication condition may be generated in the form of "$ distint"; the attribute condition may be generated in the form of "single attribute condition | multiple attribute condition".
For example, a single attribute condition may be generated using the following formatting statement:
single attribute ═ attribute value | single attribute single condition | single attribute: { multiple conditions } | single attribute: { attribute conditions }.
The multi-property condition may be generated using the following formatting statement:
a single attribute condition | (multiple attribute condition) | multiple attribute condition, a multiple attribute condition | multiple attribute condition or multiple attribute condition.
The paging condition may be generated using the following formatting statement: page value | $ page value, $ page size $ page value.
The single attribute may be generated using the following formatted statement:
attribute alias base attribute | attribute alias object attribute name single attribute, wherein the object attribute name, attribute alias, base attribute are in the form of words.
The attribute values may be generated using the following formatted statements:
the numeric constant | string constant | boolean constant | $ word.
A single piece may be generated using the following formatted statements:
a single-value operator attribute value | $ multi-value operator [ attribute value list ].
The multiple conditions may be generated using the following formatting statements:
single condition (multi-condition) multi-condition, multi-condition | multi-condition or multi-condition.
Wherein the single value operator may be ═! (ii) a value of ">, < >; the multi-valued operators may be in, nin, continain, not _ continain.
The list of attribute values may be generated using the following formatting statement:
attribute value, list of attribute values.
In some embodiments, a tree structure may be employed to generate query results. The query result can be a tree structure statement with multi-level attributes wrapped in "{ }", thereby realizing any multi-level nesting.
For example, the outermost layer of the multilevel nests may be paging information (how many pages the query results are, how many strips are displayed per page, etc.); a second level of multi-level nesting can be a base attribute of the query body. When the internal attribute of the reference attribute or the dependent attribute is required to be used as a query result, the internal attribute can be wrapped by using the '{ }' and then placed behind the reference attribute or the dependent attribute; in the case where the internal attribute is a reference attribute or a dependent attribute, the internal attribute can be nested in the same manner, and the attributes can be comma-separated.
In some embodiments, the output attribute may also include a sub-query condition for determining an attribute satisfying the sub-query condition that needs to be output. For example, a sub-query condition may be wrapped with "()" after a corresponding attribute.
In some embodiments, the query result may be a list of page attributes or a list of object attributes. For example, the page attribute list may be generated using the following formatting statement:
pageSize, pageNo, totalCount, list { object attribute list }.
The object property list may be set in the following formatting statement:
basic attribute complex attribute basic attribute, object attribute list complex attribute, object attribute list.
The complex property may be generated using the following formatted statements:
object attribute name (query filter request) { object attribute list } sort request.
In some embodiments, the ranking process in the query result processing field is wrapped in "[ ]"; the ranking process may support multiple levels of nesting of attributes in the query results. The object of the sorting process may be a basic attribute or an internal attribute that refers to an attribute.
For example, the query result processing field may be set using the following formatting statement:
[ single-ordering request ] | [ multiple-ordering request ].
Wherein the single ordering request may be generated using the following formatted statements:
single attribute | single attribute desc.
The multiple ordering request may be generated using the following formatted statements:
single-ordering request | single-ordering request, multi-ordering request.
In some embodiments, the received data query request may be:
Figure BDA0002027614710000111
wherein the query subject is CashOrder; the query condition is that the basic attribute cashMode of CashOrder is creditCard, and orderTime is between 2017-05-01 and 2017-05-03 or between 2017-10-01 and 2017-10-07; the query result comprises attributes including basic attribute id, orderTime, reference attribute customer and subordinate attribute details of CashOrder; the sorting in the query result processing field is to sort the files according to the price and sort the CashOrder in a descending order according to the orderTime and the level attribute of the customer.
The reference attribute customer nests basic attributes id, name and level. The dependent attribute detail nests the query condition payableAmount > $ amt, the base attribute id of detail, rowNo, qualification, price, payableAmount, and the dependent attribute commodity of detail. The subordinate attribute commodity nests its basic attribute id, code.
In step S2, a repository query statement is generated based on the relationship between the business objects and the attributes of the business objects.
In step S3, a repository query statement is executed, and query result data is obtained in the repository. For example, a data query engine may be configured to obtain query results according to repository query statements.
In some embodiments, the data query request may be parsed to generate a query object group of the data query engine to express the query request, and then the result data may be queried after being divided into query segments. Therefore, on one hand, the query engine can conveniently analyze the semantics of the query request, and the unified data query can be quickly and efficiently realized; on the other hand, flexible expansion and data acquisition of unified data query semantics can be supported, and horizontal expansion to more underlying repositories is realized.
In some embodiments, step S2 may be implemented by the steps in fig. 2.
Fig. 2 illustrates a flow diagram of some embodiments of step S2 in fig. 1.
As shown in fig. 2, step S2 includes: step S21, generating a corresponding query object group; and step S22, generating a repository query statement.
In step S21, the data query request is parsed to generate a corresponding query object group, where the query object group includes a query subject object, a query condition object, and an output attribute object. The query object group may further include a query result processing object corresponding to the query result processing field. A query request total object corresponding to the data query request total may also be generated.
In some embodiments, a preset query class group may be instantiated according to a parsing result of the data query request to generate a corresponding query object group. For example, the query class includes a query subject class, a query condition class, and an output attribute class. The query class group may also include a query result processing class corresponding to the query result processing field. A query request summary class may also be generated that corresponds to the data query request summary.
In some embodiments, the syntax check may be performed on the searched data query request first. Generating a query object group through verification and delivering the query object group to the next link of the query engine for processing; and if the verification fails, feeding back error information with strong readability. Syntax checking can be performed on the query body, the query condition, the output attribute and the query result processing field respectively.
For example, checking the query subject may include: whether the query bodies of the multi-level cascade are connected with a ". multidot."; whether each query body is a character string with an alphanumeric underline beginning with a letter; whether the query condition contained behind each query body can be checked by the syntax of the query condition. And generating a query main body class after the verification is passed.
For example, the checking of the query condition may include: the method comprises the following steps of paging query condition analysis, duplicate removal condition analysis, single attribute expression condition analysis, single attribute multi-condition query analysis, dependent object attribute query condition analysis, arithmetic expression query condition analysis, combined query condition analysis and expression nested sub-query analysis. And generating a query condition class after the verification is passed.
For example, the verification of the output attribute may include: and checking each attribute in the query result set, checking a sub query result set embedded in the subordinate attribute, checking a sub query result set embedded in the reference attribute, checking the query condition and other query requirements contained in the subordinate object attribute, checking the alias of the query result attribute, and checking the reference attribute of the query result set and the multilayer nested check of the subordinate attribute. And generating an output attribute class after the verification is passed.
For example, checking the query result processing field may include: analyzing and checking the sorting condition and the top-taking condition, and the like. And generating a query result processing object after the verification is passed.
In some embodiments, the query condition classes may be configured according to the structure in FIG. 3.
FIG. 3 illustrates a schematic diagram of some embodiments of query condition classes of the present disclosure.
As shown in FIG. 3, the query condition classes may include: query Condition interface (Condition), pagination Condition class (PagingCondition), deduplication Condition class (disconnectcondition), property Condition interface (property Condition), single property query Condition abstract class (SinglePropertyCondition), arithmetic expression query Condition class (mathoxpressioncondition), composite query Condition class (CompositionalCondition), single property expression Condition class (PropertyExpressionCondition), single property multi-Condition query class (propertymeconndition), subordinate property query Condition class (subordinatedinepropertinentionand) expression nested sub-query class (expququerycondition).
The paging condition class includes pageNo and pageSize of int (integer) type; the deduplication condition class includes coolean (boolean) type isdistintict; the single attribute query condition abstract class comprises PropertyPath of String type; the arithmetic expression query condition class includes an expression of String type, an operationType of Enumeration type, and a value of Object type; the combined query condition class includes a combinationType of an execution type, and a conditionList of a list < condition > (table) type; the single attribute expression condition class comprises an operationType of an execution type and a value of an Object type; the single-attribute multi-condition query class includes combinationType of the execution type, propertyCondList of the List < PropertyCondition > type; the dependent attribute query condition class comprises a combinationType of an execution type and a conditionList of a list < condition > type; the expression nested sub-query class contains a querySpec of the QuerySpec type.
The single attribute query condition abstract class, the combined query condition class and the arithmetic expression query condition class are accessed through an attribute condition interface; the attribute condition interface, the paging condition class and the deduplication condition class are accessed through the query condition interface. The single attribute query condition abstract class comprises a single attribute expression condition class, a single attribute multi-condition query class and a subordinate attribute query condition class; the arithmetic expression query condition class includes an expression nested sub-query class.
In some embodiments, after the query object cluster is generated, attribute checking, semantic checking, and query preparation may be performed on the query request based on the metadata of the business objects.
For example, attribute checking may include: and checking the service objects and attributes thereof of the query main body class, the query condition class, the output attribute class and the query result processing field according to the definition of the metadata of the service objects, and feeding back error information with high readability to problematic attribute query.
For example, semantic checks may include: the semantic validity of the data query request is checked. For example, query conditions and ordering processes may not be set across repositories, paging and top-fetching screens for query results may not be requested simultaneously, and so on.
For example, query preparation may include: loading the query request to the metadata of each service object and the metadata of each attribute; and acquiring the service objects corresponding to the reference attributes and the subordinate attributes, and placing the service objects into the query object group. That is, all definitions of metadata and attributes related to the query are obtained and placed into the query object group
After the query object group is generated, query result data may be obtained through the remaining steps of fig. 2.
In step S22, a repository query statement is generated from the query object group. For example, an SQL (Structured Query Language) Query statement may be generated. In some embodiments, by analyzing the query object group, the whole query may be split into a plurality of query segments, and data acquisition interfaces and specifications corresponding to the query segments may be defined. For example, a query fragment may be completed by invoking an underlying module of the query engine.
In some embodiments, steps S22 and S3 may be implemented according to the steps in fig. 4.
FIG. 4 illustrates a flow diagram of some embodiments of step S22 in FIG. 2 and step S3 in FIG. 1.
As shown in fig. 4, step S22 includes: step S221, splitting the query object group into a plurality of query segments; and step S222, generating each query segment statement.
In step S221, the query object group is split into a main query segment and a sub-query segment according to the relationship between the business objects. The main query segment is a query segment aiming at the query main body, and the sub-query segment is a query segment aiming at the reference attribute or the dependent attribute of the query main body.
In some embodiments, the query object population may also be broken into conditional query fragments. A conditional query fragment is a query fragment that can be completed without relying on other query fragments. The primary query segment depends on the query results of the conditional query segment.
In some embodiments, the sub-query segments (which may include dependent attribute queries, reference attribute queries of external logical repositories, reference attribute queries of internal logical repositories, and the like) and conditional queries may be split from the query object group according to the internal logical relationship of each object in the query object group and the storage logical library information of the metadata of each business object, and the remaining backbone queries are main query segments. Further, a corresponding query request containing the reference between the business objects and each query segment containing the relationship can be obtained.
In some embodiments, where the sub-query fragment is a reference attribute request of an external logical repository (external repository), the query stub information is set at the main query fragment when the sub-query fragment is split. The query stub information may include reference attribute information contained or cached in the local logical repository (local library) (the minimum set may be contained only). The detailed information of the reference attribute not contained in the local library can be split into the reference attribute query fragment of the external library. For example, the reference attribute query segment of the external library not only includes the attribute query stored in the external library, but also includes the attribute query stored in the local library, and the attribute query performed in the external library and the attribute query performed in the local library can be connected by setting the query stub.
In some embodiments, an ordered query segment queue may be formed in the order of the conditional query segment, the main query segment, and the sub-query segments to retrieve data. For example, under the condition that the conditional query segment and the sub-query segment are nested inside the conditional query segment and the sub-query segment, the conditional query segment and the sub-query segment can be recursively split to obtain an ordered query segment queue.
In some embodiments, the conditional query segment and the main query segment may be completed first, and then the sub-query segment is recursively split in the presence of the sub-query segment; sequentially finishing a secondary condition query segment and a secondary main query segment which are split from the sub-query segment; and under the condition that the secondary sub-query segment exists in the sub-query segment, recursively processing the secondary sub-query segment in the above manner until all queries are completed.
In step S222, a corresponding repository main query statement and repository sub-query statement are generated. The repository sub-query statement may include: a dependent attribute store query statement, an external library reference attribute store query statement, and a local library reference attribute store query statement. Repository conditional query statements corresponding to the conditional query fragments may also be generated. For example, the fragment data acquisition interface method and specification defined at the request data computation layer may be implemented based on the components of a relational database and a MongoDB, respectively.
In some embodiments, in the case that the main query segment does not contain the reference attribute, the inheritance relationship of the query body is obtained according to the metadata of the query body in the main query segment, so as to obtain the metadata of all the cascading parent objects. And sequentially generating a select clause, a from clause, a where clause, an order by clause and a limit clause in the SQL main query statement according to the metadata of the query main body and the metadata of all the cascading father objects.
For example, the distint field of a select clause may be set according to whether or not deduplication processing is performed; and generating each attribute field in the select clause according to the output attribute. And acquiring a corresponding main key, and setting a specific alias according to the interface specification so as to assemble the query result data.
For example, the respective relational data tables may be left-connected using a join on command to form a from clause according to the inheritance relationship of the metadata of the query body and the metadata of its cascading parent object. For example, the relational data table of the query subject is at the far left, and the relational data tables of the parent objects are sequentially arranged to the right. The alias names of the relational data tables may be set in the form of T + numbers, respectively (e.g., the numbers may be numbered from 0).
For example, one or more of a single-attribute query condition, a single-attribute multi-condition query condition, an arithmetic expression query condition, a combined query condition class, and a dependent attribute query condition in the query condition object are sequentially generated to constitute a where clause. The combined query condition can be realized by an and or statement; the reference attribute query condition can be realized by a sub-query mode that references a foreign key refId in (reference object internal condition query SQL); the dependent attribute query condition can be realized by a sub-query manner of a primary key Idin (dependent object internal condition query SQL).
For example, the order by clause may be generated from the sort request in the query result processing field.
For example, the limit clause may be generated based on the paging information and the top information in the query request statement. The variables of the condition values in the query statement can be completely reserved and directly put into the SQL query statement.
In some embodiments, in the case where the main query fragment does not contain a reference attribute, the SQL sub-query statement may be divided into the generation of native SQL sub-query statements and foreign SQL sub-query statements.
For example, the generation methods of the select clause, the from clause, the where clause and the limit clause of all the non-reference attributes in the library SQL sub-query statement are similar to the generation method in the case that the main query segment does not contain the reference attribute.
For example, the generation of the external library SQL sub-query statement takes the library query as a base table, and the relational data tables of the reference attributes are connected to the left in sequence by adopting a join statement. The outer library SQL sub-query statement can comprise three sub-sentences of select, from and order by.
And sequentially generating each attribute field of the select clause of the external base SQL sub-query statement according to the output attribute. The field name of the reference attribute is preceded by the table alias (consistent with the table alias naming rules in the where clause). The internal attribute in the reference attribute uses a character string of a reference object attribute name + a point number + an internal attribute name as a query field alias. The specific alias of the foreign key that selects the primary key and each referenced attribute may be set according to the interface specification to assemble the query result data.
And sequentially connecting the relational data tables of the reference attributes and the cascade reference relational data tables thereof to the left through the internal query base table to generate a from clause of the external library SQL sub-query statement. The T + number (which may start with 0) may be set in order as a table alias. The alias of the cascading reference relationship data table may be set to T + number + underline + number, the last number being the order of the internal cascading reference attributes in the query request, which may start with 1.
The order by clause may be generated based on the sort request in the query result processing field.
In some embodiments, in the case that the output request of the dependent attribute query segment does not contain the reference attribute, the generation method of the main query SQL statement in the case that the main query segment does not contain the reference attribute may be adopted to generate the dependent attribute SQL query statement; under the condition that the output request of the subordinate attribute query segment contains the reference attribute, the generation method of the main query SQL statement under the condition that the main query segment contains the reference attribute can be adopted to generate the subordinate attribute SQL query statement, but the where clause also comprises an and condition: the foreign key, i.e., in (Primary query Primary Key information List), used to point to the Primary relationship data Table.
In some embodiments, in the case that the external library reference attribute SQL query does not contain a reference attribute, the generation method of the external library reference attribute SQL query statement is similar to the generation method of the main query SQL statement that does not contain a reference attribute; under the condition that the SQL query of the external library reference attribute contains the reference attribute, the generation method of the SQL query statement of the external library reference attribute is similar to the generation method of the main query SQL statement containing the reference attribute, but the where clause is completely replaced by a main key of the reference attribute, namely in (the main query references the external key information list), and the orderby clause limit clause is not needed.
Step S3 includes: step S31, executing each query segment statement in sequence; step S32, obtaining the result of each query segment; and step 33, assembling into each query segment result.
In step S31, the repository main query statement and the repository sub-query statement are executed in order. The repository conditional query statement, the repository main query statement and the repository sub-query statement may also be executed in sequence.
In some embodiments, variables in the query statement may be numbered sequentially, replaced by a variable processing manner recognizable in the query statement of the underlying repository, and parameters in the query parameter value list are processed correspondingly at the same time. And selecting a corresponding query execution repository according to the corresponding relation between the metadata of the business object and the underlying repository, starting a connection pool, and executing the query statement generated in the previous step.
In some embodiments, the SQL Statement and the query argument may use the Prepared state to pass the query Statement and the query argument (the argument may not be incorporated into the query Statement) to the underlying repository for data query. Other query statements from the repository, such as MongoDB, can be executed according to MongoDB client-side and server-side specifications.
In some embodiments, the most recently used query results may be cached for data that does not change often (e.g., settings in the metadata). For example, a least recently used eviction algorithm may be employed to cache evict data (e.g., commodity centric data).
In step S32, the conditional query result is obtained in the repository. And acquiring corresponding fragment data according to the query fragments. For example, the fragment data acquisition implementation components corresponding to the data storage types may be respectively called according to the data storage types and the underlying repositories configured by the metadata, so as to perform data acquisition corresponding to each query fragment.
In some embodiments, the acquired data may also include data logical relationships between the fragment data. And a connection pool is used for each data source of each data storage type, so that high-efficiency connection of multiple data sources is supported, and the data acquisition efficiency of fragments is improved. A set of interface methods and a logic specification for fragment data acquisition may be provided, with the underlying components implementing multiple fragment data acquisition components of different business object storage types.
In some embodiments, the user needs to query the order placing time, the order placing client name, the order detail order line number and the real payment amount of all the current orders with the order detail real payment amount larger than the maximum order detail real payment amount value before 2019, and the user can input the data query request according to the following structured statement:
Figure BDA0002027614710000191
in some embodiments, the conditional query fragment is a complete data query, independent of the primary query fragment, and may be delivered directly to the underlying component. For example, the "order detail" section in the above embodiment is a query of the maximum order detail payment amount value before 2019, which is a condition value fragment query.
In some embodiments, a main query fragment is a condition value that depends on the results of conditional query execution as query conditions, with the order of execution following the conditional query fragment it contains. Besides the data itself, the corresponding primary key and the foreign key pointing to each reference attribute can be queried through the primary query segment.
For example, the "CashOrder (details: { paidAmount >5000}) { id, orderTime, customer { id } }" section is the main query fragment. The execution of the master query fragment with the query result of the conditional query fragment as a condition may obtain a set of order id (master key) to be stored in the variable $ idList, and may query a set of client id values (foreign key pointing to the reference attribute) to be stored in the variable $ customerIdList.
In some embodiments, where the sub-query segment is a dependent attribute query segment, the sub-query segment depends on a list of primary key information in the query results of the primary query segment. The information list can be placed in a request object of the query segment and handed to the bottom-layer component to achieve segment data acquisition of the sub-query segment. I.e. to implement an information list query of the slave table object associated with the master key information list of the master table. Besides the user request data, the acquisition result can also contain foreign key information pointing to the main object for being assembled with the main object. For example, "order detail in $ ldList { id, row no, payableamino, order _ id order.id }" is a dependent attribute query fragment.
In some embodiments, the sub-query fragment may be a reference attribute query fragment. For example, "Customer (id in $ Customer IdList) { id, name }" is a reference attribute query fragment.
In some embodiments, the reference attribute query fragment may include a native library reference attribute query fragment and an external library reference attribute query fragment.
For example, the library reference attribute query fragment depends on the list of reference foreign key information in the main query fragment result. The reference foreign key information list can be placed in the query segment request object and is handed to the bottom component to realize the data acquisition of the dependent attribute query segment of the library reference attribute, namely, the dependent attribute information list query of the foreign key information list associated reference attribute is realized. Besides the user request data, the obtained result can also contain foreign key information of the reference attribute of the slave attribute pointing to the master object, so as to be assembled with the reference attribute of the master object.
For example, the foreign library reference attribute query fragment depends on the list of reference foreign key information in the main query fragment result. The reference external key information list can be placed in the query segment request object and is delivered to the bottom layer assembly together to achieve the data acquisition of the query segment of the external library reference object, namely the external library object information query associated with the external key information list is achieved. Besides the user request data, the obtained result can also contain the primary key information of the external library reference attribute for being assembled with the reference attribute of the primary object.
In step S33, the main query result and the sub-query result are assembled into a query result. For example, the main query result and the sub-query result may be assembled into the query result according to the main key and the foreign key of the business object corresponding to the main query result and the sub-query result. And assembling the conditional query result, the main query result and the sub-query result into a query result according to the main key and the external key of the business object corresponding to the conditional query result, the main query result and the sub-query result.
In some embodiments, the query fragment data is assembled according to the reference and inclusion relationship between the corresponding business entities of the query fragments in the query fragment queue, and the query result data with the tree-shaped data structure conforming to the unified data query request is formed.
In some embodiments, a user-defined extension interface may be reserved that allows a user configuration to insert personalized data into the query results. For example, the user-implemented extension interface may insert extension information such as _ head { version ═ 1, status ═ … } into each object result data.
In some embodiments, to achieve the association of conditional query fragments with a main query fragment, internal variables may be used to place placeholders for query results for conditional query fragments in the main query fragment. After the condition query fragment queries fragment data, the fragment data serving as parameter values of internal occupancy variables are written into a unified query parameter value list so as to be used for acquiring the main query fragment data. The usage of the internal placeholder variables and the parameter values thereof is completely the same as the usage of the user query condition variables and the parameter values thereof, and is specifically processed by the bottom-layer data acquisition component.
In some embodiments, the fragment data for the main query fragment is assembled into: service entity list paging information; service entity list information; a mapping information list of the primary key of each service entity; each library references a list of mapping information of foreign keys to their corresponding referenced attributes.
In some embodiments, to enable fragment data assembly of a dependent attribute query fragment, foreign key information in fragment data of the fragment may be queried according to the dependent attribute. And circularly inquiring a mapping information list of a main key of the service entity according to the foreign key information, finding the service entity corresponding to each subordinate attribute, and mounting the subordinate attribute into the corresponding service entity.
In some embodiments, the dependent attribute in the fragment data of the fragment may point to the external key of the reference attribute of the service entity according to the dependent attribute of the library reference attribute, and the mapping information list from each library reference external key to the corresponding reference attribute may be circularly searched to find the reference attribute of the master object corresponding to each dependent attribute. And mounting the dependent attribute into the reference attribute of the corresponding main object.
In some embodiments, the foreign key values of the referenced attributes in different master objects may be duplicated, and the dependent attribute list information may need to be mounted multiple times. In code implementation, when all the subordinate attributes are mounted after the first mounting of each subordinate attribute, the original subordinate attribute information is cloned, so that each reference attribute is mounted to an exclusive subordinate attribute information list.
In some embodiments, according to the primary key information of the external library reference attribute in the fragment data of the external library reference attribute query fragment, a mapping information list from each local library reference external key value to a corresponding reference object value is circularly searched, and a query stub object of a primary object corresponding to each external library reference object is found. And merging the external library reference attribute information into the query stub object of the corresponding main object.
In some embodiments, the foreign key of the query stub in different primary objects may be duplicated, and the foreign library reference attribute information needs to be merged multiple times. In code implementation, before each combination of each external library reference attribute, the original external library reference attribute information is cloned, and the cloned information is combined to ensure that each query stub object is combined to correct external library reference attribute information.
In some embodiments, after the reference attributes are merged, the mapping information list from the original primary key values of the external reference attributes to the corresponding primary objects is damaged, so that the dependent attribute information list of the external reference objects cannot be assembled with the external attributes. Thus, the primary object information of the original reference attribute is replaced in the code implementation with the object after the reference attribute is merged. That is, the mapping information list from the primary object primary key value of each reference attribute to the corresponding primary object is reconstructed for further query or dependent attribute and cascading external reference attribute of some external reference attributes.
In the embodiment, the relationship between the business objects is determined according to the metadata of the business objects related to the query request, and then the corresponding repository query statement can be flexibly generated for different query requests, so that the applicability and the efficiency of data query are improved.
Fig. 5 illustrates a block diagram of some embodiments of a querying device of data of the present disclosure.
As shown in fig. 5, the data querying device 5 includes a determining unit 51, a generating unit 52, and an acquiring unit 53.
The determining unit 51 determines the relationship between the business objects and the attributes of the business objects according to the metadata of the business objects in the received data query request. The generating unit 52 generates a repository query statement according to the relationship between the business objects and the attributes of the business objects. The acquisition unit 53 executes the repository query statement, and acquires query result data in the repository.
In some embodiments, the attributes of the business object include at least one of a base attribute, a reference attribute, or a dependent attribute, the reference attribute being other business objects referenced by the business object, the dependent attribute being other business objects dependent on the business object; the relationships between the business objects include reference relationships and dependency relationships.
In some embodiments, the data query request includes a query subject, a query condition, and an output attribute, where the query subject is a business object as a main query target, the query condition is a condition that an attribute of the query subject needs to satisfy, and the output attribute is an attribute of the query subject that needs to be output. For example, in the case where the output attribute is a reference attribute or a dependent attribute, the attribute of the business object corresponding to the output attribute is nested in the output attribute.
In some embodiments, the generating unit 52 parses the data query request, generates a corresponding query object group, and generates a repository query statement according to the query object group. The query object group comprises a query main body object, a query condition object and an output attribute object.
In some embodiments, the generating unit 52 splits the query object group into a main query segment and a sub-query segment according to the relationship between the business objects, and generates a corresponding repository main query statement and repository sub-query statement. The main query segment is a query segment aiming at the query main body, and the sub-query segment is a query segment aiming at the reference attribute or the dependent attribute of the query main body.
In some embodiments, the obtaining unit 53 sequentially executes the repository main query statement and the repository sub-query statement, obtains the main query result and the sub-query result in the repository, and assembles the main query result and the sub-query result into the query result data.
In some embodiments, a business object has a primary key to identify itself and a foreign key to identify other business objects whose referenced attributes or whose dependent attributes correspond. The obtaining unit 53 assembles the main query result and the sub-query result into a query result according to the main key and the foreign key of the business object corresponding to the main query result and the sub-query result.
In some embodiments, the query object group is further split into conditional query fragments by the acquisition unit 53 according to the relationship between the business objects. The conditional query segment is a query segment which can be completed without depending on other query segments, and the main query segment depends on the query result of the conditional query segment.
In some embodiments, the generation unit 52 generates a repository conditional query statement corresponding to the conditional query fragment. Before executing the repository main query statement, the obtaining unit 53 executes the repository conditional query statement and obtains the conditional query result in the repository before executing the repository main query statement. The obtaining unit 53 assembles the conditional query result, the main query result, and the sub-query result into a query result according to the main key and the foreign key of the business object corresponding to the conditional query result, the main query result, and the sub-query result.
In some embodiments, the data query request further includes a query result handling field. The query result processing field is used for at least one of sorting processing or screening processing of the output attribute.
In some embodiments, the query object group further includes a query result handling class corresponding to the query result handling field. The query body may be the business object itself, a reference attribute of the business object, or an dependent attribute base attribute of the business object.
In some embodiments, query conditions are nested within the query conditions that pertain to dependent or referenced attributes of the query subject.
In some embodiments, the output attributes include sub-query conditions that determine conditions that the attributes of the query body that need to be output satisfy.
In some embodiments, the repository sub-query statement comprises a local repository sub-query statement and an external repository sub-query statement.
In the embodiment, the relationship between the business objects is determined according to the metadata of the business objects related to the query request, and then the corresponding repository query statement can be flexibly generated for different query requests, so that the applicability and the efficiency of data query are improved.
FIG. 6 illustrates a block diagram of further embodiments of a querying device for data of the present disclosure.
As shown in fig. 6, the data query device 6 of this embodiment includes: a memory 61 and a processor 62 coupled to the memory 61, the processor 62 being configured to execute a method of querying data in any one of the embodiments of the present disclosure based on instructions stored in the memory 61.
The memory 61 may include, for example, a system memory, a fixed nonvolatile storage medium, and the like. The system memory stores, for example, an operating system, an application program, a Boot Loader (Boot Loader), a database, and other programs.
FIG. 7 illustrates a block diagram of yet other embodiments of a querying device for data of the present disclosure.
As shown in fig. 7, the data query device 7 of this embodiment includes: a memory 710 and a processor 720 coupled to the memory 710, the processor 720 being configured to execute the method for querying data in any of the foregoing embodiments based on instructions stored in the memory 710.
The memory 710 may include, for example, system memory, fixed non-volatile storage media, and the like. The system memory stores, for example, an operating system, an application program, a BootLoader (BootLoader), and other programs.
The data querying device 7 may further include an input/output interface 730, a network interface 740, a storage interface 750, and the like. These interfaces 730, 740, 750, as well as the memory 710 and the processor 720, may be connected, for example, by a bus 760. The input/output interface 730 provides a connection interface for input/output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface 640 provides a connection interface for various networking devices. The storage interface 750 provides a connection interface for external storage devices such as an SD card and a usb disk.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Up to this point, a query method of data, a query apparatus of data, and a computer-readable storage medium according to the present disclosure have been described in detail. Some details that are well known in the art have not been described in order to avoid obscuring the concepts of the present disclosure. It will be fully apparent to those skilled in the art from the foregoing description how to practice the presently disclosed embodiments.
The method and system of the present disclosure may be implemented in a number of ways. For example, the methods and systems of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order for the steps of the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above unless specifically stated otherwise. Further, in some embodiments, the present disclosure may also be embodied as programs recorded in a recording medium, the programs including machine-readable instructions for implementing the methods according to the present disclosure. Thus, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
Although some specific embodiments of the present disclosure have been described in detail by way of example, it should be understood by those skilled in the art that the foregoing examples are for purposes of illustration only and are not intended to limit the scope of the present disclosure. It will be appreciated by those skilled in the art that modifications may be made to the above embodiments without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.

Claims (19)

1. A method for querying data comprises the following steps:
determining the relationship among all the business objects and the attributes of all the business objects according to the metadata of all the business objects in the received data query request;
generating a repository query statement according to the relationship among the business objects and the attributes of the business objects;
and executing the repository query statement, and acquiring query result data in the repository.
2. The query method of claim 1,
the attribute of the business object comprises at least one of a basic attribute, a reference attribute or a dependent attribute, wherein the reference attribute is other business objects referenced by the business object, and the dependent attribute is other business objects dependent on the business object;
the relations among the business objects comprise reference relations and dependency relations.
3. The query method of claim 2,
the data query request comprises a query main body, a query condition and an output attribute, wherein the query main body is a service object serving as a main query target, the query condition is a condition which is required to be met by the attribute of the query main body, and the output attribute is the attribute of the query main body which is required to be output.
4. The query method of claim 3,
and under the condition that the output attribute is a reference attribute or a subordinate attribute, nesting the attribute of the business object corresponding to the output attribute in the output attribute.
5. The query method of claim 3, wherein the generating a repository query statement comprises:
analyzing the data query request to generate a corresponding query object group, wherein the query object group comprises a query main object, a query condition object and an output attribute object;
and generating the storage library query statement according to the query object group.
6. The query method of claim 5, wherein the generating the repository query statement according to the query object group comprises:
splitting the query object group into a main query segment and a sub query segment according to the relation between the business objects, wherein the main query segment is a query segment aiming at the query main body, and the sub query segment is a query segment aiming at the reference attribute or the subordinate attribute of the query main body;
corresponding repository main query statements and repository sub-query statements are generated.
7. The query method of claim 6, wherein said executing the repository query statement, obtaining query result data in a repository comprises:
sequentially executing the main query statement of the repository and the sub query statement of the repository, and respectively acquiring a main query result and a sub query result in the repository;
and assembling the main query result and the sub-query result into the query result data.
8. The query method of claim 7,
the business object is provided with a main key for identifying the business object and an external key for identifying other business objects corresponding to the reference attribute or the subordinate attribute of the business object;
the assembling the main query result and the sub-query result into the query result comprises:
and assembling the main query result and the sub-query result into the query result data according with the data query request according to the main key and the external key of the business object corresponding to the main query result and the sub-query result.
9. The query method of claim 8,
according to the relation among the business objects, the query object group is further divided into conditional query segments, the conditional query segments are query segments which can be completed without depending on other query segments, and the main query segment depends on the query results of the conditional query segments.
10. The query method of claim 9, wherein the generating the repository query statement from the query object group comprises:
generating a repository conditional query statement corresponding to the conditional query fragment;
the executing the repository query statement, and the obtaining the query result data in the repository comprises:
executing the repository conditional query statement before executing the repository main query statement, and acquiring a conditional query result in the repository;
and assembling the conditional query result, the main query result and the sub-query result into the query result according to the main key and the external key of the business object corresponding to the conditional query result, the main query result and the sub-query result.
11. The query method according to any one of claims 3-10,
the data query request further comprises a query result processing field, and the query result processing field is used for at least one of sorting processing or screening processing of the output attribute.
12. The query method of claim 11,
the query object group further comprises a query result processing object corresponding to the query result processing field.
13. The query method according to any one of claims 3-10,
the query body also includes a reference attribute or a dependent attribute of the business object.
14. The query method according to any one of claims 3-10,
the query conditions are nested in the query conditions, wherein the query conditions are related to the dependent attribute or the reference attribute of the query subject.
15. The query method according to any one of claims 3-10,
the output attribute comprises a sub-query condition, and is used for determining a condition met by the attribute of the query main body needing to be output.
16. The query method of claim 6,
the repository sub-query statement comprises a local repository sub-query statement and an external repository sub-query statement.
17. An apparatus for querying data, comprising:
the determining unit is used for determining the relationship among all the business objects and the attributes of all the business objects according to the metadata of all the business objects in the received data query request;
the generating unit is used for generating a storage library query statement according to the relation between the business objects and the attributes of the business objects;
and the acquisition unit is used for executing the storage library query statement and acquiring query result data in the storage library.
18. An apparatus for querying data, comprising:
a memory; and
a processor coupled to the memory, the processor configured to perform the method of querying data of any of claims 1-16 based on instructions stored in the memory device.
19. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out a method of querying data according to any one of claims 1 to 16.
CN201910299095.4A 2019-04-15 2019-04-15 Data query method, device and computer readable storage medium Active CN111831684B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910299095.4A CN111831684B (en) 2019-04-15 2019-04-15 Data query method, device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910299095.4A CN111831684B (en) 2019-04-15 2019-04-15 Data query method, device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111831684A true CN111831684A (en) 2020-10-27
CN111831684B CN111831684B (en) 2024-04-05

Family

ID=72914457

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910299095.4A Active CN111831684B (en) 2019-04-15 2019-04-15 Data query method, device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111831684B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112560098A (en) * 2020-12-22 2021-03-26 广州技象科技有限公司 Business data management method and device of power Internet of things
CN112560097A (en) * 2020-12-22 2021-03-26 广州技象科技有限公司 Storage management method and device for power business data

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100153432A1 (en) * 2008-12-11 2010-06-17 Sap Ag Object based modeling for software application query generation
CN102799644A (en) * 2012-06-28 2012-11-28 用友软件股份有限公司 Dynamic database query system and method based on metadata
CN103425780A (en) * 2013-08-19 2013-12-04 曙光信息产业股份有限公司 Data inquiry method and data inquiry device
US20150066910A1 (en) * 2012-04-17 2015-03-05 Dataline Software, Ltd. Methods of Querying a Relational Database
CN105183735A (en) * 2014-06-18 2015-12-23 阿里巴巴集团控股有限公司 Data query method and query device
US20160078085A1 (en) * 2014-09-17 2016-03-17 Futurewei Technologies, Inc. Method and system for adaptively building and updating a column store database from a row store database based on query demands
CN105989150A (en) * 2015-03-02 2016-10-05 中国移动通信集团四川有限公司 Data query method and device based on big data environment
CN107491454A (en) * 2016-06-13 2017-12-19 百度在线网络技术(北京)有限公司 Data query method and device
CN109508339A (en) * 2018-11-12 2019-03-22 上海达梦数据库有限公司 A kind of data query method, apparatus, terminal device and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100153432A1 (en) * 2008-12-11 2010-06-17 Sap Ag Object based modeling for software application query generation
US20150066910A1 (en) * 2012-04-17 2015-03-05 Dataline Software, Ltd. Methods of Querying a Relational Database
CN102799644A (en) * 2012-06-28 2012-11-28 用友软件股份有限公司 Dynamic database query system and method based on metadata
CN103425780A (en) * 2013-08-19 2013-12-04 曙光信息产业股份有限公司 Data inquiry method and data inquiry device
CN105183735A (en) * 2014-06-18 2015-12-23 阿里巴巴集团控股有限公司 Data query method and query device
US20160078085A1 (en) * 2014-09-17 2016-03-17 Futurewei Technologies, Inc. Method and system for adaptively building and updating a column store database from a row store database based on query demands
CN105989150A (en) * 2015-03-02 2016-10-05 中国移动通信集团四川有限公司 Data query method and device based on big data environment
CN107491454A (en) * 2016-06-13 2017-12-19 百度在线网络技术(北京)有限公司 Data query method and device
CN109508339A (en) * 2018-11-12 2019-03-22 上海达梦数据库有限公司 A kind of data query method, apparatus, terminal device and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
张昉: "Web数据库中最小失败子查询问题研究", 辽宁省交通高等专科学校学报, vol. 15, no. 2 *
彭利民;: "基于XML的分布式数据库查询平台的设计与实现", 福建电脑, no. 08 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112560098A (en) * 2020-12-22 2021-03-26 广州技象科技有限公司 Business data management method and device of power Internet of things
CN112560097A (en) * 2020-12-22 2021-03-26 广州技象科技有限公司 Storage management method and device for power business data
CN112560097B (en) * 2020-12-22 2022-09-30 广州技象科技有限公司 Storage management method and device for power business data

Also Published As

Publication number Publication date
CN111831684B (en) 2024-04-05

Similar Documents

Publication Publication Date Title
US10872095B2 (en) Aggregation framework system architecture and method
US20220342875A1 (en) Data preparation context navigation
US8892599B2 (en) Apparatus and method for securing preliminary information about database fragments for utilization in mapreduce processing
US10083227B2 (en) On-the-fly determination of search areas and queries for database searches
US6519592B1 (en) Method for using data from a data query cache
US6484161B1 (en) Method and system for performing online data queries in a distributed computer system
US20120246154A1 (en) Aggregating search results based on associating data instances with knowledge base entities
US8924373B2 (en) Query plans with parameter markers in place of object identifiers
US20120239612A1 (en) User defined functions for data loading
US20080162455A1 (en) Determination of document similarity
US20080162456A1 (en) Structure extraction from unstructured documents
CN111767303A (en) Data query method and device, server and readable storage medium
WO2013083793A1 (en) Systems and methods for improving database performance
CA2786445A1 (en) Matching metadata sources using rules for characterizing matches
US20220083618A1 (en) Method And System For Scalable Search Using MicroService And Cloud Based Search With Records Indexes
US20110302187A1 (en) Schema definition generating device and schema definition generating method
US20090210389A1 (en) System to support structured search over metadata on a web index
US9600597B2 (en) Processing structured documents stored in a database
US9043321B2 (en) Enhancing cluster analysis using document metadata
US20230244659A1 (en) Query execution utilizing negation of a logical connective
US8290950B2 (en) Identifying locale-specific data based on a total ordering of supported locales
CN111831684B (en) Data query method, device and computer readable storage medium
CN116802626A (en) JavaScript object notation (JSON) query that links across cloud resources
US20180341709A1 (en) Unstructured search query generation from a set of structured data terms
WO2017019883A1 (en) Locality-sensitive hashing for algebraic expressions

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant