CN113961584A - Method and device for analyzing field blood relationship, electronic equipment and storage medium - Google Patents

Method and device for analyzing field blood relationship, electronic equipment and storage medium Download PDF

Info

Publication number
CN113961584A
CN113961584A CN202111219787.7A CN202111219787A CN113961584A CN 113961584 A CN113961584 A CN 113961584A CN 202111219787 A CN202111219787 A CN 202111219787A CN 113961584 A CN113961584 A CN 113961584A
Authority
CN
China
Prior art keywords
data table
sql
field
syntax tree
blood
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.)
Pending
Application number
CN202111219787.7A
Other languages
Chinese (zh)
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.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank 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 Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202111219787.7A priority Critical patent/CN113961584A/en
Publication of CN113961584A publication Critical patent/CN113961584A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • G06F16/2445Data retrieval commands; View definitions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/248Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/253Grammatical analysis; Style critique
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to artificial intelligence and digital medical technology, and discloses a field blood relationship analysis method, which comprises the following steps: the method comprises the steps of obtaining a source data table and an operation set, extracting SQL (structured query language) statements of any operation in the operation set, generating a target data table according to the SQL statements and the operation corresponding to the SQL statements, constructing an abstract syntax tree based on the SQL statements, carrying out blood margin analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood margin analysis result, constructing a directed acyclic graph according to the blood margin analysis result and a preset single corresponding relation, obtaining a field to be queried, and obtaining a blood margin relation corresponding to the field to be queried based on the directed acyclic graph. In addition, the invention also relates to a block chain technology, and the SQL statement can be stored in the node of the block chain. The invention also provides a field blood margin analysis device, electronic equipment and a storage medium. The method can solve the problem of low accuracy of field blood margin analysis.

Description

Method and device for analyzing field blood relationship, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of artificial intelligence, in particular to a field blood relationship analysis method, a field blood relationship analysis device, electronic equipment and a computer-readable storage medium.
Background
With the advent of the information age, enterprises, staff, equipment and the like can continuously produce data and consume data, and the important point is that how the enterprises manage and use the massive data and how to play the value of the data is obvious. The field blood margin analysis is one of metadata applications, so that a user can see a processing path of a table field on a metadata platform, and whether the downstream field needs desensitization or not is marked through field blood margin information in a desensitization system. The method is used for expressing that data forms a logical relation in the processes of generation, fusion, circulation and extinction, and needs to be emphasized and utilized. Therefore, a field blood relationship analysis method is urgently needed.
The existing field blood margin analysis method usually depends on a pre-acquired analysis template as a reference for blood margin analysis, and the method is too dependent on the existing analysis template, is not flexible enough, and has insufficient accuracy for blood margin analysis.
Disclosure of Invention
The invention provides a field blood margin analysis method, a field blood margin analysis device, electronic equipment and a computer readable storage medium, and mainly aims to solve the problem of low accuracy of field blood margin analysis.
In order to achieve the above object, the present invention provides a field blood relationship analysis method, including:
acquiring a source data table and an operation set, and extracting an SQL statement of any operation in the operation set;
generating a target data table according to the SQL statement and the operation corresponding to the SQL statement;
constructing an abstract syntax tree based on the SQL statement;
performing blood margin analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood margin analysis result;
constructing a directed acyclic graph according to the blood margin analysis result and a preset single corresponding relation;
and acquiring a field to be queried, and acquiring a blood relationship corresponding to the field to be queried based on the directed acyclic graph.
Optionally, the generating a target data table according to the SQL statement and the job corresponding to the SQL statement includes:
extracting the job name in the job corresponding to the SQL statement, and extracting the query field in the SQL statement;
and generating the target data table by taking the operation name as a table name of an initial data table and taking the query field as a table field of the initial data table.
Optionally, the constructing an abstract syntax tree based on the SQL statement includes:
acquiring a preset keyword set, and screening out words consistent with the keywords in the keyword set from the SQL sentences to obtain standard keywords;
segmenting the SQL sentence by using the standard key words to obtain a plurality of SQL sub-sentences;
converting a plurality of the SQL sub-statements into an abstract syntax tree.
Optionally, the segmenting the SQL statement by using the standard keyword to obtain a plurality of SQL sub-statements includes:
taking the standard keyword as a segmentation node, and segmenting the SQL sentence to the left and the right based on the segmentation node to obtain a plurality of SQL sub-sentences; or
And segmenting the SQL sentence based on a preset random segmentation length to obtain a plurality of segmented sentences, and performing secondary segmentation on the plurality of segmented sentences by using the standard keywords as positioning points to obtain a plurality of SQL sub-sentences.
Optionally, the converting the plurality of SQL sub-statements into an abstract syntax tree includes:
analyzing the SQL sub-statement by using a preset lexical analyzer to obtain a plurality of word elements;
and constructing a syntax tree of the plurality of the word elements according to a preset syntax analysis method to obtain the abstract syntax tree.
Optionally, the performing a blood relationship analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood relationship analysis result includes:
traversing the abstract syntax tree, and marking the nodes in the abstract syntax tree which are consistent with the nodes of the preset fields as target nodes;
extracting a data value in the target node, and performing comparison query based on the data value and a data table in a database to obtain an operation table corresponding to the data value;
determining the type of the operation table according to the label corresponding to the operation table, determining the relationship between the operation tables of different types, and summarizing the relationship between the operation tables to obtain a blood relationship analysis result.
Optionally, the constructing a directed acyclic graph according to the blood vessel edge analysis result and a preset single corresponding relationship includes:
taking an initial data table in the blood margin analysis result as a first node, and taking a target data table in the blood margin analysis result as a second node;
constructing an initial node graph according to the relation that the first node points to the second node;
and replacing the operation data table corresponding to each node in the initial node graph with the operation corresponding to the operation set according to the single corresponding relation to obtain the directed acyclic graph.
In order to solve the above problem, the present invention also provides a field blood margin analysis device, including:
the statement extraction module is used for acquiring a source data table and an operation set and extracting the SQL statement of any operation in the operation set;
the data table generating module is used for generating a target data table according to the SQL statement and the operation corresponding to the SQL statement;
the syntax tree construction module is used for constructing an abstract syntax tree based on the SQL statement;
and the blood margin analysis module is used for carrying out blood margin analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood margin analysis result, constructing an oriented acyclic graph according to the blood margin analysis result and a preset single corresponding relation, acquiring a field to be queried, and obtaining a blood margin relation corresponding to the field to be queried based on the oriented acyclic graph.
In order to solve the above problem, the present invention also provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the field consanguinity analysis method described above.
In order to solve the above problem, the present invention further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the field blood margin analysis method.
According to the method and the device, a target data table is generated through SQL sentences and operations corresponding to the SQL sentences, and an abstract syntax tree is constructed on the basis of the SQL sentences; the abstract syntax tree can visually express the relation between fields in the statement, and the source data table and the target data table are subjected to blood margin analysis by using the abstract syntax tree to obtain a blood margin analysis result. And constructing a directed acyclic graph according to the blood relationship analysis result and a preset single corresponding relation, wherein the directed acyclic graph can be asynchronously and concurrently written into a plurality of transactions, and finally forms a topological tree structure, so that the expansibility can be greatly improved to obtain the blood relationship corresponding to the field to be queried based on the directed acyclic graph. Therefore, the field blood margin analysis method, the field blood margin analysis device, the electronic equipment and the computer readable storage medium provided by the invention can solve the problem of low accuracy of field blood margin analysis.
Drawings
Fig. 1 is a schematic flow chart illustrating a field blood relationship analysis method according to an embodiment of the present invention;
FIG. 2 is a functional block diagram of a field blood margin analysis apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device for implementing the field blood relationship analysis method according to an embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The embodiment of the application provides a field blood relationship analysis method. The execution subject of the field blood relationship analysis method includes, but is not limited to, at least one of the electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server, a terminal, and the like. In other words, the field blood margin analysis method may be performed by software or hardware installed in the terminal device or the server device, and the software may be a block chain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like. The server may be an independent server, or may be a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a Network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like.
Fig. 1 is a schematic flow chart of a field blood relationship analysis method according to an embodiment of the present invention. In this embodiment, the field blood margin analysis method includes:
s1, acquiring a source data table and a job set, and extracting the SQL statement of any job in the job set.
In the embodiment of the invention, the source data table refers to a data table of a starting source and is also a basis of a data source of a downstream table. The operation set is a set containing a plurality of SQL operations, wherein the SQL operations comprise: plan time and SQL statements.
For example, in the embodiment of the present invention, the source data table may be a CUST _ tran, where the source data table CUST _ tran includes a customer number CUST _ NO, an ATM transaction amount ATM _ am, and a POS transaction amount POS _ am. The SQL statement of any job can be select CUST _ no, atm-am, pos-am from CUST-tran or select CUST _ no, atm-am + pos-as zz _ am from TMPt-CUST.
And S2, generating a target data table according to the SQL statement and the operation corresponding to the SQL statement.
In this embodiment of the present invention, the generating a target data table according to the SQL statement and the job includes:
extracting the job name in the job corresponding to the SQL statement, and extracting the query field in the SQL statement;
and generating the target data table by taking the operation name as a table name of an initial data table and taking the query field as a table field of the initial data table.
In detail, the target table is automatically generated by the platform, when a user creates a job, the name of the job is input, the name of the table is from the name of the job, and the field of the table is from the field of a query in SQL written by the user.
And S3, constructing an abstract syntax tree based on the SQL statement.
In the embodiment of the present invention, the constructing an abstract syntax tree based on the SQL statement includes:
acquiring a preset keyword set, and screening out words consistent with the keywords in the keyword set from the SQL sentences to obtain standard keywords;
segmenting the SQL sentence by using the standard key words to obtain a plurality of SQL sub-sentences;
converting a plurality of the SQL sub-statements into an abstract syntax tree.
In detail, the keyword set includes a start keyword set and a target keyword set, wherein the start keyword set includes ' LEFT JOIN ', ' RIGHT JOIN ', ' LEFT out JOIN ', ' RIGHT out JOIN ', etc., and the target keyword set includes ' CREATE ', ' INSERT ', ' SELECT ' ″ enter ', or ' over write '.
Specifically, the segmenting the SQL statement by using the standard keyword to obtain a plurality of SQL sub-statements includes:
taking the standard keyword as a segmentation node, and segmenting the SQL sentence to the left and the right based on the segmentation node to obtain a plurality of SQL sub-sentences; or
And segmenting the SQL sentence based on a preset random segmentation length to obtain a plurality of segmented sentences, and performing secondary segmentation on the plurality of segmented sentences by using the standard keywords as positioning points to obtain a plurality of SQL sub-sentences.
For example, the SQL statement is select col _ a from a, and the standard keywords are "select" and "from", so that the standard keywords "select" and "from" are used as segmentation nodes to perform segmentation, and two SQL sub-statements including select col _ a and from a are obtained.
In detail, after the SQL statement is segmented by using the standard keyword to obtain a plurality of SQL sub-statements, the method further includes:
and labeling the plurality of SQL sub-sentences.
For example, the keyword corresponding to the SQL sub-statement select col _ a is a keyword in the target keyword set, and thus the tag corresponding to the SQL sub-statement select col _ a is a target tag.
Further, said converting a plurality of said SQL sub-statements into an abstract syntax tree comprises:
analyzing the SQL sub-statement by using a preset lexical analyzer to obtain a plurality of word elements;
and constructing a syntax tree of the plurality of the word elements according to a preset syntax analysis method to obtain the abstract syntax tree.
Wherein the preset syntax analysis method includes a top-down analysis method and a bottom-up analysis method.
In another embodiment of the present invention, an ANTLR tool may be used to construct the SQL statement, resulting in an abstract syntax tree.
The ANTLR tool is an open source parser that can automatically generate a syntax tree according to an input and visually display the syntax tree. It provides a framework for languages including Java, C + +, C #, to automatically construct recognizers, compilers, and interpreters of custom languages by syntactic descriptions.
And S4, performing blood margin analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood margin analysis result.
In this embodiment of the present invention, the performing a blood relationship analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood relationship analysis result includes:
traversing the abstract syntax tree, and marking the nodes in the abstract syntax tree which are consistent with the nodes of the preset fields as target nodes;
extracting a data value in the target node, and performing comparison query based on the data value and a data table in a database to obtain an operation table corresponding to the data value;
determining the type of the operation table according to the label corresponding to the operation table, determining the relationship between the operation tables of different types, and summarizing the relationship between the operation tables to obtain a blood relationship analysis result.
In detail, in the embodiment of the present invention, the preset field is a table, and a value corresponding to the preset field in the target node is extracted, for example: and (4) table A, wherein the corresponding value is A, and then the data table with the table name of A in the preset database is inquired to obtain the corresponding operation table.
Specifically, the type of the job table is determined according to the type to which the tag corresponding to the job table belongs, for example, if the tag type corresponding to the job table is a start data table tag, the job table is determined as a start data table; and if the label type corresponding to the data table is a target data table label, determining the operation table as a target data table, wherein the blood relationship between the initial data table and the target data table is an upstream data table with the initial data table as the target data table, and summarizing all the initial data tables and the target data table to obtain the blood relationship analysis result.
And S5, constructing a directed acyclic graph according to the blood margin analysis result and a preset single corresponding relation.
In an embodiment of the present invention, the constructing a directed acyclic graph according to the blood relationship analysis result and a preset single corresponding relationship includes:
taking an initial data table in the blood margin analysis result as a first node, and taking a target data table in the blood margin analysis result as a second node;
constructing an initial node graph according to the relation that the first node points to the second node;
and replacing the operation data table corresponding to each node in the initial node graph with the operation corresponding to the operation set according to the single corresponding relation to obtain the directed acyclic graph.
In detail, the Directed Acyclic Graph (DAG) refers to a directed graph without loops. If there is a non-directed acyclic graph, and point A can go from B to C and back to A, forming a ring. Changing the edge direction from C to A from A to C, the directed acyclic graph is changed. The number of spanning trees of the directed acyclic graph is equal to the in-degree product of nodes with non-zero in-degree. The single corresponding relation is that because the data tables and the jobs are in one-to-one correspondence, the job data table corresponding to each node in the initial node graph is replaced by the jobs corresponding to the job set according to the single corresponding relation, and the directed acyclic graph is obtained.
S6, obtaining a field to be queried, and obtaining a blood relationship corresponding to the field to be queried based on the directed acyclic graph.
In the embodiment of the invention, the directed acyclic graph is obtained by constructing the blood relationship analysis result containing the blood relationship among the fields, and the blood relationship corresponding to the field to be queried can be obtained based on the directed acyclic graph.
In detail, the field blood margin is used in a plurality of scenes, the influence range of the data after the field blood margin analysis modification operation is checked, and the desensitization system can mark the desensitization type of the downstream field through the blood margin system. The labor cost for checking the code analysis blood margin is reduced.
According to the method and the device, a target data table is generated through SQL sentences and operations corresponding to the SQL sentences, and an abstract syntax tree is constructed on the basis of the SQL sentences; the abstract syntax tree can visually express the relation between fields in the statement, and the source data table and the target data table are subjected to blood margin analysis by using the abstract syntax tree to obtain a blood margin analysis result. And constructing a directed acyclic graph according to the blood relationship analysis result and a preset single corresponding relation, wherein the directed acyclic graph can be asynchronously and concurrently written into a plurality of transactions, and finally forms a topological tree structure, so that the expansibility can be greatly improved to obtain the blood relationship corresponding to the field to be queried based on the directed acyclic graph. Therefore, the field blood margin analysis method provided by the invention can solve the problem of low accuracy of field blood margin analysis.
Fig. 2 is a functional block diagram of a field blood margin analysis apparatus according to an embodiment of the present invention.
The field blood margin analysis device 100 of the present invention may be installed in an electronic device. According to the implemented functions, the field blood margin analysis device 100 may include a sentence extraction module 101, a data table generation module 102, a syntax tree construction module 103, and a blood margin analysis module 104. The module of the present invention, which may also be referred to as a unit, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.
In the present embodiment, the functions regarding the respective modules/units are as follows:
the statement extraction module 101 is configured to obtain a source data table and an operation set, and extract an SQL statement of any operation in the operation set;
the data table generating module 102 is configured to generate a target data table according to the SQL statement and the job corresponding to the SQL statement;
the syntax tree construction module 103 is configured to construct an abstract syntax tree based on the SQL statement;
the blood relationship analysis module 104 is configured to perform blood relationship analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood relationship analysis result, construct an directed acyclic graph according to the blood relationship analysis result and a preset single corresponding relationship, obtain a field to be queried, and obtain a blood relationship corresponding to the field to be queried based on the directed acyclic graph.
In detail, the specific implementation of each module of the field blood margin analysis device 100 is as follows:
the method comprises the steps of firstly, obtaining a source data table and an operation set, and extracting SQL sentences of any operation in the operation set.
In the embodiment of the invention, the source data table refers to a data table of a starting source and is also a basis of a data source of a downstream table. The operation set is a set containing a plurality of SQL operations, wherein the SQL operations comprise: plan time and SQL statements.
For example, in the embodiment of the present invention, the source data table may be a CUST _ tran, where the source data table CUST _ tran includes a customer number CUST _ NO, an ATM transaction amount ATM _ am, and a POS transaction amount POS _ am. The SQL statement of any job can be select CUST _ no, atm-am, pos-am from CUST-tran or select CUST _ no, atm-am + pos-as zz _ am from TMPt-CUST.
And step two, generating a target data table according to the SQL statement and the operation corresponding to the SQL statement.
In this embodiment of the present invention, the generating a target data table according to the SQL statement and the job includes:
extracting the job name in the job corresponding to the SQL statement, and extracting the query field in the SQL statement;
and generating the target data table by taking the operation name as a table name of an initial data table and taking the query field as a table field of the initial data table.
In detail, the target table is automatically generated by the platform, when a user creates a job, the name of the job is input, the name of the table is from the name of the job, and the field of the table is from the field of a query in SQL written by the user.
And thirdly, constructing an abstract syntax tree based on the SQL statement.
In the embodiment of the present invention, the constructing an abstract syntax tree based on the SQL statement includes:
acquiring a preset keyword set, and screening out words consistent with the keywords in the keyword set from the SQL sentences to obtain standard keywords;
segmenting the SQL sentence by using the standard key words to obtain a plurality of SQL sub-sentences;
converting a plurality of the SQL sub-statements into an abstract syntax tree.
In detail, the keyword set includes a start keyword set and a target keyword set, wherein the start keyword set includes ' LEFT JOIN ', ' RIGHT JOIN ', ' LEFT out JOIN ', ' RIGHT out JOIN ', etc., and the target keyword set includes ' CREATE ', ' INSERT ', ' SELECT ' ″ enter ', or ' over write '.
Specifically, the segmenting the SQL statement by using the standard keyword to obtain a plurality of SQL sub-statements includes:
taking the standard keyword as a segmentation node, and segmenting the SQL sentence to the left and the right based on the segmentation node to obtain a plurality of SQL sub-sentences; or
And segmenting the SQL sentence based on a preset random segmentation length to obtain a plurality of segmented sentences, and performing secondary segmentation on the plurality of segmented sentences by using the standard keywords as positioning points to obtain a plurality of SQL sub-sentences.
For example, the SQL statement is select col _ a from a, and the standard keywords are "select" and "from", so that the standard keywords "select" and "from" are used as segmentation nodes to perform segmentation, and two SQL sub-statements including select col _ a and from a are obtained.
In detail, after the SQL statement is segmented by using the standard keyword to obtain a plurality of SQL sub-statements, the method further includes:
and labeling the plurality of SQL sub-sentences.
For example, the keyword corresponding to the SQL sub-statement select col _ a is a keyword in the target keyword set, and thus the tag corresponding to the SQL sub-statement select col _ a is a target tag.
Further, said converting a plurality of said SQL sub-statements into an abstract syntax tree comprises:
analyzing the SQL sub-statement by using a preset lexical analyzer to obtain a plurality of word elements;
and constructing a syntax tree of the plurality of the word elements according to a preset syntax analysis method to obtain the abstract syntax tree.
Wherein the preset syntax analysis method includes a top-down analysis method and a bottom-up analysis method.
In another embodiment of the present invention, an ANTLR tool may be used to construct the SQL statement, resulting in an abstract syntax tree.
The ANTLR tool is an open source parser that can automatically generate a syntax tree according to an input and visually display the syntax tree. It provides a framework for languages including Java, C + +, C #, to automatically construct recognizers, compilers, and interpreters of custom languages by syntactic descriptions.
And fourthly, performing blood margin analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood margin analysis result.
In this embodiment of the present invention, the performing a blood relationship analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood relationship analysis result includes:
traversing the abstract syntax tree, and marking the nodes in the abstract syntax tree which are consistent with the nodes of the preset fields as target nodes;
extracting a data value in the target node, and performing comparison query based on the data value and a data table in a database to obtain an operation table corresponding to the data value;
determining the type of the operation table according to the label corresponding to the operation table, determining the relationship between the operation tables of different types, and summarizing the relationship between the operation tables to obtain a blood relationship analysis result.
In detail, in the embodiment of the present invention, the preset field is a table, and a value corresponding to the preset field in the target node is extracted, for example: and (4) table A, wherein the corresponding value is A, and then the data table with the table name of A in the preset database is inquired to obtain the corresponding operation table.
Specifically, the type of the job table is determined according to the type to which the tag corresponding to the job table belongs, for example, if the tag type corresponding to the job table is a start data table tag, the job table is determined as a start data table; and if the label type corresponding to the data table is a target data table label, determining the operation table as a target data table, wherein the blood relationship between the initial data table and the target data table is an upstream data table with the initial data table as the target data table, and summarizing all the initial data tables and the target data table to obtain the blood relationship analysis result.
And fifthly, constructing a directed acyclic graph according to the blood margin analysis result and a preset single corresponding relation.
In an embodiment of the present invention, the constructing a directed acyclic graph according to the blood relationship analysis result and a preset single corresponding relationship includes:
taking an initial data table in the blood margin analysis result as a first node, and taking a target data table in the blood margin analysis result as a second node;
constructing an initial node graph according to the relation that the first node points to the second node;
and replacing the operation data table corresponding to each node in the initial node graph with the operation corresponding to the operation set according to the single corresponding relation to obtain the directed acyclic graph.
In detail, the Directed Acyclic Graph (DAG) refers to a directed graph without loops. If there is a non-directed acyclic graph, and point A can go from B to C and back to A, forming a ring. Changing the edge direction from C to A from A to C, the directed acyclic graph is changed. The number of spanning trees of the directed acyclic graph is equal to the in-degree product of nodes with non-zero in-degree. The single corresponding relation is that because the data tables and the jobs are in one-to-one correspondence, the job data table corresponding to each node in the initial node graph is replaced by the jobs corresponding to the job set according to the single corresponding relation, and the directed acyclic graph is obtained.
And step six, acquiring a field to be queried, and obtaining a blood relationship corresponding to the field to be queried based on the directed acyclic graph.
In the embodiment of the invention, the directed acyclic graph is obtained by constructing the blood relationship analysis result containing the blood relationship among the fields, and the blood relationship corresponding to the field to be queried can be obtained based on the directed acyclic graph.
In detail, the field blood margin is used in a plurality of scenes, the influence range of the data after the field blood margin analysis modification operation is checked, and the desensitization system can mark the desensitization type of the downstream field through the blood margin system. The labor cost for checking the code analysis blood margin is reduced.
According to the method and the device, a target data table is generated through SQL sentences and operations corresponding to the SQL sentences, and an abstract syntax tree is constructed on the basis of the SQL sentences; the abstract syntax tree can visually express the relation between fields in the statement, and the source data table and the target data table are subjected to blood margin analysis by using the abstract syntax tree to obtain a blood margin analysis result. And constructing a directed acyclic graph according to the blood relationship analysis result and a preset single corresponding relation, wherein the directed acyclic graph can be asynchronously and concurrently written into a plurality of transactions, and finally forms a topological tree structure, so that the expansibility can be greatly improved to obtain the blood relationship corresponding to the field to be queried based on the directed acyclic graph. Therefore, the field blood margin analysis device provided by the invention can solve the problem of low accuracy of field blood margin analysis.
Fig. 3 is a schematic structural diagram of an electronic device for implementing a field blood relationship analysis method according to an embodiment of the present invention.
The electronic device 1 may comprise a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may further comprise a computer program, such as a field blood margin analysis program, stored in the memory 11 and executable on the processor 10.
In some embodiments, the processor 10 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 function or different functions, and includes one or more Central Processing Units (CPUs), a microprocessor, a digital Processing chip, a graphics processor, a combination of various control chips, and the like. The processor 10 is a Control Unit (Control Unit) of the electronic device, connects various components of the electronic device by using various interfaces and lines, and executes various functions and processes data of the electronic device by running or executing programs or modules (e.g., executing a field blood-related analysis program, etc.) stored in the memory 11 and calling data stored in the memory 11.
The memory 11 includes at least one type of readable storage medium including flash memory, removable hard disks, multimedia cards, card-type memory (e.g., SD or DX memory, etc.), magnetic memory, magnetic disks, optical disks, etc. The memory 11 may in some embodiments be an internal storage unit of the electronic device, for example a removable hard disk of the electronic device. The memory 11 may also be an external storage device of the electronic device in other embodiments, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device. Further, the memory 11 may also include both an internal storage unit and an external storage device of the electronic device. The memory 11 may be used not only to store application software installed in the electronic device and various types of data, such as codes of a field blood relationship analysis program, etc., but also to temporarily store data that has been output or is to be output.
The communication bus 12 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is arranged to enable connection communication between the memory 11 and at least one processor 10 or the like.
The communication interface 13 is used for communication between the electronic device and other devices, and includes a network interface and a user interface. Optionally, the network interface may include a wired interface and/or a wireless interface (e.g., WI-FI interface, bluetooth interface, etc.), which are typically used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a Display (Display), an input unit such as a Keyboard (Keyboard), and optionally a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, or the like. The display, which may also be referred to as a display screen or display unit, is suitable, among other things, for displaying information processed in the electronic device and for displaying a visualized user interface.
Fig. 3 shows only an electronic device with components, and it will be understood by those skilled in the art that the structure shown in fig. 3 does not constitute a limitation of the electronic device 1, and may comprise fewer or more components than those shown, or some components may be combined, or a different arrangement of components.
For example, although not shown, the electronic device may further include a power supply (such as a battery) for supplying power to each component, and preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that functions of charge management, discharge management, power consumption management and the like are realized 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 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 field blood relationship analysis program stored in the memory 11 of the electronic device 1 is a combination of instructions, which when executed in the processor 10, can implement:
acquiring a source data table and an operation set, and extracting an SQL statement of any operation in the operation set;
generating a target data table according to the SQL statement and the operation corresponding to the SQL statement;
constructing an abstract syntax tree based on the SQL statement;
performing blood margin analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood margin analysis result;
constructing a directed acyclic graph according to the blood margin analysis result and a preset single corresponding relation;
and acquiring a field to be queried, and acquiring a blood relationship corresponding to the field to be queried based on the directed acyclic graph.
Specifically, the specific implementation method of the instruction by the processor 10 may refer to the description of the relevant steps in the embodiment corresponding to the drawings, which is not described herein again.
Further, the integrated modules/units of the electronic device 1, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. The computer readable storage medium may be volatile or non-volatile. For example, the computer-readable medium may include: any entity or device capable of carrying said computer program code, recording medium, U-disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM).
The present invention also provides a computer-readable storage medium, storing a computer program which, when executed by a processor of an electronic device, may implement:
acquiring a source data table and an operation set, and extracting an SQL statement of any operation in the operation set;
generating a target data table according to the SQL statement and the operation corresponding to the SQL statement;
constructing an abstract syntax tree based on the SQL statement;
performing blood margin analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood margin analysis result;
constructing a directed acyclic graph according to the blood margin analysis result and a preset single corresponding relation;
and acquiring a field to be queried, and acquiring a blood relationship corresponding to the field to be queried based on the directed acyclic graph.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus, device and method can 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 signs in the claims shall not be construed as limiting the claim concerned.
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
The embodiment of the application 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.
Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in 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 method of field consanguinity analysis, the method comprising:
acquiring a source data table and an operation set, and extracting an SQL statement of any operation in the operation set;
generating a target data table according to the SQL statement and the operation corresponding to the SQL statement;
constructing an abstract syntax tree based on the SQL statement;
performing blood margin analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood margin analysis result;
constructing a directed acyclic graph according to the blood margin analysis result and a preset single corresponding relation;
and acquiring a field to be queried, and acquiring a blood relationship corresponding to the field to be queried based on the directed acyclic graph.
2. The field consanguinity analysis method of claim 1, wherein said generating a target data table from said SQL statements and jobs corresponding to said SQL statements comprises:
extracting the job name in the job corresponding to the SQL statement, and extracting the query field in the SQL statement;
and generating the target data table by taking the operation name as a table name of an initial data table and taking the query field as a table field of the initial data table.
3. The field consanguinity analysis method of claim 1, wherein said building an abstract syntax tree based on said SQL statements comprises:
acquiring a preset keyword set, and screening out words consistent with the keywords in the keyword set from the SQL sentences to obtain standard keywords;
segmenting the SQL sentence by using the standard key words to obtain a plurality of SQL sub-sentences;
converting a plurality of the SQL sub-statements into an abstract syntax tree.
4. The field blood relationship analysis method of claim 3, wherein the segmenting the SQL statement by using the standard keyword to obtain a plurality of SQL sub-statements comprises:
taking the standard keyword as a segmentation node, and segmenting the SQL sentence to the left and the right based on the segmentation node to obtain a plurality of SQL sub-sentences; or
And segmenting the SQL sentence based on a preset random segmentation length to obtain a plurality of segmented sentences, and performing secondary segmentation on the plurality of segmented sentences by using the standard keywords as positioning points to obtain a plurality of SQL sub-sentences.
5. The field consanguinity analysis method of claim 3, wherein said converting a plurality of said SQL sub-statements into an abstract syntax tree comprises:
analyzing the SQL sub-statement by using a preset lexical analyzer to obtain a plurality of word elements;
and constructing a syntax tree of the plurality of the word elements according to a preset syntax analysis method to obtain the abstract syntax tree.
6. The method for analyzing the vessel blood margin of claim 1, wherein the analyzing the source data table and the target data table for blood margin using the abstract syntax tree to obtain the blood margin analysis result comprises:
traversing the abstract syntax tree, and marking the nodes in the abstract syntax tree which are consistent with the nodes of the preset fields as target nodes;
extracting a data value in the target node, and performing comparison query based on the data value and a data table in a database to obtain an operation table corresponding to the data value;
determining the type of the operation table according to the label corresponding to the operation table, determining the relationship between the operation tables of different types, and summarizing the relationship between the operation tables to obtain a blood relationship analysis result.
7. The field consanguinity analysis method according to claim 1, wherein said constructing a directed acyclic graph according to the consanguinity analysis result and a preset single correspondence comprises:
taking an initial data table in the blood margin analysis result as a first node, and taking a target data table in the blood margin analysis result as a second node;
constructing an initial node graph according to the relation that the first node points to the second node;
and replacing the operation data table corresponding to each node in the initial node graph with the operation corresponding to the operation set according to the single corresponding relation to obtain the directed acyclic graph.
8. A field blood margin analysis device, the device comprising:
the statement extraction module is used for acquiring a source data table and an operation set and extracting the SQL statement of any operation in the operation set;
the data table generating module is used for generating a target data table according to the SQL statement and the operation corresponding to the SQL statement;
the syntax tree construction module is used for constructing an abstract syntax tree based on the SQL statement;
and the blood margin analysis module is used for carrying out blood margin analysis on the source data table and the target data table by using the abstract syntax tree to obtain a blood margin analysis result, constructing an oriented acyclic graph according to the blood margin analysis result and a preset single corresponding relation, acquiring a field to be queried, and obtaining a blood margin relation corresponding to the field to be queried based on the oriented acyclic graph.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the field consanguinity analysis method of any one of claims 1 to 7.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out a field consanguinity analysis method according to any one of claims 1 to 7.
CN202111219787.7A 2021-10-20 2021-10-20 Method and device for analyzing field blood relationship, electronic equipment and storage medium Pending CN113961584A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111219787.7A CN113961584A (en) 2021-10-20 2021-10-20 Method and device for analyzing field blood relationship, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111219787.7A CN113961584A (en) 2021-10-20 2021-10-20 Method and device for analyzing field blood relationship, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113961584A true CN113961584A (en) 2022-01-21

Family

ID=79465512

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111219787.7A Pending CN113961584A (en) 2021-10-20 2021-10-20 Method and device for analyzing field blood relationship, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113961584A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114253995A (en) * 2022-03-01 2022-03-29 深圳市明源云科技有限公司 Data tracing method, device, equipment and computer readable storage medium
CN114676678A (en) * 2022-04-08 2022-06-28 北京百度网讯科技有限公司 Structured query language data parsing method and device and electronic equipment
CN114817298A (en) * 2022-05-12 2022-07-29 平安科技(深圳)有限公司 Method, device and equipment for extracting field-level data blood margin and storage medium
CN114896265A (en) * 2022-04-26 2022-08-12 北京科杰科技有限公司 Method, device and equipment for constructing full link and computer readable storage medium
CN115757655A (en) * 2022-11-14 2023-03-07 中国兵器工业计算机应用技术研究所 Data blood relationship analysis system and method based on metadata management
CN117891979A (en) * 2024-03-15 2024-04-16 中信证券股份有限公司 Method and device for constructing blood margin map, electronic equipment and readable medium
WO2024109376A1 (en) * 2022-11-22 2024-05-30 中兴通讯股份有限公司 Data processing method, and electronic device and storage medium
CN118364891A (en) * 2024-06-19 2024-07-19 上海燧原科技股份有限公司 Reversible structure identification method, device, equipment and medium in deep learning model

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114253995A (en) * 2022-03-01 2022-03-29 深圳市明源云科技有限公司 Data tracing method, device, equipment and computer readable storage medium
CN114253995B (en) * 2022-03-01 2022-05-27 深圳市明源云科技有限公司 Data tracing method, device, equipment and computer readable storage medium
CN114676678A (en) * 2022-04-08 2022-06-28 北京百度网讯科技有限公司 Structured query language data parsing method and device and electronic equipment
CN114676678B (en) * 2022-04-08 2023-10-27 北京百度网讯科技有限公司 Method and device for analyzing structured query language data and electronic equipment
CN114896265A (en) * 2022-04-26 2022-08-12 北京科杰科技有限公司 Method, device and equipment for constructing full link and computer readable storage medium
CN114817298A (en) * 2022-05-12 2022-07-29 平安科技(深圳)有限公司 Method, device and equipment for extracting field-level data blood margin and storage medium
CN115757655A (en) * 2022-11-14 2023-03-07 中国兵器工业计算机应用技术研究所 Data blood relationship analysis system and method based on metadata management
WO2024109376A1 (en) * 2022-11-22 2024-05-30 中兴通讯股份有限公司 Data processing method, and electronic device and storage medium
CN117891979A (en) * 2024-03-15 2024-04-16 中信证券股份有限公司 Method and device for constructing blood margin map, electronic equipment and readable medium
CN117891979B (en) * 2024-03-15 2024-05-17 中信证券股份有限公司 Method and device for constructing blood margin map, electronic equipment and readable medium
CN118364891A (en) * 2024-06-19 2024-07-19 上海燧原科技股份有限公司 Reversible structure identification method, device, equipment and medium in deep learning model

Similar Documents

Publication Publication Date Title
CN113961584A (en) Method and device for analyzing field blood relationship, electronic equipment and storage medium
CN111813963B (en) Knowledge graph construction method and device, electronic equipment and storage medium
CN115408399A (en) Blood relationship analysis method, device, equipment and storage medium based on SQL script
CN115048111B (en) Code generation method, device, equipment and medium based on metadata
CN113806434A (en) Big data processing method, device, equipment and medium
CN113687827B (en) Data list generation method, device and equipment based on widget and storage medium
CN113434542B (en) Data relationship identification method and device, electronic equipment and storage medium
CN114398282A (en) Test script generation method, device, equipment and storage medium
CN114138243A (en) Function calling method, device, equipment and storage medium based on development platform
CN114385497A (en) Test environment generation method and device, electronic equipment and storage medium
CN114816371B (en) Message processing method, device, equipment and medium
CN115146064A (en) Intention recognition model optimization method, device, equipment and storage medium
CN114896164A (en) Interface optimization method and device, electronic equipment and storage medium
CN114510400A (en) Task execution method and device, electronic equipment and storage medium
CN114398433A (en) Chart information report generation method and device, electronic equipment and storage medium
CN114356379A (en) Backup-based service upgrading method, device, equipment and storage medium
CN114490666A (en) Chart generation method, device and equipment based on data requirements and storage medium
CN111625538B (en) Data processing method and device based on virtual data table technology and electronic equipment
CN114840720A (en) Data model generation method and device, electronic equipment and readable storage medium
CN114911464A (en) Code generation method, device and equipment based on domain drive and storage medium
CN113886446A (en) Job automatic scheduling method and device, electronic equipment and readable storage medium
CN114741399A (en) Service table data updating method, device, equipment and storage medium
CN114840439A (en) Front-end code visualization method, device, equipment and storage medium
CN114610340A (en) Project deployment method, device, equipment and storage medium
CN114581044A (en) Scheme configuration method and device, electronic equipment and readable storage medium

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