CN114969261A - Data query method and device based on artificial intelligence, electronic equipment and medium - Google Patents
Data query method and device based on artificial intelligence, electronic equipment and medium Download PDFInfo
- Publication number
- CN114969261A CN114969261A CN202210602501.1A CN202210602501A CN114969261A CN 114969261 A CN114969261 A CN 114969261A CN 202210602501 A CN202210602501 A CN 202210602501A CN 114969261 A CN114969261 A CN 114969261A
- Authority
- CN
- China
- Prior art keywords
- entity object
- dependency
- entity
- graph
- target
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/3331—Query processing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
- G06F16/367—Ontology
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to the technical field of artificial intelligence, and provides a data query method, a device, electronic equipment and a medium based on artificial intelligence, wherein the method comprises the following steps: acquiring at least one strategy to be queried and unstructured data which has an association relation with the at least one strategy to be queried, and converting the unstructured data into a plurality of entity objects; constructing a global dependency graph based on the dependency among the entity objects; when the circular dependency relationship does not exist in the global dependency relationship graph, optimizing the global dependency relationship graph to obtain a target dependency relationship graph; and traversing the target dependency relationship graph based on at least one strategy to be queried to obtain a data query result. According to the invention, by constructing the global dependency graph and optimizing the global dependency graph, repeated data query is reduced, and the data query efficiency is improved.
Description
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a data query method and device based on artificial intelligence, electronic equipment and a medium.
Background
With the advent of the big data era, the data volume is more huge, and how to quickly and accurately query data is the current research focus. In the prior art, a data query engine tool is generally used to obtain the full data of the database table of each data source for data query based on the data source connector corresponding to each data source.
However, since there may be an intricate relationship dependency between data, when data query is performed through the full amount of data in the database table, a phenomenon of repeated query may occur, resulting in low data query accuracy and efficiency.
Therefore, it is necessary to provide a method for querying data quickly and accurately.
Disclosure of Invention
In view of the above, it is necessary to provide a data query method, an apparatus, an electronic device, and a medium based on artificial intelligence to construct a global dependency graph and optimize the global dependency graph, so as to reduce repeated data queries and improve data query efficiency.
A first aspect of the present invention provides a data query method based on artificial intelligence, the method comprising:
analyzing the received data query request, acquiring at least one strategy to be queried and unstructured data which has an association relation with the at least one strategy to be queried, and converting the unstructured data into a plurality of entity objects;
constructing a global dependency graph based on dependencies among the plurality of entity objects;
checking whether a cyclic dependency relationship exists in the global dependency relationship graph by adopting a preset algorithm;
when the global dependency graph has a cyclic dependency relationship, optimizing the global dependency graph to obtain a target dependency graph;
and traversing the target dependency relationship graph based on the at least one strategy to be queried to obtain a data query result.
Optionally, the building a global dependency graph based on the dependencies between the plurality of entity objects includes:
acquiring request input of each strategy to be inquired;
identifying a plurality of first entity objects on which the request input depends, and determining the plurality of first entity objects as a first hierarchical dependency relationship of the request input;
continuing to identify a plurality of second entity objects upon which each entity object in the first level dependency depends, determining the plurality of second entity objects as a next level dependency of the first level dependency of the request input;
repeatedly executing the construction of the next-level dependency relationship of the last-level dependency relationship of each strategy to be queried according to the residual entity objects on which each entity object in the last-level dependency relationship depends until the construction of all the level dependency relationships is completed, and obtaining a local dependency relationship graph of each strategy to be queried;
and constructing a global dependency graph according to the local dependency graph of each strategy to be queried.
Optionally, the constructing a global dependency graph according to the local dependency graph of each policy to be queried includes:
identifying whether the same entity object exists in the local dependency graph of the at least one policy to be queried;
when the same entity object exists in the local dependency graph of the at least one strategy to be queried, taking the same entity object as a common node, and merging the local dependency graphs of the strategies to be queried according to the common node to obtain a global dependency graph; or
And when the same entity object does not exist in the local dependency relationship graph of the at least one strategy to be queried, merging the local dependency relationship graphs of the at least one strategy to be queried to obtain a global dependency relationship graph.
Optionally, the checking whether a cyclic dependency exists in the global dependency graph by using a preset algorithm includes:
acquiring all entity objects without dependency relationship of the global dependency relationship graph, and adding all the entity objects into a preset initial queue;
randomly selecting any entity object from the initial queue to dequeue, determining the any entity object as a target entity object, and performing dequeuing of the target entity object, wherein the performing dequeuing of the target entity object comprises:
acquiring an entity object corresponding to the next level dependency relationship of the entity object on which the target entity object depends;
judging whether the entity object corresponding to the next level dependency relationship is dequeued or not;
when the entity object corresponding to the next level dependency relationship is not dequeued, deleting the target entity object from the initial queue to obtain a first target queue, randomly selecting any entity object from the target queue for dequeuing, and determining any implementation object as a first target entity object; or when the entity object corresponding to the next level dependency relationship dequeues, adding the entity object corresponding to the next level dependency relationship into the initial queue to obtain a second target queue, randomly selecting any entity object from the second target queue to dequeue, and determining the any entity object as a second target entity object, wherein the target queue comprises a first target queue or a second target queue, and the target entity object comprises a first target entity object or a second target entity object;
repeatedly executing dequeuing of the target entity object until the target queue is empty, and recording the number of all dequeued entity objects;
if the number of all the entity objects which are dequeued is equal to the number of the entity objects in the global dependency relationship graph, determining that a cyclic dependency relationship does not exist in the global dependency relationship graph; or alternatively
And if the number of all the dequeued entity objects is not equal to the data of the entity objects in the global dependency relationship graph, determining that a cyclic dependency relationship exists in the global dependency relationship graph.
Optionally, the optimizing the global dependency graph to obtain the target dependency graph includes:
identifying the number of each entity object in the global dependency graph that depends on other entity objects;
when the number of each entity object depending on other entity objects is multiple, determining each entity object as a target queue element, and adding the target queue element into a preset initial queue;
based on the preset initial queue, selecting the target queue element to dequeue, and executing dequeuing of the target queue element, wherein the executing of dequeuing of the target queue element comprises:
obtaining a plurality of third entity objects on which the target queue elements depend;
judging whether a fourth entity object depended by each third entity object is dequeued or not;
when the fourth entity object on which each third entity object depends is dequeued, adding the fourth entity object on which each third entity object depends into the preset initial queue; or, when the fourth entity object on which each third entity object depends is not dequeued, determining the dependency relationship between the target queue element and the fourth entity object on which each third entity object depends as a candidate optimization edge;
randomly selecting any fourth entity object from the preset initial queue for dequeuing, determining the any fourth entity object as a target queue element, and repeatedly performing dequeuing of the target queue element until the preset initial queue is empty;
acquiring all candidate optimization edges, and traversing the global dependency graph based on each candidate optimization edge;
and when traversing to other execution paths of each candidate optimization edge in the global dependency relationship graph, removing each candidate optimization edge from the global dependency relationship graph to obtain a target dependency relationship graph.
Optionally, traversing the target dependency graph based on the at least one policy to be queried to obtain a data query result includes:
identifying a request input in the at least one policy to be queried, wherein the request input is taken as a traversal starting point;
and traversing the target dependency relationship graph based on the traversal starting point to obtain a data query result.
Optionally, the converting the unstructured data into a plurality of entity objects comprises:
converting the unstructured data into a plurality of data tables meeting a third paradigm requirement;
and carrying out entity conversion on the plurality of data tables according to a preset conversion rule to obtain a plurality of entity objects.
A second aspect of the present invention provides an artificial intelligence based data query apparatus, the apparatus comprising:
the analysis and conversion module is used for analyzing the received data query request, acquiring at least one strategy to be queried and unstructured data which has an association relation with the at least one strategy to be queried, and converting the unstructured data into a plurality of entity objects;
the construction module is used for constructing a global dependency graph based on the dependency among the entity objects;
the checking module is used for checking whether a cyclic dependency relationship exists in the global dependency relationship diagram by adopting a preset algorithm;
the optimization module is used for optimizing the global dependency graph to obtain a target dependency graph when a cyclic dependency exists in the global dependency graph;
and the traversing module is used for traversing the target dependency relationship graph based on the at least one strategy to be queried to obtain a data query result.
A third aspect of the invention provides an electronic device comprising a processor and a memory, the processor being configured to implement the artificial intelligence based data query method when executing a computer program stored in the memory.
A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the artificial intelligence based data query method.
In summary, according to the data query method, the data query device, the electronic device and the medium based on artificial intelligence, the unstructured data is converted into the plurality of entity objects, the global dependency graph is constructed based on the dependencies among the entity objects, query execution paths and logic adjustment of the entity objects are facilitated, the entity objects corresponding to the next-level dependencies of each entity object can be quickly located, problem troubleshooting efficiency and verification efficiency after processing logic adjustment among the entity objects are improved, and data query efficiency is further improved. And checking whether the global dependency graph has a cyclic dependency relationship by adopting a preset algorithm, and storing the global dependency graph without the cyclic dependency relationship. When the global dependency graph has a cyclic dependency relationship, the global dependency graph is optimized to obtain a target dependency graph, repeated data query is reduced by optimizing the global dependency graph, and data query efficiency is improved.
Drawings
Fig. 1 is a flowchart of an artificial intelligence based data query method according to an embodiment of the present invention.
Fig. 2 is a first schematic diagram of a constructed global dependency graph according to an embodiment of the present invention.
Fig. 3 is a second schematic diagram of a global dependency graph according to an embodiment of the present invention.
Fig. 4 is a third schematic diagram of a global dependency graph according to an embodiment of the present invention.
Fig. 5 is a fourth schematic diagram of a global dependency graph according to an embodiment of the present invention.
Fig. 6 is a fifth schematic diagram of a global dependency graph according to an embodiment of the present invention.
Fig. 7 is a block diagram of an artificial intelligence based data query apparatus according to a second embodiment of the present invention.
Fig. 8 is a schematic structural diagram of an electronic device according to a third embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a detailed description of the present invention will be given below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and features of the embodiments may be combined with each other without conflict.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
Example one
Fig. 1 is a flowchart of a data query method based on artificial intelligence according to an embodiment of the present invention.
In this embodiment, the artificial intelligence based data query method may be applied to an electronic device, and for an electronic device that needs to perform artificial intelligence based data query, the artificial intelligence based data query function provided by the method of the present invention may be directly integrated on the electronic device, or may be run in the electronic device in the form of a Software Development Kit (SDK).
The embodiment of the invention can acquire and process related data based on an artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result.
The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning, deep learning and the like.
As shown in fig. 1, the artificial intelligence based data query method specifically includes the following steps, and the order of the steps in the flowchart may be changed and some may be omitted according to different requirements.
S11, analyzing the received data query request, obtaining at least one strategy to be queried and unstructured data which has an association relation with the at least one strategy to be queried, and converting the unstructured data into a plurality of entity objects.
In this embodiment, if a user initiates a request for applying for a credit card query through a client, analyzing the request for applying for a credit card query to obtain a policy to be queried and unstructured data associated with the policy to be queried, specifically, the policy to be queried may include a credit card applying policy, a credit limit adjusting policy, or other policies, where the credit card applying policy is used to query revenue data, credit investigation data, and other data related to a credit card application of the user; the credit line adjustment strategy is used for inquiring historical repayment records, income data, credit line promotion data and other data related to credit card credit lines of the user.
In an alternative embodiment, the converting the unstructured data into a plurality of entity objects comprises:
converting the unstructured data into a plurality of data tables meeting a third paradigm requirement;
and carrying out entity conversion on the data tables according to a preset conversion rule to obtain a plurality of entity objects.
In this embodiment, the Third norm Form (3 rd NF) indicates that all data elements in the table must be mutually independent and have no other functional relationship, as well as being uniquely identified by the primary key. That is, for a data structure that satisfies 2nd NF, there may be some dependency of some data elements on other non-key data elements in the table that must be eliminated.
In this embodiment, the entity object refers to a data table in which entity information is recorded, for example, the entity object: and the basic information table comprises basic information such as the mobile phone number, the identification card number, the name, the age and the like of the user.
In this embodiment, by converting the unstructured data into a plurality of data tables meeting the third paradigm requirement, data redundancy, update exception, insertion exception, and deletion exception in the unstructured data can be eliminated, accuracy of obtaining the plurality of data tables is ensured, and the plurality of data tables are converted into a plurality of entity objects, so that accuracy of the plurality of entity objects is improved.
S12, constructing a global dependency graph based on the dependency relationships among the entity objects.
In this embodiment, the global dependency graph is created according to the dependency relationship among the entity objects, and specifically, the global dependency graph of the data query request is determined according to the created local dependency graph of the at least one policy to be queried by creating the local dependency graph of each policy to be queried in the data query request.
In an optional embodiment, the building a global dependency graph based on the dependencies between the plurality of entity objects includes:
acquiring request input of each strategy to be inquired;
identifying a plurality of first entity objects on which the request input depends, and determining the plurality of first entity objects as a first level dependency relationship of the request input;
continuing to identify a plurality of second entity objects upon which each entity object in the first hierarchical dependency depends, determining the plurality of second entity objects as a next hierarchical dependency of the first hierarchical dependency of the request input;
repeatedly executing the construction of the next-level dependency relationship of the last-level dependency relationship of each strategy to be queried according to the residual entity objects on which each entity object in the last-level dependency relationship depends until the construction of all the level dependency relationships is completed, and obtaining a local dependency relationship graph of each strategy to be queried;
and constructing a global dependency graph according to the local dependency graph of each strategy to be queried.
Referring to the constructed global dependency graph based on the data query request shown in fig. 2, for example, the request input of each policy to be queried, the plurality of first entity objects on which the request input depends are identified as: the variable A, the data source B and the data source C form a first-level dependency relationship of the request input; the variable B, the variable C, the variable D and the variable E form a second level dependency relationship of the request input; the data source D and the variable F form a third-level dependency relationship of the request input; variable G constitutes a fourth level dependency of the request input.
Further, the constructing a global dependency graph according to the local dependency graph of each policy to be queried includes:
identifying whether the same entity object exists in the local dependency graph of the at least one policy to be queried;
and when the same entity object exists in the local dependency relationship graph of the at least one strategy to be queried, taking the same entity object as a common node, and merging the local dependency relationship graphs of the strategies to be queried according to the common node to obtain a global dependency relationship graph.
In this embodiment, when the data query request includes a policy to be queried, determining a local dependency graph of the policy to be queried as a global dependency graph of the data query request; or, when the data query request contains a plurality of strategies to be queried, identifying whether the same entity object exists in a plurality of local dependency relationship graphs of the strategies to be queried or not; when the same entity object exists in the multiple local dependency graphs of the multiple strategies to be queried, the same entity object is used as a common node, the multiple local dependency graphs of the multiple strategies to be queried are merged according to the common node, and the multiple local dependency graphs of the multiple strategies to be queried after merging are determined to be the global dependency graph of the data query request.
Further, the method further comprises:
and when the same entity object does not exist in the local dependency relationship graph of the at least one strategy to be queried, merging the local dependency relationship graphs of the at least one strategy to be queried to obtain a global dependency relationship graph.
In this embodiment, by constructing the global dependency relationship graph for the plurality of entity objects, the query execution path and the logic adjustment of the entity objects are facilitated, the entity object corresponding to the next-level dependency relationship of each entity object can be quickly located, the problem troubleshooting efficiency and the verification efficiency after the logic adjustment between the entity objects are processed are improved, and the data query efficiency and the data accuracy are further improved.
And S13, checking whether a circular dependency relationship exists in the global dependency relationship diagram by adopting a preset algorithm.
In this embodiment, the preset algorithm may be a topology ranking algorithm, the topology ranking algorithm is configured to detect whether a ring exists in the global dependency graph, and if a ring exists in the global dependency graph, it is determined that a cyclic dependency exists in the global dependency graph; and if the global dependency graph does not have a ring, determining that the cyclic dependency graph does not exist.
In an optional embodiment, the checking whether a cyclic dependency exists in the global dependency graph by using a preset algorithm includes:
acquiring all entity objects without the dependency relationship of the global dependency relationship diagram, and adding all the entity objects into a preset initial queue;
randomly selecting any entity object from the initial queue to dequeue, determining the any entity object as a target entity object, and performing dequeuing of the target entity object, wherein the performing dequeuing of the target entity object comprises:
acquiring an entity object corresponding to the next level dependency relationship of the entity object on which the target entity object depends;
judging whether the entity object corresponding to the next level dependency relationship is dequeued or not;
when the entity object corresponding to the next level dependency relationship is not dequeued, deleting the target entity object from the initial queue to obtain a first target queue, randomly selecting any entity object from the target queue for dequeuing, and determining any implementation object as a first target entity object; or when the entity object corresponding to the next level dependency relationship dequeues, adding the entity object corresponding to the next level dependency relationship into the initial queue to obtain a second target queue, randomly selecting any entity object from the second target queue to dequeue, and determining the any entity object as a second target entity object, wherein the target queue comprises a first target queue or a second target queue, and the target entity object comprises a first target entity object or a second target entity object;
repeatedly executing dequeuing of the target entity object until the target queue is empty, and recording the number of all dequeued entity objects;
if the number of all the entity objects which are dequeued is equal to the number of the entity objects in the global dependency relationship graph, determining that no cyclic dependency relationship exists in the global dependency relationship graph; or
And if the number of all the entity objects which are dequeued is not equal to the data of the entity objects in the global dependency relationship graph, determining that a cyclic dependency relationship exists in the global dependency relationship graph.
Illustratively, referring to the global dependency graph shown in fig. 3, a topology sorting algorithm is adopted to check whether a circular dependency exists in the global dependency graph, specifically: acquiring an entity object A and an entity object D of a global dependency relationship graph without dependency relationship, and adding the entity object A and the entity object D into an initial queue; randomly selecting an entity object A from the initial queue for dequeuing, determining the entity object A as a target entity object, and performing dequeuing of the target entity object comprises the following steps: determining that the entity object C and the entity object E are not dequeued, deleting the entity object A from an initial queue to obtain a first target queue, determining the entity object D as a first target entity object, performing dequeue of the first target entity object D, notifying the entity object E, and adding the entity object E into the first target queue to obtain a second target queue, wherein the entity object C and the entity object E correspond to a next-level dependency relationship of an entity object B on which the entity object A depends; determining the entity object E as a second target entity object and performing target entity object dequeuing, notifying an entity object B and an entity object F that an entity object A depended on by the entity object B is dequeued and an entity object C depended on by the entity object F is not dequeued, adding the entity object B into a second target queue, determining the entity object B as the second target entity object and performing target entity object dequeuing, notifying the entity object C that an entity object G depended on by the entity object C is not dequeued and cannot be added into the target queue, determining that the queue in the target queue is empty, recording the number of dequeued entity objects as 4 and the number of entity objects in the global dependency relationship graph as 7, and determining that the global dependency relationship exists in the global dependency relationship graph.
In this embodiment, by detecting whether a loop dependency relationship exists in the global dependency relationship diagram, if a loop dependency relationship exists, the code is not allowed to be saved and submitted.
And S14, when the global dependency relationship graph has a circular dependency relationship, optimizing the global dependency relationship graph to obtain a target dependency relationship graph.
In this embodiment, if one entity object has a candidate optimization edge, the dependency graph obtained by removing the candidate optimization edge from the global dependency graph.
In an optional real-time example, the optimizing the global dependency graph to obtain the target dependency graph includes:
identifying the number of each entity object in the global dependency graph that depends on other entity objects;
when the number of each entity object depending on other entity objects is multiple, determining each entity object as a target queue element, and adding the target queue element into a preset initial queue;
based on the preset initial queue, selecting the target queue element to dequeue, and executing dequeuing of the target queue element, wherein the executing of dequeuing of the target queue element comprises:
obtaining a plurality of third entity objects on which the target queue elements depend;
judging whether a fourth entity object depended by each third entity object is dequeued or not;
when the fourth entity object on which each third entity object depends is dequeued, adding the fourth entity object on which each third entity object depends into the preset initial queue; or, when the fourth entity object on which each third entity object depends is not dequeued, determining the dependency relationship between the target queue element and the fourth entity object on which each third entity object depends as a candidate optimization edge;
randomly selecting any fourth entity object from the preset initial queue for dequeuing, determining the any fourth entity object as a target queue element, and repeatedly performing dequeuing of the target queue element until the preset initial queue is empty;
acquiring all candidate optimization edges, and traversing the global dependency graph based on each candidate optimization edge;
and when traversing to other execution paths of each candidate optimization edge in the global dependency relationship graph, removing each candidate optimization edge from the global dependency relationship graph to obtain a target dependency relationship graph.
In this embodiment, referring to the global dependency graph shown in fig. 4, the global dependency graph includes entity objects: A. b, C, D, E, F, selecting A for dequeuing to obtain B, D and E of A dependence, wherein D dependence C is not dequeued yet, D → A is determined as an entity object candidate optimization edge, B and E dependence A is dequeued, B and E are added into a preset initial queue, and the preset initial queue contains B and E; randomly selecting an entity object: b dequeues, the dependency B of C is dequeued, C is added into a preset initial queue, and the preset initial queue contains E and C; randomly selecting an entity object: e, dequeuing, wherein the dependence E of F is dequeued, and F is added into a preset initial queue, so that the preset initial queue comprises C and F; randomly selecting an entity object: c dequeues, the dependencies A and C of D are dequeued, D is added into a preset initial queue, the preset initial queue comprises queue elements F and D, an entity object F and an entity object D are randomly selected to be dequeued in sequence, the preset initial queue is empty, and the obtained candidate optimization edge is D → A; based on the traversal of the global dependency graph by D → A, D can also access A through other paths D → C → B → A, so D → A is removed from the global dependency graph to obtain the target dependency graph.
Further, the method further comprises:
when other execution paths of each candidate optimization edge are not traversed in the global dependency graph, reserving each candidate optimization edge, and determining the global dependency graph as a target dependency graph.
In this embodiment, referring to the global dependency graph shown in fig. 5, the global dependency graph includes entity objects: A. b, C, D, E, selecting A to dequeue to obtain B and D of the A dependence, wherein the dependence A of B and D is dequeued, adding B and D into the preset initial queue, and the preset initial queue comprises B and D; randomly selecting an entity object: b dequeues, and B adds C into a preset initial queue depending on that C is not dequeued, so that the preset initial queue comprises D and C; randomly selecting an entity object: c is dequeued, the dependency E of C is not dequeued, E is added into a preset initial queue, and the preset initial queue comprises D and E; randomly selecting an entity object D to dequeue, determining the dependency E of the D not to dequeue, and determining E → D as an entity object candidate optimization edge; randomly selecting an entity object: e, dequeuing, wherein the entity object depended by the E is empty, the preset initial queue is empty, and the obtained candidate optimization edge is E → D; based on E → D traversing the global dependency graph, E cannot find other paths to access D, so E → D cannot be optimized.
In the embodiment, the global dependency graph is optimized, repeated data query is reduced, and the data query efficiency is improved.
S15, when the global dependency graph does not have the circular dependency, saving the global dependency graph.
In this embodiment, if no cyclic dependency exists in the global dependency graph, the constructed global dependency graph is stored, which facilitates subsequent data query by using the global dependency graph, and meanwhile, since no cyclic dependency exists, a query execution path is facilitated, and data query efficiency and accuracy are improved.
S16, traversing the target dependency graph based on the at least one strategy to be queried to obtain a data query result.
In this embodiment, the data query result includes all entity objects corresponding to each policy to be queried.
In an optional embodiment, the traversing the target dependency graph based on the at least one policy to be queried to obtain a data query result includes:
identifying a request input in the at least one policy to be queried, wherein the request input is taken as a traversal starting point;
and traversing the target dependency graph based on the traversal starting point to obtain a data query result.
Further, the method further comprises:
and when an updating instruction for the dependency relationship of any entity object in the global dependency relationship graph is received, responding to the updating instruction, deleting the original dependency relationship corresponding to any entity object, and adding a new dependency relationship.
Exemplarily, referring to the global dependency graph shown in fig. 6, the global dependency graph includes an entity object A, B, C, D, E, F, G, where a current F depends only on E, and after new dependencies F → E and F → C are added, the updated global dependency graph is obtained, where the new dependencies F → E and F → C are added, and the original dependency F → E corresponding to F is deleted, and the updated global dependency graph is obtained, as shown in fig. 2.
In this embodiment, an entity object F is used as a query starting point, and a queue is updated, where the update queue includes F; randomly selecting an entity object: f dequeues, E and C depended by F are added into an updating queue, and the updating queue comprises E and C; randomly selecting an entity object: e, dequeuing, adding D depended by E into an updating queue, wherein the updating queue comprises C and D; randomly selecting an entity object: c dequeues, G which is depended by C is added into an updating queue, and the updating queue comprises D and G; randomly selecting an entity object: d, dequeuing without dependence adding; randomly selecting an entity object: g dequeues, F depended by G is added into an updating queue, and the updating queue comprises F; selecting an entity object: f dequeues, and F is dequeued twice, which shows that the cyclic dependency exists, but A and B are not traversed, so that the updating process of the dependency between the entity objects in the global dependency graph is a local graph traversal process, the problem of the existing detection algorithm based on the whole graph is solved, the updating efficiency of the global dependency graph is improved, and the query efficiency of data is further improved.
In summary, in the data query method based on artificial intelligence according to this embodiment, the unstructured data is converted into the plurality of entity objects, and the global dependency graph is constructed based on the dependencies among the plurality of entity objects, so that the query execution path and the logic adjustment of the entity objects are facilitated, the entity object corresponding to the next-level dependency of each entity object can be quickly located, the problem troubleshooting efficiency and the verification efficiency after the logic adjustment is processed among the entity objects are improved, and the data query efficiency is further improved. And checking whether the global dependency graph has a cyclic dependency relationship by adopting a preset algorithm, and storing the global dependency graph without the cyclic dependency relationship. When the global dependency relationship graph has a cyclic dependency relationship, the global dependency relationship graph is optimized to obtain a target dependency relationship graph, repeated data query is reduced by optimizing the global dependency relationship graph, and data query efficiency is improved.
Example two
Fig. 7 is a block diagram of an artificial intelligence based data query apparatus according to a second embodiment of the present invention.
In some embodiments, the artificial intelligence based data query device 20 may include a plurality of functional modules comprised of program code segments. The program code of each program segment in the artificial intelligence based data query apparatus 20 may be stored in a memory of the electronic device and executed by the at least one processor to perform (described in detail in fig. 1-6) the functions of the artificial intelligence based data query.
In this embodiment, the artificial intelligence based data query device 20 may be divided into a plurality of functional modules according to the functions performed by the device. The functional module may include: parsing and conversion module 201, building module 202, checking module 203, optimizing module 204, saving module 205, traversing module 206, and deleting module 207. The module referred to herein is a series of computer readable instruction segments stored in a memory that can be executed by at least one processor and that can perform a fixed function. In the present embodiment, the functions of the modules will be described in detail in the following embodiments.
The analyzing and converting module 201 is configured to analyze the received data query request, obtain at least one policy to be queried and unstructured data having an association relationship with the at least one policy to be queried, and convert the unstructured data into a plurality of entity objects.
In this embodiment, if a user initiates a request for applying for a credit card query through a client, analyzing the request for applying for a credit card query to obtain a policy to be queried and unstructured data associated with the policy to be queried, specifically, the policy to be queried may include a credit card applying policy, a credit limit adjusting policy, or other policies, where the credit card applying policy is used to query revenue data, credit investigation data, and other data related to a credit card application of the user; the credit line adjusting strategy is used for inquiring historical repayment records, income data, credit line increasing data and other data related to the credit card credit line of the user.
In an alternative embodiment, the parsing and conversion module 201 converting the unstructured data into a plurality of entity objects comprises:
converting the unstructured data into a plurality of data tables meeting a third paradigm requirement;
and carrying out entity conversion on the data tables according to a preset conversion rule to obtain a plurality of entity objects.
In this embodiment, the Third norm Form (3 rd NF) indicates that all data elements in the table must be mutually independent and have no other functional relationship, as well as being uniquely identified by the primary key. That is, for a data structure that satisfies 2nd NF, there may be some dependency of some data elements on other non-key data elements in the table that must be eliminated.
In this embodiment, the entity object refers to a data table in which entity information is recorded, for example, the entity object: the basic information table comprises basic information such as mobile phone numbers, identification card numbers, names, ages and the like of users.
In this embodiment, by converting the unstructured data into a plurality of data tables meeting the third paradigm requirement, data redundancy, update exception, insertion exception, and deletion exception in the unstructured data can be eliminated, accuracy of obtaining the plurality of data tables is ensured, and the plurality of data tables are converted into a plurality of entity objects, so that accuracy of the plurality of entity objects is improved.
A building module 202, configured to build a global dependency graph based on dependencies between the plurality of entity objects.
In this embodiment, the global dependency graph is created according to the dependency relationship among the entity objects, and specifically, the global dependency graph of the data query request is determined according to the created local dependency graph of the at least one policy to be queried by creating the local dependency graph of each policy to be queried in the data query request.
In an alternative embodiment, the building module 202 building the global dependency graph based on the dependencies between the entity objects includes:
acquiring request input of each strategy to be inquired;
identifying a plurality of first entity objects on which the request input depends, and determining the plurality of first entity objects as a first hierarchical dependency relationship of the request input;
continuing to identify a plurality of second entity objects upon which each entity object in the first hierarchical dependency depends, determining the plurality of second entity objects as a next hierarchical dependency of the first hierarchical dependency of the request input;
repeatedly executing the construction of the next-level dependency relationship of the last-level dependency relationship of each strategy to be queried according to the residual entity objects on which each entity object in the last-level dependency relationship depends until the construction of all the level dependency relationships is completed, and obtaining a local dependency relationship graph of each strategy to be queried;
and constructing a global dependency relationship graph according to the local dependency relationship graph of each strategy to be queried.
Referring to the constructed global dependency graph based on the data query request shown in fig. 2, for example, the request input of each policy to be queried, the plurality of first entity objects on which the request input depends are identified as: the variable A, the data source B and the data source C form a first-level dependency relationship of the request input; the variable B, the variable C, the variable D and the variable E form a second level dependency relationship of the request input; the data source D and the variable F form a third-level dependency relationship of the request input; variable G constitutes a fourth level dependency of the request input.
Further, the constructing a global dependency graph according to the local dependency graph of each policy to be queried includes:
identifying whether the same entity object exists in the local dependency graph of the at least one policy to be queried;
when the same entity object exists in the local dependency relationship graph of the at least one strategy to be queried, the same entity object is used as a common node, and the local dependency relationship graphs of the strategies to be queried are combined according to the common node to obtain a global dependency relationship graph.
In this embodiment, when the data query request includes a policy to be queried, determining a local dependency graph of the policy to be queried as a global dependency graph of the data query request; or, when the data query request contains a plurality of strategies to be queried, identifying whether the same entity object exists in a plurality of local dependency relationship graphs of the plurality of strategies to be queried; when the same entity object exists in the multiple local dependency graphs of the multiple strategies to be queried, the same entity object is used as a common node, the multiple local dependency graphs of the multiple strategies to be queried are merged according to the common node, and the multiple local dependency graphs of the multiple strategies to be queried after merging are determined to be the global dependency graph of the data query request.
Further, the method further comprises:
and when the same entity object does not exist in the local dependency relationship graph of the at least one strategy to be queried, merging the local dependency relationship graphs of the at least one strategy to be queried to obtain a global dependency relationship graph.
In the embodiment, the global dependency graph is constructed for the entity objects, so that the query execution path and the logic adjustment of the entity objects are facilitated, the entity object corresponding to the next-level dependency of each entity object can be quickly positioned, the problem troubleshooting efficiency and the verification efficiency after the logic adjustment is processed between the entity objects are improved, and the data query efficiency and the data query accuracy are further improved.
The checking module 203 is configured to check whether a cyclic dependency exists in the global dependency graph by using a preset algorithm.
In this embodiment, the preset algorithm may be a topology ranking algorithm, the topology ranking algorithm is configured to detect whether a ring exists in the global dependency graph, and if a ring exists in the global dependency graph, it is determined that a cyclic dependency exists in the global dependency graph; and if the global dependency graph does not have a ring, determining that the cyclic dependency graph does not exist.
In an optional embodiment, the checking module 203, using a preset algorithm, for checking whether a cyclic dependency exists in the global dependency graph includes:
acquiring all entity objects without dependency relationship of the global dependency relationship graph, and adding all the entity objects into a preset initial queue;
randomly selecting any entity object from the initial queue to dequeue, determining the any entity object as a target entity object, and performing dequeuing of the target entity object, wherein the performing dequeuing of the target entity object comprises:
acquiring an entity object corresponding to the next level dependency relationship of the entity object on which the target entity object depends;
judging whether the entity object corresponding to the next level dependency relationship is dequeued or not;
when the entity object corresponding to the next level dependency relationship is not dequeued, deleting the target entity object from the initial queue to obtain a first target queue, randomly selecting any one entity object from the target queue to dequeue, and determining any one implementation object as a first target entity object; or when the entity object corresponding to the next level dependency relationship dequeues, adding the entity object corresponding to the next level dependency relationship into the initial queue to obtain a second target queue, randomly selecting any entity object from the second target queue to dequeue, and determining the any entity object as a second target entity object, wherein the target queue comprises a first target queue or a second target queue, and the target entity object comprises a first target entity object or a second target entity object;
repeatedly executing dequeuing of the target entity object until the target queue is empty, and recording the number of all dequeued entity objects;
if the number of all the entity objects which are dequeued is equal to the number of the entity objects in the global dependency relationship graph, determining that no cyclic dependency relationship exists in the global dependency relationship graph; or alternatively
And if the number of all the dequeued entity objects is not equal to the data of the entity objects in the global dependency relationship graph, determining that a cyclic dependency relationship exists in the global dependency relationship graph.
Illustratively, referring to the global dependency graph shown in fig. 3, a topology sorting algorithm is adopted to check whether a circular dependency exists in the global dependency graph, specifically: acquiring an entity object A and an entity object D of a global dependency relationship graph without dependency relationship, and adding the entity object A and the entity object D into an initial queue; randomly selecting an entity object A from the initial queue for dequeuing, determining the entity object A as a target entity object, and performing dequeuing of the target entity object comprises: determining that the entity object C and the entity object E are not dequeued, deleting the entity object A from an initial queue to obtain a first target queue, determining the entity object D as a first target entity object, performing dequeue of the first target entity object D, notifying the entity object E that the entity object D depending on the entity object E is dequeued, and adding the entity object E into the first target queue to obtain a second target queue; determining the entity object E as a second target entity object and performing target entity object dequeuing, notifying an entity object B and an entity object F that an entity object A depended on by the entity object B is dequeued and an entity object C depended on by the entity object F is not dequeued, adding the entity object B into a second target queue, determining the entity object B as the second target entity object and performing target entity object dequeuing, notifying the entity object C that an entity object G depended on by the entity object C is not dequeued and cannot be added into the target queue, determining that the queue in the target queue is empty, recording the number of dequeued entity objects as 4 and the number of entity objects in the global dependency relationship graph as 7, and determining that the global dependency relationship exists in the global dependency relationship graph.
In this embodiment, by detecting whether a loop dependency relationship exists in the global dependency relationship diagram, if a loop dependency relationship exists, the code is not allowed to be saved and submitted.
And the optimizing module 204 is configured to optimize the global dependency graph to obtain a target dependency graph when a cyclic dependency exists in the global dependency graph.
In this embodiment, if one entity object has a candidate optimization edge, the dependency graph obtained by removing the candidate optimization edge from the global dependency graph.
In an optional real-time example, the optimizing module 204 optimizes the global dependency graph to obtain a target dependency graph, including:
identifying the number of each entity object in the global dependency graph that depends on other entity objects;
when the number of each entity object depending on other entity objects is multiple, determining each entity object as a target queue element, and adding the target queue element into a preset initial queue;
based on the preset initial queue, selecting the target queue element to dequeue, and executing dequeuing of the target queue element, wherein the executing of dequeuing of the target queue element comprises:
obtaining a plurality of third entity objects on which the target queue elements depend;
judging whether a fourth entity object depended by each third entity object is dequeued or not;
when the fourth entity object on which each third entity object depends is dequeued, adding the fourth entity object on which each third entity object depends into the preset initial queue; or, when the fourth entity object on which each third entity object depends is not dequeued, determining the dependency relationship between the target queue element and the fourth entity object on which each third entity object depends as a candidate optimization edge;
randomly selecting any fourth entity object from the preset initial queue for dequeuing, determining the any fourth entity object as a target queue element, and repeatedly performing dequeuing of the target queue element until the preset initial queue is empty;
acquiring all candidate optimization edges, and traversing the global dependency graph based on each candidate optimization edge;
and when traversing to other execution paths of each candidate optimization edge in the global dependency relationship graph, removing each candidate optimization edge from the global dependency relationship graph to obtain a target dependency relationship graph.
In this embodiment, referring to the global dependency graph shown in fig. 4, the global dependency graph includes entity objects: A. b, C, D, E, F, selecting A for dequeuing to obtain B, D and E of A dependence, wherein D dependence C is not dequeued yet, D → A is determined as an entity object candidate optimization edge, B and E dependence A is dequeued, B and E are added into a preset initial queue, and the preset initial queue contains B and E; randomly selecting an entity object: b dequeues, the dependency B of C is dequeued, C is added into a preset initial queue, and the preset initial queue contains E and C; randomly selecting an entity object: e, dequeuing, wherein the dependence E of F is dequeued, and F is added into a preset initial queue, so that the preset initial queue comprises C and F; randomly selecting an entity object: c dequeues, the dependencies A and C of D are dequeued, D is added into a preset initial queue, the preset initial queue comprises queue elements F and D, an entity object F and an entity object D are randomly selected to be dequeued in sequence, the preset initial queue is empty, and the obtained candidate optimization edge is D → A; based on the traversal of the global dependency graph by D → A, D can also access A through other paths D → C → B → A, so D → A is removed from the global dependency graph to obtain the target dependency graph.
Further, when other execution paths of each candidate optimization edge are not traversed in the global dependency graph, each candidate optimization edge is reserved, and the global dependency graph is determined as a target dependency graph.
In this embodiment, referring to the global dependency graph shown in fig. 5, the global dependency graph includes entity objects: A. b, C, D, E, selecting A to dequeue to obtain B and D of the A dependence, wherein the dependence A of B and D is dequeued, adding B and D into the preset initial queue, and the preset initial queue comprises B and D; randomly selecting an entity object: b dequeues, and B adds C into a preset initial queue depending on that C is not dequeued, so that the preset initial queue comprises D and C; randomly selecting an entity object: c is dequeued, the dependency E of C is not dequeued, E is added into a preset initial queue, and the preset initial queue comprises D and E; randomly selecting an entity object D to dequeue, determining the dependency E of the D not to dequeue, and determining E → D as an entity object candidate optimization edge; randomly selecting an entity object: e, dequeuing, wherein the entity object depended by the E is empty, the preset initial queue is empty, and the obtained candidate optimization edge is E → D; based on E → D traversing the global dependency graph, E cannot find other paths to access D, so E → D cannot be optimized.
In the embodiment, the global dependency graph is optimized, repeated data query is reduced, and the data query efficiency is improved.
And the saving module 205 is configured to save the global dependency graph when no cyclic dependency exists in the global dependency graph.
In this embodiment, if no cyclic dependency exists in the global dependency graph, the constructed global dependency graph is stored, which facilitates subsequent data query by using the global dependency graph, and meanwhile, since no cyclic dependency exists, a query execution path is facilitated, and data query efficiency and accuracy are improved.
And the traversing module 206 is configured to traverse the target dependency graph based on the at least one policy to be queried to obtain a data query result.
In this embodiment, the data query result includes all entity objects corresponding to each policy to be queried.
In an optional embodiment, the traversing module 206 traverses the target dependency graph based on the at least one policy to be queried to obtain a data query result, including:
identifying a request input in the at least one strategy to be queried, wherein the request input is used as a traversal starting point;
and traversing the target dependency relationship graph based on the traversal starting point to obtain a data query result.
A deleting module 207, configured to, when an update instruction for any entity object dependency relationship in the global dependency relationship diagram is received, respond to the update instruction, delete an original dependency relationship corresponding to any entity object, and add a new dependency relationship.
Exemplarily, referring to the global dependency graph shown in fig. 6, the global dependency graph includes an entity object A, B, C, D, E, F, G, where a current F depends only on E, and after new dependencies F → E and F → C are added, the updated global dependency graph is obtained, where the new dependencies F → E and F → C are added, and the original dependency F → E corresponding to F is deleted, and the updated global dependency graph is obtained, as shown in fig. 2.
In this embodiment, an entity object F is used as a query starting point, and a queue is updated, where the update queue includes F; randomly selecting an entity object: f dequeues, and E and C which are depended by F are added into an updating queue, wherein the updating queue comprises E and C; randomly selecting an entity object: e, dequeuing, adding D depended by E into an updating queue, wherein the updating queue comprises C and D; randomly selecting an entity object: c dequeues, G which is depended by C is added into an updating queue, and the updating queue comprises D and G; randomly selecting an entity object: d, dequeuing without dependence adding; randomly selecting an entity object: g dequeues, F depended by G is added into an updating queue, and the updating queue comprises F; selecting an entity object: f dequeues, and F is dequeued twice, which shows that the cyclic dependency exists, but A and B are not traversed, so that the updating process of the dependency between the entity objects in the global dependency graph is a local graph traversal process, the problem of the existing detection algorithm based on the whole graph is solved, the updating efficiency of the global dependency graph is improved, and the query efficiency of data is further improved.
In summary, in the data query apparatus based on artificial intelligence according to this embodiment, the unstructured data is converted into the plurality of entity objects, and the global dependency graph is constructed based on the dependencies among the plurality of entity objects, so that the query execution path and the logic adjustment of the entity objects are facilitated, the entity object corresponding to the next-level dependency of each entity object can be quickly located, the problem troubleshooting efficiency and the verification efficiency after the logic adjustment is processed among the entity objects are improved, and the data query efficiency is further improved. And checking whether the global dependency relationship graph has a cyclic dependency relationship by adopting a preset algorithm, and storing the global dependency relationship graph without the cyclic dependency relationship. When the global dependency relationship graph has a cyclic dependency relationship, the global dependency relationship graph is optimized to obtain a target dependency relationship graph, repeated data query is reduced by optimizing the global dependency relationship graph, and data query efficiency is improved.
EXAMPLE III
Fig. 8 is a schematic structural diagram of an electronic device according to a third embodiment of the present invention. In the preferred embodiment of the present invention, the electronic device 3 comprises a memory 31, at least one processor 32, at least one communication bus 33 and a transceiver 34.
It will be appreciated by those skilled in the art that the configuration of the electronic device shown in fig. 8 does not constitute a limitation of the embodiment of the present invention, and may be a bus-type configuration or a star-type configuration, and the electronic device 3 may include more or less hardware or software than those shown, or different component arrangements.
In some embodiments, the electronic device 3 is an electronic device capable of automatically performing numerical calculation and/or information processing according to instructions set or stored in advance, and the hardware thereof includes but is not limited to a microprocessor, an application specific integrated circuit, a programmable gate array, a digital processor, an embedded device, and the like. The electronic device 3 may also include a client device, which includes, but is not limited to, any electronic product that can interact with a client through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device, for example, a personal computer, a tablet computer, a smart phone, a digital camera, and the like.
It should be noted that the electronic device 3 is only an example, and other existing or future electronic products, such as may be adapted to the present invention, should also be included in the scope of the present invention, and is included by reference.
In some embodiments, the memory 31 is used for storing program codes and various data, such as the artificial intelligence based data query device 20 installed in the electronic device 3, and realizes high-speed and automatic access to programs or data during the operation of the electronic device 3. The Memory 31 includes a Read-Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), a One-time Programmable Read-Only Memory (OTPROM), an electronically Erasable rewritable Read-Only Memory (Electrically-Erasable Programmable Read-Only Memory (EEPROM)), an optical Read-Only disk (CD-ROM) or other optical disk Memory, a magnetic disk Memory, a tape Memory, or any other medium readable by a computer capable of carrying or storing data.
In some embodiments, the at least one processor 32 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The at least one processor 32 is a Control Unit (Control Unit) of the electronic device 3, connects various components of the electronic device 3 by using various interfaces and lines, and executes various functions and processes data of the electronic device 3 by running or executing programs or modules stored in the memory 31 and calling data stored in the memory 31.
In some embodiments, the at least one communication bus 33 is arranged to enable connectivity communication between the memory 31 and the at least one processor 32, and/or the like.
Although not shown, the electronic device 3 may further include a power supply (such as a battery) for supplying power to various components, and optionally, the power supply may be logically connected to the at least one processor 32 through a power management device, so as to implement functions of managing charging, discharging, and power consumption through the power management device. The power supply may also include any component of one or more dc or ac power sources, recharging devices, power failure detection circuitry, power converters or inverters, power status indicators, and the like. The electronic device 3 may further include various sensors, a bluetooth module, a Wi-Fi module, and the like, which are not described herein again.
It is to be understood that the described embodiments are for purposes of illustration only and that the scope of the appended claims is not limited to such structures.
The integrated unit implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, an electronic device, or a network device) or a processor (processor) to execute parts of the methods according to the embodiments of the present invention.
In a further embodiment, in conjunction with fig. 7, the at least one processor 32 may execute operating means of the electronic device 3 and installed various types of applications (such as the artificial intelligence based data query device 20), program code, and the like, such as the various modules described above.
The memory 31 has program code stored therein, and the at least one processor 32 can call the program code stored in the memory 31 to perform related functions. For example, the modules illustrated in fig. 7 are program code stored in the memory 31 and executed by the at least one processor 32, so as to implement the functions of the modules for the purpose of artificial intelligence based data query.
Illustratively, the program code may be divided into one or more modules/units, which are stored in the memory 31 and executed by the processor 32 to accomplish the present application. The one or more modules/units may be a series of computer readable instruction segments capable of performing certain functions, which are used for describing the execution process of the program code in the electronic device 3. For example, the program code may be partitioned into parsing and conversion module 201, building module 202, checking module 203, optimizing module 204, saving module 205, traversing module 206, and deleting module 207.
In one embodiment of the present invention, the memory 31 stores a plurality of computer-readable instructions that are executed by the at least one processor 32 to implement the functionality of artificial intelligence based data queries.
Specifically, the at least one processor 32 may refer to the description of the relevant steps in the embodiments corresponding to fig. 1 to fig. 6, which is not repeated herein.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and other divisions may be realized in practice.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional module.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or that the singular does not exclude the plural. A plurality of units or means recited in the present invention may also be implemented by one unit or means through software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Finally, it should be noted that the above embodiments are only for illustrating the technical solutions of the present invention and not for limiting, and although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions may be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims (10)
1. A data query method based on artificial intelligence is characterized by comprising the following steps:
analyzing the received data query request, acquiring at least one strategy to be queried and unstructured data which has an association relation with the at least one strategy to be queried, and converting the unstructured data into a plurality of entity objects;
constructing a global dependency graph based on dependencies among the plurality of entity objects;
checking whether a cyclic dependency relationship exists in the global dependency relationship graph by adopting a preset algorithm;
when a cyclic dependency relationship exists in the global dependency relationship diagram, optimizing the global dependency relationship diagram to obtain a target dependency relationship diagram;
and traversing the target dependency relationship graph based on the at least one strategy to be queried to obtain a data query result.
2. The artificial intelligence based data query method of claim 1, wherein said building a global dependency graph based on dependencies between the plurality of entity objects comprises:
acquiring request input of each strategy to be inquired;
identifying a plurality of first entity objects on which the request input depends, and determining the plurality of first entity objects as a first hierarchical dependency relationship of the request input;
continuing to identify a plurality of second entity objects upon which each entity object in the first hierarchical dependency depends, determining the plurality of second entity objects as a next hierarchical dependency of the first hierarchical dependency of the request input;
repeatedly executing the construction of the next-level dependency relationship of the last-level dependency relationship of each strategy to be queried according to the residual entity objects on which each entity object in the last-level dependency relationship depends until the construction of all the hierarchy dependency relationships is completed, and obtaining a local dependency relationship graph of each strategy to be queried;
and constructing a global dependency graph according to the local dependency graph of each strategy to be queried.
3. The artificial intelligence based data query method according to claim 2, wherein the constructing a global dependency graph according to the local dependency graph of each policy to be queried comprises:
identifying whether the same entity object exists in the local dependency graph of the at least one policy to be queried;
when the same entity object exists in the local dependency graph of the at least one strategy to be queried, taking the same entity object as a common node, and merging the local dependency graphs of the strategies to be queried according to the common node to obtain a global dependency graph; or alternatively
And when the same entity object does not exist in the local dependency relationship graph of the at least one strategy to be queried, merging the local dependency relationship graphs of the at least one strategy to be queried to obtain a global dependency relationship graph.
4. The artificial intelligence based data query method of claim 1, wherein said checking whether a circular dependency exists in the global dependency graph using a preset algorithm comprises:
acquiring all entity objects without dependency relationship of the global dependency relationship graph, and adding all the entity objects into a preset initial queue;
randomly selecting any entity object from the initial queue to dequeue, determining the any entity object as a target entity object, and performing dequeuing of the target entity object, wherein the performing dequeuing of the target entity object comprises:
acquiring an entity object corresponding to the next level dependency relationship of the entity object on which the target entity object depends;
judging whether the entity object corresponding to the next level dependency relationship is dequeued or not;
when the entity object corresponding to the next level dependency relationship is not dequeued, deleting the target entity object from the initial queue to obtain a first target queue, randomly selecting any entity object from the target queue for dequeuing, and determining any implementation object as a first target entity object; or when the entity object corresponding to the next level dependency relationship dequeues, adding the entity object corresponding to the next level dependency relationship into the initial queue to obtain a second target queue, randomly selecting any entity object from the second target queue to dequeue, and determining the any entity object as a second target entity object, wherein the target queue comprises a first target queue or a second target queue, and the target entity object comprises a first target entity object or a second target entity object;
repeatedly executing dequeuing of the target entity object until the target queue is empty, and recording the number of all dequeued entity objects;
if the number of all the entity objects which are dequeued is equal to the number of the entity objects in the global dependency relationship graph, determining that no cyclic dependency relationship exists in the global dependency relationship graph; or
And if the number of all the dequeued entity objects is not equal to the data of the entity objects in the global dependency relationship graph, determining that a cyclic dependency relationship exists in the global dependency relationship graph.
5. The artificial intelligence based data query method of claim 1, wherein the optimizing the global dependency graph to obtain a target dependency graph comprises:
identifying the number of each entity object in the global dependency graph that depends on other entity objects;
when the number of each entity object depending on other entity objects is multiple, determining each entity object as a target queue element, and adding the target queue element into a preset initial queue;
based on the preset initial queue, selecting the target queue element to dequeue, and executing dequeuing of the target queue element, wherein the executing of dequeuing of the target queue element comprises:
obtaining a plurality of third entity objects on which the target queue elements depend;
judging whether a fourth entity object depended by each third entity object is dequeued or not;
when the fourth entity object on which each third entity object depends is dequeued, adding the fourth entity object on which each third entity object depends into the preset initial queue; or, when the fourth entity object on which each third entity object depends is not dequeued, determining the dependency relationship between the target queue element and the fourth entity object on which each third entity object depends as a candidate optimization edge;
randomly selecting any fourth entity object from the preset initial queue for dequeuing, determining any fourth entity object as a target queue element, and repeatedly executing dequeuing of the target queue element until the preset initial queue is empty;
acquiring all candidate optimization edges, and traversing the global dependency graph based on each candidate optimization edge;
and when traversing to other execution paths of each candidate optimization edge in the global dependency relationship graph, removing each candidate optimization edge from the global dependency relationship graph to obtain a target dependency relationship graph.
6. The artificial intelligence based data query method of claim 1, wherein traversing the target dependency graph based on the at least one policy to be queried to obtain a data query result comprises:
identifying a request input in the at least one policy to be queried, wherein the request input is taken as a traversal starting point;
and traversing the target dependency relationship graph based on the traversal starting point to obtain a data query result.
7. The artificial intelligence based data query method of claim 1, wherein said converting the unstructured data into a plurality of entity objects comprises:
converting the unstructured data into a plurality of data tables meeting a third paradigm requirement;
and carrying out entity conversion on the data tables according to a preset conversion rule to obtain a plurality of entity objects.
8. An artificial intelligence based data query apparatus, the apparatus comprising:
the analysis and conversion module is used for analyzing the received data query request, acquiring at least one strategy to be queried and unstructured data which has an association relation with the at least one strategy to be queried, and converting the unstructured data into a plurality of entity objects;
the construction module is used for constructing a global dependency graph based on the dependency among the entity objects;
the checking module is used for checking whether a cyclic dependency relationship exists in the global dependency relationship diagram by adopting a preset algorithm;
the optimization module is used for optimizing the global dependency graph to obtain a target dependency graph when a cyclic dependency exists in the global dependency graph;
and the traversing module is used for traversing the target dependency relationship graph based on the at least one strategy to be queried to obtain a data query result.
9. An electronic device, characterized in that the electronic device comprises a processor and a memory, the processor being configured to implement the artificial intelligence based data query method according to any one of claims 1 to 7 when executing a computer program stored in the memory.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the artificial intelligence based data query method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210602501.1A CN114969261B (en) | 2022-05-30 | 2022-05-30 | Data query method and device based on artificial intelligence, electronic equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210602501.1A CN114969261B (en) | 2022-05-30 | 2022-05-30 | Data query method and device based on artificial intelligence, electronic equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114969261A true CN114969261A (en) | 2022-08-30 |
CN114969261B CN114969261B (en) | 2024-07-05 |
Family
ID=82958056
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210602501.1A Active CN114969261B (en) | 2022-05-30 | 2022-05-30 | Data query method and device based on artificial intelligence, electronic equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114969261B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116244365A (en) * | 2023-02-23 | 2023-06-09 | 北京火山引擎科技有限公司 | Data aggregation method and device, electronic device and storage medium |
CN118606373A (en) * | 2024-05-24 | 2024-09-06 | 湖州深蓝软件有限公司 | A method and system for intelligent query of medical information based on minors |
WO2024221908A1 (en) * | 2023-04-25 | 2024-10-31 | 蚂蚁区块链科技(上海)有限公司 | Data query method and apparatus |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112447300A (en) * | 2020-11-27 | 2021-03-05 | 平安科技(深圳)有限公司 | Medical query method and device based on graph neural network, computer equipment and storage medium |
WO2021213314A1 (en) * | 2020-04-20 | 2021-10-28 | 北京京东拓先科技有限公司 | Data processing method and device, and computer readable storage medium |
CN113837728A (en) * | 2021-09-30 | 2021-12-24 | 浙江创邻科技有限公司 | A graphical model-based equipment asset management system and method |
-
2022
- 2022-05-30 CN CN202210602501.1A patent/CN114969261B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021213314A1 (en) * | 2020-04-20 | 2021-10-28 | 北京京东拓先科技有限公司 | Data processing method and device, and computer readable storage medium |
CN112447300A (en) * | 2020-11-27 | 2021-03-05 | 平安科技(深圳)有限公司 | Medical query method and device based on graph neural network, computer equipment and storage medium |
CN113837728A (en) * | 2021-09-30 | 2021-12-24 | 浙江创邻科技有限公司 | A graphical model-based equipment asset management system and method |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116244365A (en) * | 2023-02-23 | 2023-06-09 | 北京火山引擎科技有限公司 | Data aggregation method and device, electronic device and storage medium |
CN116244365B (en) * | 2023-02-23 | 2025-03-04 | 北京火山引擎科技有限公司 | Method and device for data aggregation, electronic equipment and storage medium |
WO2024221908A1 (en) * | 2023-04-25 | 2024-10-31 | 蚂蚁区块链科技(上海)有限公司 | Data query method and apparatus |
CN118606373A (en) * | 2024-05-24 | 2024-09-06 | 湖州深蓝软件有限公司 | A method and system for intelligent query of medical information based on minors |
Also Published As
Publication number | Publication date |
---|---|
CN114969261B (en) | 2024-07-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
AU2019200046B2 (en) | Utilizing artificial intelligence to test cloud applications | |
CN108595157B (en) | Block chain data processing method, device, equipment and storage medium | |
US9772890B2 (en) | Sophisticated run-time system for graph processing | |
CN114969261A (en) | Data query method and device based on artificial intelligence, electronic equipment and medium | |
US8938421B2 (en) | Method and a system for synchronizing data | |
CN112445854B (en) | Multi-source service data real-time processing method, device, terminal and storage medium | |
CN110389748A (en) | Service data processing method and terminal equipment | |
US20160188385A1 (en) | Optimized system for analytics (graphs and sparse matrices) operations | |
US9009175B2 (en) | System and method for database migration and validation | |
CN112347122B (en) | SQL workflow processing method, device, electronic equipment and storage medium | |
CN114416849A (en) | Data processing method and device, electronic equipment and storage medium | |
CN111752945A (en) | Time sequence database data interaction method and system based on container and hierarchical model | |
CN119415481B (en) | Database-based file resource reuse library management method and device | |
CN114020446A (en) | Cross-multi-engine routing processing method, device, equipment and storage medium | |
CN118467021A (en) | Supercomputing application software identification coexistence architecture management method and system | |
CN111813517B (en) | Task queue allocation method and device, computer equipment and medium | |
CN116089473A (en) | Data query method, device, electronic equipment and storage medium | |
CN119127872B (en) | A dynamic parameter query method, system, report designer and storage medium | |
CN109992468B (en) | Process performance analysis method, device and system and computer storage medium | |
CN114333102A (en) | Parameter configuration method and configuration device of unmanned equipment | |
CN112948480A (en) | Data extraction method and device, electronic equipment and storage medium | |
CN117891866A (en) | A unified batch and stream construction system for distributed machine learning | |
CN114416695B (en) | Data splicing function migration method, device, computer equipment and storage medium | |
CN118377466A (en) | Method, device, equipment and medium for rapidly identifying components of open source component of project | |
CN117076141B (en) | High-applicability off-line data processing task issuing method and system |
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 |