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

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

Info

Publication number
CN111831684B
CN111831684B CN201910299095.4A CN201910299095A CN111831684B CN 111831684 B CN111831684 B CN 111831684B CN 201910299095 A CN201910299095 A CN 201910299095A CN 111831684 B CN111831684 B CN 111831684B
Authority
CN
China
Prior art keywords
query
attribute
main
data
repository
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.)
Active
Application number
CN201910299095.4A
Other languages
Chinese (zh)
Other versions
CN111831684A (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

Landscapes

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

Abstract

The present disclosure relates to a data query method, apparatus, and computer-readable storage medium, and relates to the field of computer technology. The method comprises the following steps: according to the metadata of each service object in the received data query request, determining the relation among each service object and the attribute of each service object; generating a repository query statement according to the relation among the business objects and the attribute of the business objects; and executing a storage library query statement, and acquiring query result data from the storage library. The technical scheme of the disclosure can improve the applicability and efficiency of data query.

Description

Data query method, 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
Digital information systems mostly have advanced query or integrated query services. The advanced query or comprehensive query service is mainly aimed at specific business objects and provides data query service with customizable query conditions and configurable query results.
In the related art, specific query conditions and query fields are encoded as a query request; the query request is sent to a specified business query server, which has implemented the query for the particular business object.
Disclosure of Invention
The inventors of the present disclosure found that the above-described related art has the following problems: 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 proposes a data query technical solution, which can improve applicability and efficiency of data query.
According to some embodiments of the present disclosure, there is provided a data query method including: according to metadata of each service object in the received data query request, determining the relation among the service objects and the attribute of each service object; generating a repository query statement according to the relation among the business objects and the attribute of the business objects; and executing the query statement of the storage library, and acquiring query result data from the storage library.
In some embodiments, the properties of the business object include at least one of a base property, a reference property, or a dependent property, the reference property being other business objects referenced by the business object, the dependent property being other business objects that are dependent on the business object; the relationships between the business objects include reference relationships and subordinate relationships.
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 that is 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 subordinate 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 includes: analyzing the data query request to generate a corresponding query object group, wherein the query object group comprises a query main body 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 includes: splitting the query object group into a main query fragment and a sub query fragment according to the relation among the business objects, wherein the main query fragment is a query fragment aiming at the query main body, and the sub query fragment is a query fragment 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, the retrieving query result data in the repository includes: sequentially executing the main query statement of the storage library and the sub query statement of the storage library, and respectively acquiring a main query result and a sub query result in the storage library; 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 foreign keys for identifying other business objects to which its referencing properties or its subordinate properties correspond; the assembling the main query result and the sub-query result into the query result includes: and according to the main key and the external key of the service object corresponding to the main query result and the sub query result, assembling the main query result and the sub query result into the query result data conforming to the data query request.
In some embodiments, according to the relationships between the business objects, the query object group is further split into conditional query fragments, wherein the conditional query fragments are query fragments which can be completed independently of other query fragments, and the main query fragments depend on query results of the conditional query fragments.
In some embodiments, the generating the repository query statement from the query object group includes: generating a repository conditional query statement corresponding to the conditional query fragment; the executing the repository query statement, the obtaining the query result data in the repository comprising: before executing the main query statement of the repository, executing the conditional query statement of the repository, and acquiring a conditional query result from the repository; and 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, assembling the conditional query result, the main query result and the sub-query result into the query result.
In some embodiments, the data query request further includes a query result processing field for at least one of sorting or filtering the output attributes.
In some embodiments, the query object group 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, query conditions regarding subordinate or reference attributes of the query body are nested in the query conditions.
In some embodiments, the output attribute includes a sub-query condition for determining a condition satisfied by an attribute of the query body that needs to be output.
In some embodiments, the repository sub-query statement includes a local repository sub-query statement and an external repository sub-query statement.
According to further embodiments of the present disclosure, there is provided a data query apparatus including: the determining unit is used for determining the relation among the business objects and the attribute of the business objects according to the metadata of the business objects in the received data query request; the generating unit is used for generating a repository query statement according to the relation among the business objects and the attribute of the business objects; and the acquisition unit is used for executing the query statement of the storage library and acquiring query result data from the storage library.
According to still further 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 embodiments described above 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 having stored thereon a computer program which, when executed by a processor, implements the method of querying data in any of the above embodiments.
In the embodiment, the relation among the business objects is determined according to the metadata of the business objects related to the query request, so that corresponding repository query sentences can be flexibly generated for different query requests, and 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 disclosure may be more clearly understood from the following detailed description taken in conjunction with the accompanying drawings in which:
FIG. 1 illustrates a flow chart of some embodiments of a method of querying data of the present disclosure;
FIG. 2 illustrates a flow chart 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 shows a flow chart 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 data querying device of the present disclosure;
FIG. 6 illustrates a block diagram of further embodiments of a data querying device of the present disclosure;
fig. 7 illustrates a block diagram of still further embodiments of a data querying device 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, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless it is specifically stated otherwise.
Meanwhile, it should be understood that the sizes of the respective parts shown in the drawings are not drawn in actual scale for 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 one of ordinary skill in the relevant art may not be discussed in detail, but should be considered part of the specification where appropriate.
In all examples shown and discussed herein, any specific values should be construed as merely illustrative, and not a limitation. Thus, other examples of the exemplary embodiments may have different values.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further discussion thereof is necessary in subsequent figures.
Aiming at the technical problems, a unified data query method capable of querying different business objects needs to be provided. For example, the data query method can flexibly select a query main body according to different business object groups, customize multi-layer nested query conditions and customize multi-dimensional query results.
Thus, query statements having a uniform form applicable to different business objects can be generated based on metadata describing the business objects and their corresponding relationships, and a uniform data query engine can be implemented based on the metadata and the query statements. For example, this can be achieved by the following embodiments.
Fig. 1 illustrates a flow chart of some embodiments of a method of querying data of the present disclosure.
As shown in fig. 1, the method includes: step S1, determining the relation and attribute of each service data; step S2, generating a storage library inquiry statement; and step S3, obtaining the query result data from the storage library.
In step S1, a relationship between the service objects and an attribute of each service object are determined according to metadata of each service object in the received data query request.
In some embodiments, the properties of the business object may include at least one of a base property, a reference property, and a dependent property. For example, the business objects may be stored in a repository in the form of a relational data table, and the relationships between the business objects may include reference relationships, dependencies, and the like. The business object may have a primary key for identifying itself and foreign keys for identifying other business objects to which its referencing properties or its subordinate properties correspond.
In some embodiments, the base attribute may be a numeric, string, date, or other conventional type of attribute; the reference attribute is other business objects that are referenced (or directly associated) by a business object, for example, a "sales order" has as a business object a reference attribute of a "customer", which is itself a business object, and a plurality of "sales orders" can reference (point to) the same "customer"; the subordinate attribute is another business object subordinate to the business object, for example, "sales order" has one or more "order details" as its subordinate attribute, which is itself also a business object.
In addition, the plurality of subordinate attributes "order details" may be reference attributes of the same master business object "sales order", i.e., "sales order" is "order details". In this way, the dependent attribute and the master service object together form a bi-directional association of the master service object with the dependent attribute. According to the association relation, a unified form of query statement can be constructed for querying different business objects, so that the query applicability and efficiency are improved.
In some embodiments, the relationships of business objects may also include inheritance relationships, i.e., one business object inherits another business object as its parent business object, both as parent and child relationships. The parent business object of a business object and the multi-level cascading parent business object of the parent business object may collectively be the ancestor business object of the business object. One business object may inherit all of the properties of its ancestor business objects at the same time.
In some embodiments, properties and relationships of business objects may be obtained through metadata that can express dependencies, references, and inheritance relationships between business objects. For example, a sales order service group may contain 8 kinds of service objects: commCategory (commodity classification),
Commodity, customer, room, warehouse, saleOrder, orderDetail, cashOrder. Metadata for each business object is defined as follows:
CommCategory { id: character type, code): character type, description };
commodity { id: character type, code }, description }, category };
Customer { id: character type, name: character type, level: character type };
room { id: character type, code }, description }, character type, area };
warehouse { id: character type, code }, description }, characters }, rooms };
SaleOrder { id: character, orderTime }, customer }, address }, character, payType }, character, details }, order detail };
OrderDetail { id: character type, rowNo (Commodity): commodity, quality (quantity): integer type, order (master order): saleOrder, wasehouse }: warehouse, price:. Mu.m, paybleAmount };
CashOrder { id: character, cashMode }, paid account }.
Wherein, the 'inheritance relationship' is represented, and the 'parent object is the following' item; the "{ }" is each attribute contained in the business object; the "()" is the corresponding explanation; the "[ ]" is preceded by a subordinate attribute, and "[ ]" is each attribute contained in the subordinate attribute; "after-:" indicates the type of the preceding attribute or "after-:" is another business object as an attribute, which is a reference attribute.
Thus, the relation of the business objects can be obtained according to the metadata, a business object group with complex logic is established, and further, a storage library 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 subordinate 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 processing field. The query result processing field is used for at least one of sorting or filtering the output attributes. For example, the filtering process may include a page fetching process (fetching a page of the query result) and a top fetching process (fetching the first few pieces of the query result), etc. For example, the query intent may be generated using the following formatting statements:
query body (query filter request) { query output request } ordering request.
In some embodiments, the query body may be set in a manner that multi-level nested business objects. For example, the query body may be a business object that is a main query target, and may also be a reference attribute, a subordinate 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 "". The reference attribute or the subordinate attribute of the ancestor business object of the business object can be used as a query main body in a multistage cascade mode.
In some embodiments, the data query request may be generated by a user from a formatted statement preset by the system. The preset formatting statements may be set according to relationships and properties between business objects. For example, the query body may be generated using the following formatting statements:
single query body |body alias single query body (query filtering request) ·sub-query body.
The formatting statements of the nested single query body of the query body are: a word; the formatting statements of the sub-query bodies nested by the query body are:
object attribute name |object attribute name (query filtering request) · sub-query body.
"word" means a combined string beginning with letters and containing any number of letters, numbers, and underlining; "|" indicates that the context is "or" in relation.
In some embodiments, the query condition is a condition that the attribute of the query body needs to satisfy. The query conditions may be set in a multi-aspect combined nesting manner, i.e., query conditions in which internal attributes regarding subordinate attributes or reference attributes of the query body may be nested.
For example, the query condition may be a nesting of multiple query requirements of a relational expression, a combination of query conditions, a paged query condition, an arithmetic operation expression, a reference attribute condition, a subordinate attribute condition, an object attribute query condition, and the like. Query terms are wrapped in brackets and placed after 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. The point number "." connection reference attribute and its internal attribute may be employed. The reference attribute condition may also be a query for the reference attribute of the ancestor business object of the master query object, i.e., a multi-level nesting of the reference attributes may occur (which may not end until the basic attributes of the business object are nested).
For example, the dependent attribute condition is a query for an internal attribute of the dependent attribute. The implementation can be in the form of a dependent attribute { internal attribute condition }, which can still be a combination of multiple query conditions (which can be relational expressions). The dependent attribute conditions are all involved in query condition combination with the base attribute and the reference attribute conditions.
In some embodiments, the query conditions may be set using the following formatting statements:
ε| (single query filter request) | (multiple query filter requests).
Wherein "ε" represents the null. For example, a single query filtering request may be generated using a formatting statement of "deduplication condition |attribute condition|paging condition"; multiple query filtering requests may employ a "deduplication condition; attribute condition |attribute condition; paging condition|filter condition; attribute conditions; the formatting statement of paging condition "is generated.
In some embodiments, the deduplication condition may be generated in the form of "$distict"; the attribute conditions may be generated in the form of "single attribute condition |multi-attribute condition".
For example, the single attribute condition may be generated using the following formatting statements:
single attribute = attribute value |single attribute single condition |single attribute: { multi-condition } |single attribute: { attribute condition }.
The multi-attribute condition may be generated using the following formatting statements:
single attribute condition (multi-attribute condition) |multi-attribute condition, multi-attribute condition|multi-attribute condition or multi-attribute condition.
The paging condition may be generated using the following formatting statements: page No: page value, $PageNo: page value, $PageSize: page value.
The single attribute may be generated using the following formatting statements:
the single attribute, wherein the object attribute name, the attribute alias and the basic attribute adopt the form of words.
The attribute values may be generated using the following formatting statements:
the numerical constant string constant boolean constant $ word.
The single condition may be generated using the following formatting statements:
single-value operator attribute value |$multi-value operator attribute value list.
The multi-condition may be generated using the following formatting statements:
single condition (multi-condition) multi-condition, multi-condition or multi-condition.
Wherein the single value operator may be =, +|! =, > =, <, <=; the multi-value operator may be in, nin, contain, not _contact.
The attribute value list may be generated using the following formatting statements:
attribute value |attribute value, attribute value list.
In some embodiments, a tree structure may be employed to generate query results. The query result may be a tree-like structure statement of multi-level properties wrapped in "{ }", thereby implementing arbitrary multi-level nesting.
For example, the outermost layer of the multi-level nest may be paging information (how many pages the query result is in total, how many pieces are displayed per page, etc.); the second layer of the multi-level nesting can be a basic attribute of the query body. When the internal attribute of the reference attribute or the subordinate attribute is required to be used as a query result, the internal attribute can be wrapped by "{ }" and then placed after the reference attribute or the subordinate attribute; in the case where the internal attribute is again a reference attribute or a dependent attribute, nesting of the internal attributes may continue in the same manner, and the attributes may be separated by commas.
In some embodiments, sub-query conditions may also be included in the output attributes for determining attributes that satisfy the sub-query conditions that need to be output. For example, the package sub-query terms may be placed after the corresponding attributes with "()".
In some embodiments, the query result may be a page attribute list or an object attribute list. For example, the page attribute list may be generated using the following formatting statements:
pageSize, pageNo, totalCount, list { object properties list }.
The object property list may be set using the following formatting statements:
basic attribute |complex attribute|basic attribute, object attribute list|complex attribute, object attribute list.
The complex attributes may be generated using the following formatting statements:
object attribute name (query filtering request) { object attribute list } ordering request.
In some embodiments, the ranking process in the query result processing field is wrapped in "[ ]; the ranking process may support multi-level nesting of attributes in the query results. The objects of the ordering process may be basic properties or internal properties of the reference properties.
For example, the query result processing field may be set using the following formatting statements:
ε| [ single ordering request ] | [ multiple ordering requests ].
Wherein, the single ordering request can be generated by adopting the following formatting statement:
single attribute |single attribute desc.
The multi-ordering request may be generated using the following formatting statements:
single ordering request|single ordering request, multiple ordering requests.
In some embodiments, the received data query request may be:
wherein the query body is CashOrder; the query condition is that the basic attribute of CashOrder is that CashMode 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 the attributes of CashOrder basic attribute id, orderTime, reference attribute customer and subordinate attribute details; the ranking process in the query result processing field is to rank the details by price and to rank the CashOrder in descending order by level attribute of orderTime and customer.
The reference attribute customer has nested therein a base attribute id, name, level. The dependent attributes details nest the query condition paybleamount > = $ amt, the basic attributes id, rowNo, quantity, price, payableAmount of details, and the dependent attributes compatibility of details. The subordinate attribute compatibility in turn nests its basic attribute id, code.
In step S2, a repository query statement is generated from the relationships 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 acquired in the repository. For example, the data query engine may be configured to obtain query results from a repository query statement.
In some embodiments, the data query request may be parsed to generate a query object group for the data query engine to express the query request, and then the query result data is split into query segments. Therefore, on one hand, the query engine can conveniently analyze the semantics of the query request, and unified data query is realized rapidly and efficiently; on the other hand, the method can support flexible expansion and data acquisition of unified data query semantics, and realize transverse expansion to more bottom-layer storage libraries.
In some embodiments, step S2 may be implemented by the steps in fig. 2.
Fig. 2 shows a flow chart 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 storage library 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 also include query result processing objects corresponding to the query result processing fields. 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 group includes a query body class group, a query condition class group, and an output attribute class group. The query class group may also include query result processing classes corresponding to the query result processing fields. A query request total class corresponding to the data query request total may also be generated.
In some embodiments, the searched data query request may be first grammar checked. 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 is not passed, feeding back error information with strong legibility. The query body, query conditions, output attributes, and query result processing fields may be separately syntax checked.
For example, checking the query body may include: whether the multi-stage cascade query bodies are connected in a "-"; each query body is a character string with an alphanumeric underline at the beginning of an alphabet; whether the query conditions contained behind each query body can be verified by the syntax of the query conditions. And generating a query subject class after verification is passed.
For example, the verification of the query condition may include: paging query condition resolution, deduplication condition resolution, single attribute expression condition resolution, single attribute multi-condition query resolution, subordinate object attribute query condition resolution, arithmetic expression query condition resolution, combined query condition resolution and expression nested sub-query resolution. And after verification is passed, generating a query condition class.
For example, the verification of the output attribute may include: 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 query conditions and other requirements of query contained in the subordinate object attribute, checking the alias of the query result attribute, and checking multi-layer nesting of the reference attribute and the subordinate attribute of the query result set. And generating an output attribute class after the verification is passed.
For example, the verification of the query result processing field may include: and analyzing and checking the sorting condition and the top fetching condition. And generating a query result processing object after verification is passed.
In some embodiments, the query condition class 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 class may include: query Condition interface (Condition), paging Condition class (PaginCondition), deduplication Condition class (distictCondition), attribute Condition interface (PropertyCondition), single attribute query Condition abstract class (single propertyCondition), arithmetic expression query Condition class (MathOxcompression Condition), combination query Condition class (CompositionCondition), single attribute expression Condition class (PropertyExpress Condition), single attribute multi-Condition query class (PropertyMultiCondition), dependent attribute query Condition class (SuperComparteProcotyponditions), expression nested sub-query class (Expsheet query Condition).
Paging condition class includes pageNo and pageSize of int (integer) type; the deduplication condition class includes the booty of boolean type; the single attribute query condition abstract class comprises a String type propertyPath; the arithmetic expression query condition class includes an operationType of a String type expression, enumeration (enumeration) type and a value of an Object type; the combined query condition class includes a conditionList of the type combinationType, list < condition > (table) of the energy type; the single attribute expression condition class includes a value of operationType, object type of the energy type; the single-attribute multi-condition query class includes a propertyCondList of the energy type combinationType, list < PropertyCondition > type; the subordinate attribute query condition class includes a conditionList of combinationType, list < condition > type of the energy type; the expression nested sub-query class contains 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 group is generated, attribute verification, semantic verification, and query preparation may be performed on the query request based on metadata of the business object.
For example, the attribute verification may include: and verifying the query subject class, the query condition class, the output attribute class, the service object of the query result processing field and the attribute thereof according to the definition of the metadata of the service object, and feeding back error information with strong legibility to the problematic attribute query.
For example, semantic checking may include: and checking the semantic validity of the data query request. For example, query conditions and ordering processes may not be set across the repositories, page screening and top fetching screening of 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 business object and the metadata of each attribute; and acquiring business objects corresponding to each reference attribute and each subordinate attribute, and placing the business objects into the query object group. I.e., 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 term is generated from the query object group. For example, SQL (Structured Query Language ) query statements may be generated. In some embodiments, by analyzing the query object group, the overall query may be split into several query segments, and the data acquisition interfaces and specifications corresponding to the query segments are defined. For example, query snippets may be completed by invoking the underlying modules of the query engine.
In some embodiments, steps S22 and S3 may be implemented according to the steps in fig. 4.
Fig. 4 shows a flow chart 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 fragments; and step S222, generating each inquiry segment statement.
In step S221, the query object group is split into a main query fragment and a sub-query fragment according to the relationship between the business objects. The main query fragment is a query fragment for a query subject, and the sub-query fragments are query fragments for a reference attribute or a subordinate attribute of the query subject.
In some embodiments, the query object groups may also be split into conditional query fragments. Conditional query snippets are query snippets that can be completed independent of other query snippets. The main query fragment depends on the query results of the conditional query fragment.
In some embodiments, sub-query fragments (which may include subordinate attribute queries, reference attribute queries of external logical stores, reference attribute queries of internal logical stores, etc.) and conditional queries may be split from the query object group according to the internal logical relationships of objects in the query object group and the stored logical library information of metadata of each business object, with the remaining backbone queries being the main query fragments. Further, a corresponding query request containing references between business objects and query fragments containing relationships can be obtained.
In some embodiments, where the sub-query fragment is a reference attribute request of an external logical repository (external repository), query stub information is set at the main query fragment at the time of splitting the sub-query fragment. The query stub information may include reference attribute information contained or cached in the local logical store (local store) (the minimum set may contain only the outside). Details of the reference attribute not contained in the library can be split into reference attribute query fragments of the external library. For example, the reference attribute query fragment of the external library not only contains the attribute query stored in the external library, but also contains 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 a query stub.
In some embodiments, the data may be obtained by forming an ordered query fragment queue in the order of conditional query fragment, main query fragment, sub-query fragment. For example, in the case of conditional query fragments, sub-query fragments internally nested conditional query fragments, sub-query fragments, the splitting may be performed recursively, resulting in an ordered queue of query fragments.
In some embodiments, conditional query fragments, main query fragments may be completed first, and then sub-query fragments recursively split if present; sequentially completing a secondary condition query fragment and a secondary main query fragment which are separated from the sub query fragment; in the case where there are secondary sub-query segments in the sub-query segments, the secondary sub-query segments are recursively processed in the manner described above 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: subordinate attribute repository query statements, foreign repository reference attribute repository query statements, and native repository reference attribute repository query statements. Repository conditional query statements corresponding to conditional query segments may also be generated. For example, the fragment data acquisition interface method and specification defined at the request data calculation layer may be implemented based on components of the relational database and the MongoDB, respectively.
In some embodiments, in the case where the master query fragment does not contain a reference attribute, the inheritance relationship of the query body is obtained from the metadata of the query body in the master query fragment, thereby obtaining the metadata of all of its cascading parents. 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 disttinct field of the select clause may be set according to whether or not the deduplication process is performed; each attribute field in the select clause is generated from the output attributes. And acquiring a corresponding primary key, and setting a specific alias according to the interface specification so as to assemble query result data.
For example, the join on command may be used to left-join corresponding relational data tables to form a from clause based on inheritance of the metadata of the query body with the metadata of its cascading parent. For example, the relationship data table of the query body is leftmost, and the relationship data tables of the parent objects are sequentially arranged rightward. The aliases of the relational data table may be set separately in the form of T + digits (e.g., digits 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 through an and or statement; the query condition of the reference attribute can be realized by a sub-query mode of a reference foreign key refId in (query of internal condition of reference object SQL); the subordinate attribute query condition can be realized by a sub-query mode of a main key Idin (subordinate object internal condition query SQL).
For example, an order by clause may be generated from the ordering request in the query result processing field.
For example, a limit clause may be generated from paging information, top-fetch 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, where the main query fragment does not contain a reference attribute, the SQL sub-query statement may be divided into the generation of native library SQL sub-query statements and foreign library SQL sub-query statements.
For example, the generation method of the select clause, from clause, where clause, and limit clause of all non-referenced attributes in the present library SQL sub-query statement is similar to the generation method in the case where the main query fragment does not contain referenced attributes.
For example, the generation of the external library SQL sub-query statement takes the local library query as a base table, and the relational data table of each reference attribute is sequentially and leftwards connected by adopting the join statement. The external library SQL sub-query statement may include three clauses, select, from, and order by.
The attribute fields of the select clause of the exo-library SQL sub-query statement may be generated sequentially from the output attributes. The field name of the referencing attribute is prepended to the table alias (consistent with the table alias naming convention in the where clause). The internal attribute in the reference attribute uses the character string of the reference object attribute name + point number + internal attribute name as the query field alias. The particular aliases of the foreign key that selects the primary key and each of the referencing attributes may be set in accordance with the interface specification to assemble the query result data.
The from clause of the external library SQL sub-query statement can be generated by connecting the relational data tables of the reference attributes and the cascade reference relational data tables of the reference attributes in sequence left by the internal query base table. The T + number (which may start from 0) may be set in turn 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, and may start with 1.
An order by clause may be generated from the ordering request in the query result processing field.
In some embodiments, in the case that the output request of the subordinate attribute query fragment does not contain the reference attribute, the subordinate attribute SQL query statement may be generated by adopting a method for generating a main query SQL statement in the case that the main query fragment does not contain the reference attribute; in the case that the output request of the subordinate attribute query fragment contains the reference attribute, the generating method of the main query SQL statement in the case that the main query fragment contains the reference attribute can be adopted to generate the subordinate attribute SQL query statement, but the where clause further comprises an and condition: the foreign key, i.e., in (primary query primary key information list) for pointing 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 method for generating the external library reference attribute SQL query statement is similar to the method for generating the main query SQL statement that does not contain a reference attribute; in the case that the external library reference attribute SQL query contains the reference attribute, the method for generating the external library reference attribute SQL query statement is similar to the method for generating the main query SQL statement containing the reference attribute, but the where clause is completely replaced by the main key of the reference attribute, namely in (main query reference external key information list), and an orderby clause limit clause is not needed.
The step S3 comprises the following steps: step S31, executing each inquiry fragment statement in sequence; step S32, obtaining the results of all query fragments; and step 33, assembling the query fragment results.
In step S31, the repository main query sentence and the repository sub-query sentence are sequentially executed. The repository conditional query statement, the repository main query statement, and the repository sub-query statement may also be executed sequentially.
In some embodiments, the variables in the query statement may be numbered sequentially, replaced with a variable processing manner identifiable in the query statement in the underlying repository, and the parameters in the query parameter value list are processed correspondingly at the same time. And selecting a corresponding query execution storage library according to the corresponding relation between the metadata of the business object and the bottom storage library, starting a connection pool, and executing the query statement generated in the previous step.
In some embodiments, the SQL statement and query parameters may be passed to the underlying repository for data queries using Prepared Statement, the query statement and query parameters (parameters may not be incorporated into the query statement). The execution of MongoDB and other query sentences from the storage library can carry out corresponding query according to MongoDB client-side and server-side specifications.
In some embodiments, the most recently used query results may be cached for infrequently changing data (e.g., settings in the metadata). For example, data (e.g., commodity center data) may be cache-eliminated using a least recently used elimination algorithm.
In step S32, the conditional query result is acquired in the repository. And acquiring corresponding fragment data according to the query fragments. For example, the fragment data acquisition implementation component corresponding to the data storage type can be respectively called according to the data storage type and the underlying storage library configured by the metadata, so as to perform corresponding data acquisition of each query fragment.
In some embodiments, the acquired data may also contain data logical relationships between the fragment data. A connection pool is used for each data source of each data storage type, so that efficient connection of multiple data sources is supported, and fragment data acquisition efficiency is improved. A set of interface methods and a logic specification for fragment data acquisition may be provided, with multiple fragment data acquisition components of different business object storage types implemented by the underlying components.
In some embodiments, the user needs to query the order time, the order customer name, the order detail order line number, and the real payment amount of all the actual orders with the order detail real payment amount greater 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:
in some embodiments, the conditional query fragment is a complete data query, independent of the main query fragment, and may be directly passed to the underlying components for implementation. For example, the "OrderDetail (order. OrderTime < '> 2019-01-01'; top 1) { PaidAmount } [ PaidAmount desc ]" section in the above embodiment is the maximum order details payoff value before 2019 was queried, which is a conditional value fragment query.
In some embodiments, the primary query fragment is a conditional value that depends on the results of conditional query execution as query conditions, with the execution order following the conditional query fragment it contains. In addition to the data itself, the main query fragment can also query the corresponding main key and the foreign key pointing to each reference attribute.
For example, the "CashOrder (details: { paidAmount >5000 }) { id, orderTime, customer { id })" part is the main query fragment. The main query fragment is executed by taking the query result of the conditional query fragment as a condition, a group of order ids (main keys) can be acquired and stored in the variable $idList, and a group of client id values (foreign keys pointing to the reference attribute) can be queried and stored in the variable $customerIdList.
In some embodiments, where the sub-query segment is a subordinate 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 fragment, and fragment data acquisition of the sub-query fragment is realized by the bottom layer component. I.e. to implement information list queries of slave table objects associated with the master key information list of the master table. The obtained result may contain foreign key information pointing to the main object in addition to the user request data, in preparation for assembly with the main object. For example, "OrderDetail (order.id in $ldList) { id, rowNo, paybleAmount, 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 $customerIdList) { id, name }" is a reference attribute query fragment.
In some embodiments, the reference attribute query fragment may include a local library reference attribute query fragment and an external library reference attribute query fragment.
For example, the library reference attribute query fragment depends on a list of reference foreign key information in the results of the master query fragment. The quoted foreign key information list can be placed in the query fragment request object, and the data acquisition of the subordinate attribute query fragment of the library quoted attribute is realized by the bottom layer component, namely the subordinate attribute information list query of the foreign key information list associated quoted attribute is realized. The obtained result may contain foreign key information of the reference attribute of the subordinate attribute to the main object in addition to the user request data, in preparation for assembly with the reference attribute of the main object.
For example, the exolibrary reference attribute query fragment depends on a list of reference foreign key information in the results of the main query fragment. The reference foreign key information list can be placed in the query fragment request object, and the query fragment data acquisition of the foreign library reference object is realized by the bottom layer component, namely, the foreign library object information query associated with the foreign key information list is realized. The obtained result may contain, in addition to the user request data, primary key information of the external library reference attribute, in preparation for assembly 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 external key of the corresponding business object of the main query result and the sub query result. And the conditional query result, the main query result and the sub query result can be assembled into the query result according to the main key and the external key of the service object corresponding to the conditional query result, the main query result and the sub query result.
In some embodiments, the data of each segment is assembled according to the references and the containing relations between the corresponding business entities of each query segment in the query segment queue, so as to form the tree-shaped data structure query result data which accords with the unified data query request.
In some embodiments, a user-defined extension interface may be reserved, allowing 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 enable association of conditional query segments with a main query segment, query results of conditional query segments in the main query segment may be populated using internal variables. After the conditional query fragment queries the fragment data, the fragment data is used as the parameter value of the internal space occupying variable to be written into the unified query parameter value list so as to be used for obtaining the main query fragment data. The usage of the internal space occupying variable and the parameter value thereof is completely the same as the usage of the user inquiring condition variable and the parameter value thereof, and the internal space occupying variable and the parameter value thereof are processed by the bottom data acquisition component.
In some embodiments, the fragment data for the main query fragment is assembled out: paging information of a business entity list; business entity list information; mapping information list of the main key of each business entity; each library references a list of mapping information of foreign keys to their corresponding reference attributes.
In some embodiments, to enable fragment data assembly of a dependent attribute query fragment, foreign key information in fragment data of a fragment may be queried according to a dependent attribute. And circularly inquiring a mapping information list of a main key of the service entity according to the external key information, finding the service entity corresponding to each subordinate attribute, and mounting the subordinate attribute into the corresponding service entity.
In some embodiments, according to the external key of the reference attribute of the service entity pointed to by the subordinate attribute in the fragment data of the subordinate attribute query fragment of the reference attribute of the library, the mapping information list from each external key of the reference of the library to the corresponding reference attribute of the external key of the library is searched circularly, and the reference attribute of the main object corresponding to each subordinate attribute is found. And mounting the subordinate attribute into the reference attribute of the corresponding main object.
In some embodiments, foreign key values of the reference attributes in different master objects may be duplicated, and the subordinate attribute list information may need to be mounted multiple times. In the code implementation, when all the slave attributes are mounted after the first mounting of each slave attribute, the original slave attribute information is cloned first so as to mount each reference attribute to an exclusive slave 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, the mapping information list from each external library reference external key value to the corresponding reference object value is searched circularly, and the query stake object of the 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 may be duplicated in different primary objects, and the foreign library reference attribute information may need to be merged multiple times. Before each merging of each external library reference attribute in the code implementation, cloning the original external library reference attribute information, and merging with the cloned information to ensure that each query stub object is merged into the correct external library reference attribute information.
In some embodiments, after the reference attributes are merged, mapping information lists from original main key values of each main object of the external reference attributes to corresponding main objects of the external reference attributes are destroyed, so that the subordinate 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 with the object after the reference attribute merge in the code implementation. I.e. rebuilding the mapping information list of the main object main key value of each reference attribute to the corresponding main object, so as to prepare the subordinate attribute and cascade external reference attribute of the continuous query or some external reference attribute.
In the embodiment, the relation among the business objects is determined according to the metadata of the business objects related to the query request, so that corresponding repository query sentences can be flexibly generated for different query requests, and the applicability and the efficiency of data query are improved.
Fig. 5 illustrates a block diagram of some embodiments of a data querying device 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 attribute of each business object based on the metadata of each business object in the received data query request. The generation unit 52 generates a repository query sentence from the relationship between the business objects and the attributes of the business objects. The acquisition unit 53 executes a repository query sentence, and acquires query result data in the repository.
In some embodiments, the properties of the business object include at least one of a base property, a reference property, or a dependent property, the reference property being other business objects referenced by the business object, the dependent property being other business objects that are dependent on the business object; the relationships between business objects include reference relationships and subordinate relationships.
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 that is a main query target, the query condition is a condition that the attribute of the query body needs to satisfy, and the output attribute is an attribute of the query body that needs to be output. For example, in the case where the output attribute is a reference attribute or a subordinate attribute, the attribute of the business object corresponding to the output attribute is nested in the output attribute.
In some embodiments, the generation unit 52 parses the data query request, generates a corresponding group of query objects, and generates a repository query statement from the group of query objects. The query object group comprises a query 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 fragment and a sub-query fragment according to the relationship between the business objects, and generates a corresponding repository main query statement and repository sub-query statement. The main query fragment is a query fragment for a query subject, and the sub-query fragments are query fragments for a reference attribute or a subordinate attribute of the query subject.
In some embodiments, the obtaining unit 53 sequentially executes a repository main query statement and a repository sub-query statement, obtains a main query result and a sub-query result in the repository, respectively, and assembles the main query result and the sub-query result into query result data.
In some embodiments, a business object has a primary key for identifying itself and foreign keys for identifying other business objects to which its referencing properties or its subordinate properties 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 external key of the service object corresponding to the main query result and the sub query result.
In some embodiments, the query object groups are also split into conditional query fragments by the acquisition unit 53 according to the relationships between the business objects. The conditional query fragment is a query fragment which can be completed without depending on other query fragments, and the main query fragment depends on the query results of the conditional query fragment.
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 sentence, the acquisition unit 53 executes the repository conditional query sentence before executing the repository main query sentence, and acquires the conditional query result in the repository. 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 external key of the service 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. The query result processing field is used for at least one of sorting or filtering the output attributes.
In some embodiments, the query object group further includes a query result processing class corresponding to the query result processing field. The query body may be the business object itself, a reference attribute of the business object, or a dependent attribute base attribute of the business object.
In some embodiments, query conditions regarding subordinate or reference attributes of a query body are nested in query conditions.
In some embodiments, sub-query conditions are included in the output attributes for determining conditions satisfied by the attributes of the query body that need to be output.
In some embodiments, the repository sub-query statements include a local repository sub-query statement and an external repository sub-query statement.
In the embodiment, the relation among the business objects is determined according to the metadata of the business objects related to the query request, so that corresponding repository query sentences can be flexibly generated for different query requests, and the applicability and the efficiency of data query are improved.
Fig. 6 illustrates a block diagram of further embodiments of a data querying device 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 perform the method of querying data in any 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, application programs, boot Loader (Boot Loader), database, and other programs.
Fig. 7 illustrates a block diagram of still further embodiments of a data querying device 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 perform the method of querying data in any of the foregoing embodiments based on instructions stored in the memory 710.
Memory 710 may include, for example, system memory, fixed nonvolatile storage media, and the like. The system memory stores, for example, an operating system, application programs, boot loader (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, and memory 710 and processor 720 may be connected by, for example, a bus 760. The input/output interface 730 provides a connection interface for input/output devices such as a display, a mouse, a keyboard, a touch screen, etc. Network interface 640 provides a connection interface for various networking devices. Storage interface 750 provides a connection interface for external storage devices such as SD cards, U-discs, and the like.
It will be appreciated by those skilled in the art that 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, etc.) having computer-usable program code embodied therein.
Up to this point, a data query method, a data query apparatus, and a computer-readable storage medium according to the present disclosure have been described in detail. In order to avoid obscuring the concepts of the present disclosure, some details known in the art are not described. How to implement the solutions disclosed herein will be fully apparent to those skilled in the art from the above description.
The methods and systems 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, firmware. The above-described sequence of steps for the method is for illustration only, and the steps of the method of the present disclosure are not limited to the sequence specifically described above unless specifically stated otherwise. Furthermore, in some embodiments, the present disclosure may also be implemented 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 above examples are for 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 disclosure. The scope of the present disclosure is defined by the appended claims.

Claims (17)

1. A method of querying data, comprising:
Determining the relation among the business objects and the attribute of the business objects according to the metadata of the business objects in the received data query request, wherein the data query request comprises a query main body, the query main body is a business object serving as a main query target, and the attribute of the business object comprises at least one of a reference attribute or a subordinate attribute;
generating a repository query statement according to the relation among the business objects and the attribute of the business objects;
executing the query statement of the storage library, and acquiring query result data from the storage library;
wherein 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 body object, a query condition object and an output attribute object;
generating the storage library query statement according to the query object group;
the generating the repository query statement according to the query object group includes:
splitting the query object group into a main query fragment and a sub query fragment according to the relation among the business objects, wherein the main query fragment is a query fragment aiming at the query main body, and the sub query fragment is a query fragment 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.
2. The query method of claim 1, wherein,
the attribute of the business object comprises a basic attribute, the reference attribute is other business objects referenced by the business object, and the subordinate attribute is other business objects subordinate to the business object;
the relationships between the business objects include reference relationships and subordinate relationships.
3. The query method of claim 2, wherein,
the data query request comprises a query condition and an output attribute, wherein the query condition is a condition which needs to be met by the attribute of the query main body, and the output attribute is the attribute of the query main body which needs to be output.
4. The query method according to claim 3, wherein,
and nesting the attribute of the business object corresponding to the output attribute in the output attribute under the condition that the output attribute is a reference attribute or a subordinate attribute.
5. The query method of claim 1, wherein the executing the repository query statement, obtaining query result data from a repository comprises:
sequentially executing the main query statement of the storage library and the sub query statement of the storage library, and respectively acquiring a main query result and a sub query result in the storage library;
And assembling the main query result and the sub-query result into the query result data.
6. The query method of claim 5, wherein,
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 includes:
and according to the main key and the external key of the service object corresponding to the main query result and the sub query result, assembling the main query result and the sub query result into the query result data conforming to the data query request.
7. The query method of claim 6, wherein,
according to the relation among the business objects, the query object group is further divided into conditional query fragments, wherein the conditional query fragments are query fragments which can be completed without depending on other query fragments, and the main query fragments depend on query results of the conditional query fragments.
8. The query method of claim 7, 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, the obtaining the query result data in the repository comprising:
before executing the main query statement of the repository, executing the conditional query statement of the repository, and acquiring a conditional query result from the repository;
and 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, assembling the conditional query result, the main query result and the sub-query result into the query result.
9. The query method according to any one of claims 3 to 8, wherein,
the data query request further includes a query result processing field for performing at least one of a ranking process or a filtering process on the output attributes.
10. The query method of claim 9, wherein,
the query object group further includes a query result processing object corresponding to the query result processing field.
11. The query method according to any one of claims 3 to 8, wherein,
the query body also includes a reference attribute or a dependent attribute of the business object.
12. The query method according to any one of claims 3 to 8, wherein,
the query conditions are nested with query conditions pertaining to subordinate or reference attributes of the query body.
13. The query method according to any one of claims 3 to 8, wherein,
the output attribute comprises sub-query conditions used for determining conditions which are met by the attribute of the query main body to be output.
14. The query method of claim 1, wherein,
the repository sub-query statements include a local repository sub-query statement and an external repository sub-query statement.
15. A data querying device, comprising:
a determining unit, configured to determine, according to metadata of each service object in a received data query request, a relationship between each service object and an attribute of each service object, where the data query request includes a query body, the query body is a service object serving as a main query target, and the attribute of the service object includes at least one of a reference attribute or a subordinate attribute;
the generating unit is used for generating a repository query statement according to the relation among the business objects and the attribute of the business objects;
The acquisition unit is used for executing the query statement of the storage library and acquiring query result data from the storage library;
the generation unit analyzes the data query request to generate a corresponding query object group, wherein the query object group comprises a query main body object, a query condition object and an output attribute object, and generates the repository query statement according to the query object group;
the generating unit splits the query object group into a main query fragment and a sub query fragment according to the relation among the business objects, wherein the main query fragment is a query fragment aiming at the query main body, the sub query fragment is a query fragment aiming at the reference attribute or the subordinate attribute of the query main body, and corresponding storage library main query statement and storage library sub query statement are generated.
16. A data querying device, 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-14 based on instructions stored in the memory device.
17. A computer readable storage medium having stored thereon a computer program which when executed by a processor implements the data querying method according to any of claims 1-14.
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 CN111831684A (en) 2020-10-27
CN111831684B true 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)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112560098B (en) * 2020-12-22 2024-05-14 广州技象科技有限公司 Service data management method and device of electric power Internet of things
CN112560097B (en) * 2020-12-22 2022-09-30 广州技象科技有限公司 Storage management method and device for power business data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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

Family Cites Families (3)

* 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
GB201206722D0 (en) * 2012-04-17 2012-05-30 Dataline Software Ltd Methods of querying a relational database
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

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
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数据库中最小失败子查询问题研究;张昉;辽宁省交通高等专科学校学报;第15卷(第2期);全文 *
基于XML的分布式数据库查询平台的设计与实现;彭利民;;福建电脑(第08期);全文 *

Also Published As

Publication number Publication date
CN111831684A (en) 2020-10-27

Similar Documents

Publication Publication Date Title
CN101036141B (en) A database management system with persistent, user- accessible bitmap values
EP2901313B1 (en) Pruning disk blocks of a clustered table in a relational database management system
US8768931B2 (en) Representing and manipulating RDF data in a relational database management system
CA2484009C (en) Managing expressions in a database system
US9430550B2 (en) Clustering a table in a relational database management system
US11599535B2 (en) Query translation for searching complex structures of objects
JP5306359B2 (en) Method and system for associating data records in multiple languages
US8924373B2 (en) Query plans with parameter markers in place of object identifiers
US7676453B2 (en) Partial query caching
US9218394B2 (en) Reading rows from memory prior to reading rows from secondary storage
WO2009145858A1 (en) Systems and methods for programmatic generation database statements
US10275486B2 (en) Multi-system segmented search processing
US20110302187A1 (en) Schema definition generating device and schema definition generating method
US20090210389A1 (en) System to support structured search over metadata on a web index
US20100030726A1 (en) Mechanism For Deferred Rewrite Of Multiple Xpath Evaluations Over Binary XML
US9600597B2 (en) Processing structured documents stored in a database
US20060161525A1 (en) Method and system for supporting structured aggregation operations on semi-structured data
US9053207B2 (en) Adaptive query expression builder for an on-demand data service
CN111708805A (en) Data query method and device, electronic equipment and storage medium
CN111831684B (en) Data query method, device and computer readable storage medium
CN105404695A (en) Test question query method and apparatus
US10185742B2 (en) Flexible text searching for data objects of object notation
CN111309704B (en) Database operation method and database operation system
Bast Efficient and Effective Search on Wikidata Using the QLever Engine
CN117425886A (en) List-based data search with addition-only data structure

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