WO2021000671A1 - Database query method and apparatus, server and medium - Google Patents

Database query method and apparatus, server and medium Download PDF

Info

Publication number
WO2021000671A1
WO2021000671A1 PCT/CN2020/092811 CN2020092811W WO2021000671A1 WO 2021000671 A1 WO2021000671 A1 WO 2021000671A1 CN 2020092811 W CN2020092811 W CN 2020092811W WO 2021000671 A1 WO2021000671 A1 WO 2021000671A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
tree model
classification tree
nodes
update request
Prior art date
Application number
PCT/CN2020/092811
Other languages
French (fr)
Chinese (zh)
Inventor
郑毅
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021000671A1 publication Critical patent/WO2021000671A1/en

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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • 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/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • G06F16/285Clustering or classification
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • This application belongs to the field of data processing technology, and in particular relates to a database query method, device, server and medium.
  • the server needs to query the related node (related node) of a target node in the related tree structure in the database according to the user's instruction. It can be: a parent node, a child node, or all subordinate nodes with the target node as the root node, etc.), and the prior art is implemented through a recursive database query.
  • the modification flexibility and intelligence are also poor.
  • the database recursive query may be disturbed, the difficulty further increases, and the query efficiency may further slow down.
  • the embodiments of the present application provide a database query method, device, server, and medium to solve the problems of poor flexibility and low query efficiency in database update in the prior art.
  • the first aspect of the embodiments of the present application provides a database query method, including: obtaining a classification tree model currently used to characterize the relationship between each data set in the database, and according to the parent node of each node in the current classification tree model , Generate the index of each current node; if a node update request for adding a node is received, keywords are extracted from the node update request according to the node update request, and the current classification tree model is retrieved Node’s description information, and based on the keywords and the description information, determine whether to update the current classification tree model; if it is determined to update the current classification tree model, then from the classification tree model Select a node as the selected node in the selected node, add child nodes to the selected node, and generate the index of the child node to update the classification tree model; after receiving the query instruction input by the user, if it is determined to execute all The query instruction extracts a target node from the query instruction, and queries and outputs a local classification tree model with the target node as
  • a second aspect of the embodiments of the present application provides a database query device, including:
  • the obtaining module is used to obtain the classification tree model currently used to characterize the relationship between the data sets in the database, and to generate the index of each node according to the parent node of each node in the current classification tree model;
  • the judgment module is used for After receiving a node update request for adding a node, multiple keywords are extracted from the node update request according to the node update request, and the description information of each node in the current classification tree model is retrieved, and based on The keyword and the description information determine whether to update the current classification tree model; an update module is used to select from the classification tree model if it is determined to update the current classification tree model A node is used as the selected node, and a child node is added to the selected node, and the index of the child node is generated to update the classification tree model; the query module is used to, after receiving the query instruction input by the user, If it is determined to execute the query instruction, extract the target node from the query instruction, and query and output the local classification tree with the target node as the root node through
  • the third aspect of the embodiments of the present application provides a server including: a memory, a processor, and a computer program stored in the memory and capable of running on the processor.
  • the processor executes the computer program
  • the following steps may be implemented: obtain the classification tree model currently used to characterize the relationship between the data sets in the database, and The parent node of each node in the current classification tree model generates the index of each current node; if a node update request for adding a node is received, the key is extracted from the node update request according to the node update request Words, retrieve the description information of each node in the current classification tree model, and based on the keywords and the description information, determine whether to update the current classification tree model; The classification tree model is updated, a node is selected from the classification tree model as the selected node, and child nodes are added to the selected node, and the index of the child node is generated
  • the fourth aspect of the embodiments of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the The steps of the method, for example, when the computer program is executed by the processor, the following steps can be achieved: obtaining the classification tree model currently used to characterize the relationship between the data sets in the database, and according to the parent of each node in the current classification tree model Node, generate the index of each current node; if a node update request for adding a node is received, keywords are extracted from the node update request according to the node update request, and the current classification tree model is called The description information of each node, and based on the keywords and the description information, determine whether to update the current classification tree model; if it is determined to update the current classification tree model, then from the classification tree Select a node in the model as the selected node, add child nodes to the selected node, generate the index of the child node to update the classification tree model; after receiving the query instruction input by
  • FIG. 1 is an implementation flowchart of a database query method provided by an embodiment of the present application
  • Figure 2 is a schematic diagram of a classification tree model provided by an embodiment of the present application.
  • FIG. 4 is a specific implementation flowchart of the database query method S104 provided by the embodiment of the present application.
  • Figure 5 is a structural block diagram of a database query device provided by an embodiment of the present application.
  • Fig. 6 is a schematic diagram of a server provided by an embodiment of the present application.
  • the technical solution of the present application can be applied to the field of artificial intelligence or big data technology, and solves the problems of poor flexibility and low query efficiency in database updates in the prior art.
  • Fig. 1 shows an implementation process of a database query method provided by an embodiment of the present application, and the method process includes steps S101 to S106.
  • the specific implementation principle of each step is as follows.
  • the current classification tree model used to characterize the relationship between the data sets in the database is obtained, and the current index of each node is generated according to the parent node of each node in the current classification tree model.
  • the data set may be related data of an organization in a company structure.
  • each data set may be data of different departments, branches, and subsidiaries in the company structure.
  • the corporate structure of a company can form a classification tree, and each organization A data set formed by related data of is a node in the classification tree. Therefore, in summary, the classification tree model in the embodiment of the present application can be used to characterize the relationship between each data set in the database, where the root node of the classification tree model represents the data set corresponding to the head office.
  • each node of the classification tree model has a corresponding node ID, and the node ID is used to uniquely determine a node.
  • the node ID of each node can be represented by letters.
  • the node ID of the root node is A
  • the node IDs of the second-level nodes are B and C respectively.
  • FIG. 2 is only a very simple classification tree model.
  • the number of nodes of the classification tree model processed in the real project in the embodiment of this application is much more than that of the classification tree in FIG. 2
  • the number of nodes in the model is much more than that of the classification tree in FIG. 2
  • multiple digits can be selected as the node IDs of different nodes.
  • the first step of the embodiment of the present application requires generating each node in the classification tree model.
  • the index of each node will be quickly searched below based on the index of each node.
  • generating the index of each node in the classification tree model includes: selecting nodes other than the root node from the current classification tree model, and a path from the parent node of the node being selected to the root node
  • the IDs of all the nodes on the above are combined in the order from the root node to the lower nodes, as the index of the node being selected, so as to traverse all nodes except the root node in the current classification tree model , To generate the index of each current node.
  • the embodiment of the present application will traverse every node in the classification tree model except for the root node A. Obviously, each node will be selected during the traversal process. Assuming that node D is currently selected, the IDs of all nodes on the path from node D to root node A are combined in the order from the root node to the lower nodes to generate the index of node D being selected. In Figure 2, the index of node D is A! B! D. By analogy, the index of other non-root nodes can be determined.
  • a classification tree model is not constant after it is generated, and operations such as addition, deletion, and modification may occur to change the connection relationship of the nodes in the classification tree model or add or delete nodes.
  • the user can pass the request of adding, deleting and modifying the node in the classification tree model to the server through the node update request. After the server parses the node update request, it completes the addition, deletion, and modification operations according to the user's relevant permissions.
  • deleting and modifying nodes must ensure the accuracy of server analysis, otherwise the data security and integrity of the classification tree model will be affected. Therefore, for requests to delete and modify nodes, users must The ID of the target node and the specific steps of the requested operation are written in the update request.
  • the server can accurately complete the operation of deleting and modifying the node according to the specific content contained in the node update request.
  • the application embodiment provides a set of smarter methods for node update requests for adding nodes, which are detailed as follows:
  • the embodiment of the present application provides an automatic judgment update method that is different from the prior art.
  • a user wants to add a node when a user wants to add a node, he needs to input the description information of the node he wants to add into the terminal device in the form of keywords.
  • the terminal device will generate a node update request based on these keywords and send it to the server .
  • the keywords may include: the level of the node to be generated, the characteristics of the node to be generated, and so on.
  • the server can parse out the keywords contained in it to determine what kind of node the user wants to add to the classification tree model, and further determine whether to agree to add the node to the classification tree model .
  • the foregoing S102 includes:
  • S1021 Count the number of occurrences of the keyword in the description information of each node to the total number of words in each description information.
  • each node has its corresponding description information, and the description information is used to describe various characteristics of the node.
  • the description information of each node is composed of multiple words, and the word set of the description information of each node can be obtained through word segmentation (the same words may exist in the word set, and they are not used in this embodiment of the application). Merge) to count the number of occurrences of the keywords in the update request in each description information. For example, suppose that in a piece of description information, the word "risk control" appears 5 times in total, then if the keyword is also "risk control", the number of occurrences of the keyword in the description information is 5. Similarly, in the embodiment of the present application, the total number of words in the description information is the total number of words in the word set of the description information without the same word combination.
  • S1022 Calculate the total number of nodes included in the current classification tree model as the first node number, and count the number of nodes containing the keyword in the corresponding description information as the second node number.
  • S1023 Calculate the degree of association between the node update request and each node by using an association degree calculation formula.
  • the formula for calculating the degree of association is: Wherein, the Y i is the degree of association between the node update request and the node i in the classification tree model, the n i is the number of occurrences of the keyword in the description information of the node i, and the k i Is the total number of words in the description information of the node i, the h is the number of the first node, and the b is the number of the second node.
  • the degree of association is not simply the probability of a keyword in each description information, but a combination of the number of occurrences of the keyword in the description information of each node, and each
  • the four important parameters of the total number of words in the description information of the node, the total number of nodes contained in the current classification tree model, and the number of nodes containing the keywords in the corresponding description information, are more accurate and objective to calculate the response
  • the parameter of the degree of relevance between the keyword and each node that is, the degree of relevance between the node update request and each node.
  • the node update request can be intelligently analyzed and judged to quickly determine whether the current classification tree model needs to be updated.
  • a node is selected from the classification tree model as the selected node, and child nodes are added to the selected node to generate the Index to update the classification tree model.
  • the embodiment of the present application determines the attribution coefficient of the node update request attributable to each node by comparing the degree of association between the node update request and the associated nodes (parent node, sibling node), so as to select the child nodes that need to be added. The selected node. Obviously, after adding sub-nodes under the selected node in the embodiment of this application, the current classification tree model is updated. In order to facilitate subsequent queries, the index of the newly added child node will also be generated based on S101.
  • the query instruction can be: find all child nodes of the target node. Obviously, by querying all child nodes of the target node, a part of the classification tree model with the target node as the root node can be found.
  • the root node has the highest level
  • the leaf node has the lowest level
  • the nodes of each level in the middle descend from the root node to the leaf node, so the nodes of different levels correspond to
  • the data security requirements are different, so the requirements for user permissions are also different.
  • users with lower user rights are not allowed to search for a local classification tree model with a higher-level target node as the root node, and are not allowed to retrieve data corresponding to a higher target node.
  • determining whether to execute the query instruction is essentially achieved by comparing the user authority of the user issuing the query instruction with the authority threshold of the target node that the query instruction wishes to query.
  • the foregoing S104 includes:
  • the query instruction includes at least two parameters, one parameter is the target node, and the other parameter is user information.
  • S1042 Identify the authority threshold of the target node according to the description information of the target node, and extract a user authority level from the user information.
  • method one assign a permission threshold to each level of node in advance.
  • the target node is parsed from the query instruction, it can be determined according to the level of the target node in the classification tree model Permission threshold.
  • method two extract the description information corresponding to the target node as target data, convert the target data into a target matrix according to a preset conversion rule, and determine the authority threshold corresponding to the target matrix through a support vector machine algorithm,
  • the target node is parsed from the query instruction, and if the authority threshold of the target node is higher than the user authority, it is determined not to execute the query instruction. If the authority threshold of the target node is not higher than the user authority, it is determined to execute the query instruction.
  • the specific method for determining the authority threshold corresponding to the target matrix through the support vector machine algorithm includes: obtaining the principal component matrix corresponding to each authority threshold, calculating the average value of the principal component matrix corresponding to all authority thresholds, generating the average principal component matrix, and passing formula: Calculate training parameters each permission threshold value, wherein, P i represents the permission threshold training parameter i, X i represents the main ingredient matrix permission threshold value of i, X 'represents an average primary ingredient matrix, [delta] represents X i and X' is a covariance matrix .
  • the classification hyperplane of the selected threshold is calculated through the existing SVM algorithm. Until the classification hyperplane of all permission thresholds is calculated. Calculate the Euclidean distance between the target matrix and the classification hyperplane of each authority threshold as the Euclidean distance corresponding to each authority threshold, and use the authority threshold with the smallest Euclidean distance as the authority threshold corresponding to the target node.
  • the recognition of the permission threshold through the support vector machine is equivalent to a set of pre-setting standards for the permission threshold. (That is, preset multiple principal component matrices corresponding to each authority threshold), instead of directly determining the authority threshold of a level node.
  • the authority threshold can be objectively determined according to the attribute value of each attribute in the target data, highlighting some subtle differences in the target data, affecting the final authority threshold, and improving the accuracy of the authority threshold.
  • a classification tree model may have a large number of nodes, which can reach thousands, so it is difficult to directly set a reasonable permission threshold for each node. Therefore, through method 2, when we set a set of standards , Since each node must have a description information, we can automatically set the accurate permission threshold for each node more conveniently.
  • the query instruction is intercepted by the struct2 interceptor, and the corresponding relationship between the user information and the query instruction is stored in the historical interception record.
  • the classification tree model by obtaining the classification tree model and generating the index of each current node according to the parent node of each current node, if a node update request is received, keywords are extracted from the node update request , And based on the keywords and description information of each node, determine whether to update the classification tree model; if it is determined to update the classification tree model, select a node from the classification tree model as the selected node and add children to the selected node Node, generating the index of the child node; after receiving the query instruction input by the user, if it is determined to execute the query instruction, extract the target node from the query instruction, and pass each node in the updated classification tree model , Query and output the local classification tree model with the target node as the root node, thereby improving the efficiency of querying or updating the classification tree model.
  • FIG. 5 shows a structural block diagram of a database query device provided in an embodiment of the present application. For ease of description, only parts related to the embodiment of the present application are shown.
  • the device includes:
  • the obtaining module 501 is configured to obtain a classification tree model currently used to characterize the relationship between each data set in the database, and generate an index of each node in the classification tree model;
  • the judgment module 502 is configured to, if a node update request for adding a node is received, extract multiple keywords from the node update request, retrieve the description information of each node in the current classification tree model, and Determine whether to update the current classification tree model based on the keywords and the description information;
  • the update module 503 is configured to, if it is determined to update the current classification tree model, select a node from the classification tree model as the selected node according to the node update request, and add a node to the selected node Child node, generating an index of the child node to update the classification tree model;
  • the query module 504 is configured to, after receiving the query instruction input by the user, if it is determined to execute the query instruction, extract the target node from the query instruction and pass the index of each node in the updated classification tree model , Query and output the local classification tree model with the target node as the root node.
  • the generating the index of each node in the classification tree model includes: selecting nodes other than the root node from the current classification tree model one by one, and transferring the selected node to the root node on the path
  • the IDs of all nodes are combined in the order from the root node to the lower nodes, as the index of the selected node, to generate the current classification tree model after traversing all nodes except the root node The index of each node.
  • the determining whether to update the current classification tree model based on the keywords and the description information includes:
  • the selecting a node from the classification tree model as the selected node includes: using a formula: Calculate the attribution coefficient of the node update request to each node, where W i represents the attribution coefficient of the node update request to node i, and the Y i is the degree of association between the node update request and node i, so The F i is the degree of association between the node update request and the parent node of node i, and the B i is the average value of the degree of association between the node update request and the sibling nodes of node i; the one with the highest attribution coefficient of the node update request is selected The node is the selected node.
  • the method further includes: extracting the target node and user information from the query instruction; and identifying the target node according to the description information of the target node Authority threshold, and extract the user authority level from the user information; if the user authority level is not lower than the authority threshold, it is determined to execute the query instruction; if the user authority level is lower than the authority threshold , It is determined not to execute the query instruction.
  • the query instruction is intercepted by the struct2 interceptor, and the corresponding relationship between the user information and the query instruction is stored in the historical interception record.
  • the querying and outputting the local classification tree model with the target node as the root node through the index of each node in the updated classification tree model includes: querying all IDs containing the target node As the target index; delete the ID before the ID of the target node in each target index to obtain more than one partial index data; combine each piece of the partial index data to obtain The local index data set of the classification tree model; according to the local index data set, the local classification tree model is drawn and output.
  • the embodiment of the present application obtains the classification tree model and generates the index of each current node according to the parent node of each current node. If a node update request is received, keywords are extracted from the node update request, and based on Keywords and the description information of each node to determine whether to update the classification tree model; if it is determined to update the classification tree model, select a node from the classification tree model as the selected node and add child nodes for the selected node to generate The index of the child node; after receiving the query instruction input by the user, if it is determined to execute the query instruction, extract the target node from the query instruction, and pass the index of each node in the updated classification tree model, Query and output the local classification tree model with the target node as the root node, thereby improving the efficiency when querying or updating the classification tree model.
  • Fig. 6 is a schematic diagram of a server provided by an embodiment of the present application.
  • the server 6 of this embodiment includes a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and running on the processor 60, such as a database query program.
  • the processor 60 executes the computer program 62, the steps in the above embodiments of the query method for each database are implemented, such as steps 101 to 106 shown in FIG. 1.
  • the processor 60 executes the computer program 62, the functions of the modules/units in the foregoing device embodiments, such as the functions of the units 501 to 504 shown in FIG. 5, are realized.
  • the computer program 62 may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 61 and executed by the processor 60 to complete This application.
  • the one or more modules/units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 62 in the server 6.
  • the server 6 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the server may include, but is not limited to, a processor 60 and a memory 61.
  • FIG. 6 is only an example of the server 6 and does not constitute a limitation on the server 6. It may include more or less components than shown, or a combination of certain components, or different components, for example
  • the server may also include input and output devices, network access devices, buses, and the like.
  • the so-called processor 60 may be a central processing unit (Central Processing Unit, CPU), other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the storage 61 may be an internal storage unit of the server 6, such as a hard disk or a memory of the server 6.
  • the memory 61 may also be an external storage device of the server 6, for example, a plug-in hard disk, a smart media card (SMC), or a secure digital (SD) card equipped on the server 6. Flash Card, etc. Further, the memory 61 may also include both an internal storage unit of the server 6 and an external storage device.
  • the memory 61 is used to store the computer program and other programs and data required by the server.
  • the memory 61 can also be used to temporarily store data that has been output or will be output.
  • a computer-readable storage medium stores a computer program, and the computer program implements the steps of the above method when executed by a processor.
  • the computer-readable storage medium may be a non-volatile storage medium or a volatile storage medium.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the integrated module/unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • this application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Disclosed are a database query method and apparatus, a server and a medium, which are applicable to the technical field of data processing. The method comprises: acquiring a classification tree model, and generating indexes of all current nodes according to parent nodes of all the current nodes (S101); if a node update request is received, extracting a keyword from the node update request, and determining, on the basis of the keyword and description information of all the nodes, whether to update the classification tree model (S102); if it is determined that the classification tree model is to be updated, selecting a node from the classification tree model as a selected node, adding a child node to the selected node, and generating an index of the child node (S103); after a query instruction input by a user is received, determining whether to execute the query instruction (S104); and if it is determined that the query instruction is to be executed, extracting a target node from the query instruction, and querying and outputting, by means of the indexes of all the nodes in the updated classification tree model, a localized classification tree model with the target node as a root node (S105). The efficiency when the classification tree model is queried or updated is improved.

Description

数据库的查询方法、装置、服务器及介质Database query method, device, server and medium
本申请要求于2019年7月3日提交中国专利局、申请号为201910594593.1,发明名称为“数据库的查询方法、装置、服务器及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on July 3, 2019, the application number is 201910594593.1, and the invention title is "Database query methods, devices, servers, and media", the entire content of which is incorporated by reference In this application.
技术领域Technical field
本申请属于数据处理技术领域,尤其涉及一种数据库的查询方法、装置、服务器及介质。This application belongs to the field of data processing technology, and in particular relates to a database query method, device, server and medium.
背景技术Background technique
目前,大型机构的管理人员在需要了解相关机构的架构或产品的生产流程信息时,服务器需要根据用户的指令在数据库中查询在相关树形结构中某个目标节点的相关联节点(相关联节点可以是:父节点、子节点或以目标节点为根节点的所有下级节点等),而现有技术都是通过数据库递归查询的方式来实现的。At present, when managers of large organizations need to understand the structure of related organizations or the production process information of their products, the server needs to query the related node (related node) of a target node in the related tree structure in the database according to the user's instruction. It can be: a parent node, a child node, or all subordinate nodes with the target node as the root node, etc.), and the prior art is implemented through a recursive database query.
然而,发明人发现,现有的数据库递归查询方式在树形结构的数据量很大的情况下,查询效率较低。此外,当用户需要修改相关树形结构时,修改灵活性和智能化程度也较差。更为重要的是,当树形结构更新后,数据库递归查询可能受到干扰,难度进一步增加,查询效率也可能进一步地减慢。However, the inventor found that the existing database recursive query method has low query efficiency when the amount of data in the tree structure is large. In addition, when the user needs to modify the related tree structure, the modification flexibility and intelligence are also poor. More importantly, when the tree structure is updated, the database recursive query may be disturbed, the difficulty further increases, and the query efficiency may further slow down.
发明内容Summary of the invention
有鉴于此,本申请实施例提供了一种数据库的查询方法、装置、服务器及介质,以解决现有技术在数据库更新时灵活性差以及查询效率低的问题。In view of this, the embodiments of the present application provide a database query method, device, server, and medium to solve the problems of poor flexibility and low query efficiency in database update in the prior art.
本申请实施例的第一方面提供了一种数据库的查询方法,包括:获取当前用于表征数据库中各数据集合关系的分类树模型,并根据当前的所述分类树模型中各节点的父节点,生成当前各节点的索引;若接收到用于增加节点的节点更新请求,则根据所述节点更新请求从所述节点更新请求中提取出关键词,调取当前的所述分类树模型中各节点的描述信息,并基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新;若判定对当前的所述分类树模型进行更新,则从所述分类树模型中选取一个节点作为被选节点,并为所述被选节点添加子节点,生成所述子节点的索引,以更新所述分类树模型;在接收到用户输入的查询指令后,若判定执行所述查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型。The first aspect of the embodiments of the present application provides a database query method, including: obtaining a classification tree model currently used to characterize the relationship between each data set in the database, and according to the parent node of each node in the current classification tree model , Generate the index of each current node; if a node update request for adding a node is received, keywords are extracted from the node update request according to the node update request, and the current classification tree model is retrieved Node’s description information, and based on the keywords and the description information, determine whether to update the current classification tree model; if it is determined to update the current classification tree model, then from the classification tree model Select a node as the selected node in the selected node, add child nodes to the selected node, and generate the index of the child node to update the classification tree model; after receiving the query instruction input by the user, if it is determined to execute all The query instruction extracts a target node from the query instruction, and queries and outputs a local classification tree model with the target node as a root node through the index of each node in the updated classification tree model.
本申请实施例的第二方面提供了一种数据库的查询装置,包括:A second aspect of the embodiments of the present application provides a database query device, including:
获取模块,用于获取当前用于表征数据库中各数据集合关系的分类树模型,并根据当前的所述分类树模型中各节点的父节点,生成当前各节点的索引;判断模块,用于若接收到用于增加节点的节点更新请求,则根据所述节点更新请求从所述节点更新请求中提取出多个关键词,调取当前的所述分类树模型中各节点的描述信息,并基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新;更新模块,用于若判定对当前的所述分类树模型进行更新,则从所述分类树模型中选取一个节点作为被选节点,并为所述被选节点添加一个子节点,生成所述子节点的索引,以更新所述分类树模型;查询模块,用于在接收到用户输入的查询指令后,若判定执行所述查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型。The obtaining module is used to obtain the classification tree model currently used to characterize the relationship between the data sets in the database, and to generate the index of each node according to the parent node of each node in the current classification tree model; the judgment module is used for After receiving a node update request for adding a node, multiple keywords are extracted from the node update request according to the node update request, and the description information of each node in the current classification tree model is retrieved, and based on The keyword and the description information determine whether to update the current classification tree model; an update module is used to select from the classification tree model if it is determined to update the current classification tree model A node is used as the selected node, and a child node is added to the selected node, and the index of the child node is generated to update the classification tree model; the query module is used to, after receiving the query instruction input by the user, If it is determined to execute the query instruction, extract the target node from the query instruction, and query and output the local classification tree with the target node as the root node through the index of each node in the updated classification tree model model.
本申请实施例的第三方面提供了一种服务器,包括:存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现本申请实施例的第一方面提供的方法的步骤,例如,所述处理器执行所述计算机程序时可实现以下步骤:获取当前用于表征数据库中各数据集合关系的分类树模型,并根据当前的 所述分类树模型中各节点的父节点,生成当前各节点的索引;若接收到用于增加节点的节点更新请求,则根据所述节点更新请求从所述节点更新请求中提取出关键词,调取当前的所述分类树模型中各节点的描述信息,并基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新;若判定对当前的所述分类树模型进行更新,则从所述分类树模型中选取一个节点作为被选节点,并为所述被选节点添加子节点,生成所述子节点的索引,以更新所述分类树模型;在接收到用户输入的查询指令后,若判定执行所述查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型。The third aspect of the embodiments of the present application provides a server including: a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, To implement the steps of the method provided by the first aspect of the embodiments of the present application, for example, when the processor executes the computer program, the following steps may be implemented: obtain the classification tree model currently used to characterize the relationship between the data sets in the database, and The parent node of each node in the current classification tree model generates the index of each current node; if a node update request for adding a node is received, the key is extracted from the node update request according to the node update request Words, retrieve the description information of each node in the current classification tree model, and based on the keywords and the description information, determine whether to update the current classification tree model; The classification tree model is updated, a node is selected from the classification tree model as the selected node, and child nodes are added to the selected node, and the index of the child node is generated to update the classification tree model; After receiving the query instruction input by the user, if it is determined to execute the query instruction, the target node is extracted from the query instruction, and the index of each node in the updated classification tree model is used to query and output The target node is the local classification tree model of the root node.
本申请实施例的第四方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现本申请实施例的第一方面提供的方法的步骤,例如,所述计算机程序被处理器执行时可实现以下步骤:获取当前用于表征数据库中各数据集合关系的分类树模型,并根据当前的所述分类树模型中各节点的父节点,生成当前各节点的索引;若接收到用于增加节点的节点更新请求,则根据所述节点更新请求从所述节点更新请求中提取出关键词,调取当前的所述分类树模型中各节点的描述信息,并基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新;若判定对当前的所述分类树模型进行更新,则从所述分类树模型中选取一个节点作为被选节点,并为所述被选节点添加子节点,生成所述子节点的索引,以更新所述分类树模型;在接收到用户输入的查询指令后,若判定执行所述查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型。The fourth aspect of the embodiments of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the The steps of the method, for example, when the computer program is executed by the processor, the following steps can be achieved: obtaining the classification tree model currently used to characterize the relationship between the data sets in the database, and according to the parent of each node in the current classification tree model Node, generate the index of each current node; if a node update request for adding a node is received, keywords are extracted from the node update request according to the node update request, and the current classification tree model is called The description information of each node, and based on the keywords and the description information, determine whether to update the current classification tree model; if it is determined to update the current classification tree model, then from the classification tree Select a node in the model as the selected node, add child nodes to the selected node, generate the index of the child node to update the classification tree model; after receiving the query instruction input by the user, if it is determined to execute The query instruction extracts a target node from the query instruction, and queries and outputs a local classification tree model with the target node as a root node through the index of each node in the updated classification tree model.
在本申请实施例中,在对复杂的分类树模型进行查询或更新时,可以基于各节点的索引进行快速的处理,显著提高相关任务的完成效率。In the embodiments of the present application, when querying or updating a complex classification tree model, fast processing can be performed based on the index of each node, which significantly improves the completion efficiency of related tasks.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art.
图1是本申请实施例提供的数据库的查询方法的实现流程图;FIG. 1 is an implementation flowchart of a database query method provided by an embodiment of the present application;
图2是本申请实施例提供的分类树模型的示意图;Figure 2 is a schematic diagram of a classification tree model provided by an embodiment of the present application;
图3是本申请实施例提供的数据库的查询方法S102的具体实现流程图;3 is a specific implementation flowchart of the database query method S102 provided by an embodiment of the present application;
图4是本申请实施例提供的数据库的查询方法S104的具体实现流程图;FIG. 4 is a specific implementation flowchart of the database query method S104 provided by the embodiment of the present application;
图5是本申请实施例提供的数据库的查询装置的结构框图;Figure 5 is a structural block diagram of a database query device provided by an embodiment of the present application;
图6是本申请实施例提供的服务器的示意图。Fig. 6 is a schematic diagram of a server provided by an embodiment of the present application.
具体实施方式Detailed ways
本申请的技术方案可应用于人工智能领域或大数据技术领域,解决现有技术在数据库更新时灵活性差以及查询效率低的问题。The technical solution of the present application can be applied to the field of artificial intelligence or big data technology, and solves the problems of poor flexibility and low query efficiency in database updates in the prior art.
实施例一Example one
图1示出了本申请实施例提供的数据库的查询方法的实现流程,该方法流程包括步骤S101至S106。各步骤的具体实现原理如下。Fig. 1 shows an implementation process of a database query method provided by an embodiment of the present application, and the method process includes steps S101 to S106. The specific implementation principle of each step is as follows.
在S101中,获取当前用于表征数据库中各数据集合关系的分类树模型,并根据当前的所述分类树模型中各节点的父节点,生成当前各节点的索引。In S101, the current classification tree model used to characterize the relationship between the data sets in the database is obtained, and the current index of each node is generated according to the parent node of each node in the current classification tree model.
在本申请实施例中,数据集合可以为一个公司架构中一个组织的相关数据,例如:各个数据集合可以分别为公司架构中的不同部门、分公司、子公司的数据等。值得注意地,由于一个公司的架构从总公司开始会按照一定的分类规则被一层层的分解为多个不同级别的多个组织,所以一个公司的公司架构可以形成一个分类树,每个组织的相关数据所形成的一个数据集合就是该分类树中的一个节点。所以综上,本申请实施例中的分类树模型可 以用于表征数据库中各数据集合关系,其中,该分类树模型的根节点表征总公司所对应的数据集合。In the embodiment of the present application, the data set may be related data of an organization in a company structure. For example, each data set may be data of different departments, branches, and subsidiaries in the company structure. It is worth noting that, since the structure of a company from the head office will be decomposed into multiple organizations at different levels according to certain classification rules, the corporate structure of a company can form a classification tree, and each organization A data set formed by related data of is a node in the classification tree. Therefore, in summary, the classification tree model in the embodiment of the present application can be used to characterize the relationship between each data set in the database, where the root node of the classification tree model represents the data set corresponding to the head office.
值得注意地,在本申请实施例中,分类树模型的各个节点均有其对应的节点ID,节点ID用于唯一确定一个节点。如图2所示,各个节点的节点ID可以用字母表示,如根节点的节点ID为A,第二级节点的节点ID分别为B和C等。显然,为了利于说明以及下文的进一步介绍,图2仅为一个非常简单的分类树模型,本申请实施例在真实工程中处理的分类树模型的节点数量要远远多于图2中的分类树模型中的节点数量。可选地,当节点数量较大时,可以选用多位数字作为不同节点的节点ID。It is worth noting that in this embodiment of the present application, each node of the classification tree model has a corresponding node ID, and the node ID is used to uniquely determine a node. As shown in Figure 2, the node ID of each node can be represented by letters. For example, the node ID of the root node is A, and the node IDs of the second-level nodes are B and C respectively. Obviously, in order to facilitate the description and further introduction below, FIG. 2 is only a very simple classification tree model. The number of nodes of the classification tree model processed in the real project in the embodiment of this application is much more than that of the classification tree in FIG. 2 The number of nodes in the model. Optionally, when the number of nodes is large, multiple digits can be selected as the node IDs of different nodes.
值得注意地,为了避免在分类树模型的数据量较大的情况下,传统的数据库递归查询方式存在的查询效率低的问题,本申请实施例的第一步就需要生成分类树模型中各节点的索引,并在下文基于各节点的索引进行快速查询。It is worth noting that, in order to avoid the problem of low query efficiency in the traditional database recursive query method when the data volume of the classification tree model is large, the first step of the embodiment of the present application requires generating each node in the classification tree model. The index of each node will be quickly searched below based on the index of each node.
可选地,生成分类树模型中各节点的索引,包括:从当前的所述分类树模型中选定除根节点以外的节点,将从正被选定的节点的父节点到所述根节点路径上的全部节点的ID,按照从根节点向下层节点的顺序进行组合,作为所述正被选定的节点的索引,以在遍历当前的所述分类树模型中的除根节点以外的全部节点后,生成当前各节点的索引。Optionally, generating the index of each node in the classification tree model includes: selecting nodes other than the root node from the current classification tree model, and a path from the parent node of the node being selected to the root node The IDs of all the nodes on the above are combined in the order from the root node to the lower nodes, as the index of the node being selected, so as to traverse all nodes except the root node in the current classification tree model , To generate the index of each current node.
示例性地,仍以图2为例,本申请实施例会遍历该分类树模型中除了根节点A以外的每个节点,显然在遍历的过程中会选定一个个的节点。假设当前选定了节点D,那么将从节点D到根节点A路径上的全部节点的ID,按照从根节点向下层节点的顺序进行组合,生成正被选定的节点D的索引。在图2中,节点D的索引为A!B!D。以此类推,可以确定出其他非根节点的节点的索引。Exemplarily, still taking FIG. 2 as an example, the embodiment of the present application will traverse every node in the classification tree model except for the root node A. Obviously, each node will be selected during the traversal process. Assuming that node D is currently selected, the IDs of all nodes on the path from node D to root node A are combined in the order from the root node to the lower nodes to generate the index of node D being selected. In Figure 2, the index of node D is A! B! D. By analogy, the index of other non-root nodes can be determined.
可以理解地,由于生成了各节点的索引,在下文的查询或更新流程中,只需要针对各节点的索引进行数据运算即可,无需在本次查询或更新中都重新递归的分析各节点的连接关系,从而可以提高相关操作的速率。Understandably, because the index of each node is generated, in the following query or update process, only the data operation is required for the index of each node, and there is no need to recursively analyze the data of each node in this query or update. Connection relationship, which can increase the rate of related operations.
在S102中,若接收到用于增加节点的节点更新请求,则从所述节点更新请求中提取出关键词,调取当前的所述分类树模型中各节点的描述信息,并基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新。In S102, if a node update request for adding a node is received, keywords are extracted from the node update request, and the description information of each node in the current classification tree model is retrieved, and based on the key Words and the description information to determine whether to update the current classification tree model.
可以理解地,一个分类树模型在生成之后并不是恒定不变的,可能会出现增、删、改等操作,以改变分类树模型中各节点的连接关系或增加删除节点。用户可以通过节点更新请求向服务器传递增加、删除和修改分类树模型中节点的请求。服务器在解析节点更新请求后,根据用户的相关权限完成增、删、改的操作。在本申请实施例中,考虑到删除和修改节点必须要保证服务器解析的准确性,否则会影响到分类树模型的数据安全和完整性,所以针对删除和修改节点的请求,用户必须要在节点更新请求中写明目标节点的ID以及请求操作的具体步骤,服务器可以根据节点更新请求中包含的具体内容,准确地完成删除和修改节点的操作。但是考虑到增加节点的特殊性,由于增加节点往往对于分类树模型的数据安全和完整性影响较小,为了提高用户操作的便捷性,不至于在每次操作时都完整输入所有信息,所以本申请实施例提供了针对增加节点的节点更新请求的一套更加智能的方法,详述如下:Understandably, a classification tree model is not constant after it is generated, and operations such as addition, deletion, and modification may occur to change the connection relationship of the nodes in the classification tree model or add or delete nodes. The user can pass the request of adding, deleting and modifying the node in the classification tree model to the server through the node update request. After the server parses the node update request, it completes the addition, deletion, and modification operations according to the user's relevant permissions. In the embodiments of this application, considering that deleting and modifying nodes must ensure the accuracy of server analysis, otherwise the data security and integrity of the classification tree model will be affected. Therefore, for requests to delete and modify nodes, users must The ID of the target node and the specific steps of the requested operation are written in the update request. The server can accurately complete the operation of deleting and modifying the node according to the specific content contained in the node update request. However, considering the particularity of adding nodes, because adding nodes often has less impact on the data security and integrity of the classification tree model, in order to improve the convenience of user operations, it is not necessary to input all the information in each operation. The application embodiment provides a set of smarter methods for node update requests for adding nodes, which are detailed as follows:
值得注意地,针对用户希望对当前的分类树模型增加新节点的节点更新请求,本申请实施例提供了一种有别于现有技术的自动判断更新的方法。在本申请实施例中,当用户希望增加一个节点时,需要将希望增加的节点的描述信息以关键词的形式输入进终端设备,终端设备会根据这些关键词生成节点更新请求,并发送至服务器。可选地,关键词可以包括:欲生成的节点的等级、欲生成的节点的特性等等。显然,服务器在接收到一个节点更新请求后,可以解析出其中包含的关键词,从而确定用户希望为分类树模型新增一个什么样的节点,并进一步判断出是否同意为分类树模型增加该节点。It is worth noting that, in response to a node update request that a user wishes to add a new node to the current classification tree model, the embodiment of the present application provides an automatic judgment update method that is different from the prior art. In the embodiment of this application, when a user wants to add a node, he needs to input the description information of the node he wants to add into the terminal device in the form of keywords. The terminal device will generate a node update request based on these keywords and send it to the server . Optionally, the keywords may include: the level of the node to be generated, the characteristics of the node to be generated, and so on. Obviously, after the server receives a node update request, it can parse out the keywords contained in it to determine what kind of node the user wants to add to the classification tree model, and further determine whether to agree to add the node to the classification tree model .
作为本申请的一个实施例,如图3所示,上述S102包括:As an embodiment of the present application, as shown in FIG. 3, the foregoing S102 includes:
S1021,统计所述关键词在各个节点的所述描述信息中的出现次数以各个所述描述信息中的词语总数。S1021: Count the number of occurrences of the keyword in the description information of each node to the total number of words in each description information.
在本申请实施例中,每个节点都有其对应的描述信息,描述信息用于描述该节点的各类特征。显然每个节点的描述信息是由多个词语组成的,通过分词处理可以得到每个节点的描述信息的词语集合(词语集合中可以存在相同的词语,在本申请实施例中并不将它们进行合并),从而统计出更新请求中的关键词在每个描述信息中的出现次数。例如,假设在一个描述信息中,词语“风控”一共出现了5次,那么若关键词也为“风控”,则该关键词在该描述信息中的出现次数为5。同理,在本申请实施例中,描述信息中的词语总数为描述信息的词语集合在未进行相同词语合并的前提下词语的总个数。In the embodiment of the present application, each node has its corresponding description information, and the description information is used to describe various characteristics of the node. Obviously, the description information of each node is composed of multiple words, and the word set of the description information of each node can be obtained through word segmentation (the same words may exist in the word set, and they are not used in this embodiment of the application). Merge) to count the number of occurrences of the keywords in the update request in each description information. For example, suppose that in a piece of description information, the word "risk control" appears 5 times in total, then if the keyword is also "risk control", the number of occurrences of the keyword in the description information is 5. Similarly, in the embodiment of the present application, the total number of words in the description information is the total number of words in the word set of the description information without the same word combination.
S1022,计算所述当前的分类树模型中包含的节点的总数,作为第一节点数量,并统计所对应的描述信息中包含所述关键词的节点的数量,作为第二节点数量。S1022: Calculate the total number of nodes included in the current classification tree model as the first node number, and count the number of nodes containing the keyword in the corresponding description information as the second node number.
S1023,通过关联度计算公式计算所述节点更新请求与各个节点的关联度。S1023: Calculate the degree of association between the node update request and each node by using an association degree calculation formula.
可选地,所述关联度计算公式为:
Figure PCTCN2020092811-appb-000001
其中,所述Y i为节点更新请求与所述分类树模型中的节点i的关联度,所述n i为所述关键词在节点i的所述描述信息中的出现次数,所述k i为节点i的描述信息中的词语总数,所述h为所述第一节点数量,所述b为所述第二节点数量。
Optionally, the formula for calculating the degree of association is:
Figure PCTCN2020092811-appb-000001
Wherein, the Y i is the degree of association between the node update request and the node i in the classification tree model, the n i is the number of occurrences of the keyword in the description information of the node i, and the k i Is the total number of words in the description information of the node i, the h is the number of the first node, and the b is the number of the second node.
可以理解地,在本申请实施例中,可以理解地,关联度并不是简单的关键词在各个描述信息中的概率,而是结合关键词在各个节点的所述描述信息中的出现次数,各个节点的描述信息中的词语总数、当前的分类树模型中包含的节点的总数以及所对应的描述信息中包含所述关键词的节点的数量这4个重要参数,更为准确客观的计算出反应关键词与各个节点的关联程度的参数,即节点更新请求与各个节点的关联度。Understandably, in the embodiments of this application, it is understandable that the degree of association is not simply the probability of a keyword in each description information, but a combination of the number of occurrences of the keyword in the description information of each node, and each The four important parameters of the total number of words in the description information of the node, the total number of nodes contained in the current classification tree model, and the number of nodes containing the keywords in the corresponding description information, are more accurate and objective to calculate the response The parameter of the degree of relevance between the keyword and each node, that is, the degree of relevance between the node update request and each node.
S1024,若所述分类树模型中存在至少一个节点与所述更新请求的关联度不小于预设的关联度阈值,则判定不对当前的所述分类树模型进行更新。S1024: If the correlation degree between at least one node in the classification tree model and the update request is not less than a preset correlation degree threshold, it is determined not to update the current classification tree model.
值得注意地,显然一个节点与节点更新请求的关联度越高,证明该节点更新请求希望创建的节点就与一个已存在的节点的功能越重合。因此,在本申请实施例中,若当前的分类树模型中存在一个节点与节点更新请求的关联度高于预设阈值,则证明希望创建的节点与一个已存在的节点的功能过于重合,因此判定不进行节点更新,并反馈“已存在相似节点”的通知给用户。It is worth noting that, obviously, the higher the degree of association between a node and the node update request, the more the function of the node that the node update request hopes to create and an existing node have. Therefore, in the embodiment of the present application, if there is a node in the current classification tree model that is associated with a node update request that is higher than the preset threshold, it proves that the functions of the desired node and an existing node overlap too much. It is determined not to update the node, and a notification that "similar node already exists" is returned to the user.
S1025,若所述分类树模型中所有节点与所述更新请求的关联度均小于预设的关联度阈值,则判定对当前的所述分类树模型进行更新。S1025: If the degree of association between all nodes in the classification tree model and the update request is less than a preset degree of association threshold, it is determined to update the current classification tree model.
在这种情况下,证明当前并没有一个已存在的节点与用户希望创建的节点的功能过于重合,因此需要在当前的分类树模型的基础上添加一个新的节点,则对分类树模型进行节点更新。In this case, it is proved that there is no existing node that overlaps the function of the node that the user wants to create. Therefore, it is necessary to add a new node on the basis of the current classification tree model, and then perform node on the classification tree model. Update.
在本申请实施例中,可以智能化的对节点更新请求进行分析判断,以快速确定是否需要对当前的分类树模型进行更新。In the embodiment of the present application, the node update request can be intelligently analyzed and judged to quickly determine whether the current classification tree model needs to be updated.
在S103中,若判定对当前的所述分类树模型进行更新,则从所述分类树模型中选取一个节点作为被选节点,并为所述被选节点添加子节点,生成所述子节点的索引,以更新所述分类树模型。In S103, if it is determined to update the current classification tree model, a node is selected from the classification tree model as the selected node, and child nodes are added to the selected node to generate the Index to update the classification tree model.
可选地,在通过公式:
Figure PCTCN2020092811-appb-000002
计算所述节点更新请求归属于各个节点的归属系数,其中,所述W i表示所述节点更新请求归属于节点i的归属系数,所述Y i为节点更新请求与节点i的关联度,所述F i为节点更新请求与节点i的父节点的关联度,所述B i为 节点更新请求与节点i的兄弟节点的关联度的平均值;选取与所述节点更新请求的归属系数最高的节点作为被选节点。
Optionally, after passing the formula:
Figure PCTCN2020092811-appb-000002
Calculate the attribution coefficient of the node update request to each node, where W i represents the attribution coefficient of the node update request to node i, and the Y i is the degree of association between the node update request and node i, so The F i is the degree of association between the node update request and the parent node of node i, and the B i is the average value of the degree of association between the node update request and the sibling nodes of node i; the one with the highest attribution coefficient of the node update request is selected The node is the selected node.
可以理解地,本申请实施例通过比对节点更新请求与相关联的节点(父节点、兄弟节点)的关联度,确定节点更新请求归属于各个节点的归属系数,从而选取出需要添加子节点的被选节点。显然,本申请实施例在被选节点下添加子节点后,即对当前的分类树模型进行了更新。为了便于后续的查询,也会基于S101的方式生成该新添加的子节点的索引。Understandably, the embodiment of the present application determines the attribution coefficient of the node update request attributable to each node by comparing the degree of association between the node update request and the associated nodes (parent node, sibling node), so as to select the child nodes that need to be added. The selected node. Obviously, after adding sub-nodes under the selected node in the embodiment of this application, the current classification tree model is updated. In order to facilitate subsequent queries, the index of the newly added child node will also be generated based on S101.
在S104中,在接收到用户输入的查询指令后,判断是否执行所述查询指令。In S104, after receiving the query instruction input by the user, it is determined whether to execute the query instruction.
查询指令可以为:查找目标节点的所有孩子节点。显然,通过查询目标节点的所有孩子节点,可以找到以目标节点为根节点的分类树模型的一个局部。The query instruction can be: find all child nodes of the target node. Obviously, by querying all child nodes of the target node, a part of the classification tree model with the target node as the root node can be found.
如上文所述,由于分类树模型中的节点是有不同层级的,根节点的层级最高,叶子节点的层级最低,中间各层级的节点由根节点至叶子节点依次下降,因此不同层级的节点对应的数据的安全性要求不同,所以对于用户权限的要求也就不同。反过来说,在本申请实施例中,用户权限较低的用户不允许搜索以较高等级的目标节点为根节点的局部分类树模型,不允许调取较高目标节点对应的数据。As mentioned above, because the nodes in the classification tree model have different levels, the root node has the highest level, the leaf node has the lowest level, and the nodes of each level in the middle descend from the root node to the leaf node, so the nodes of different levels correspond to The data security requirements are different, so the requirements for user permissions are also different. Conversely, in this embodiment of the present application, users with lower user rights are not allowed to search for a local classification tree model with a higher-level target node as the root node, and are not allowed to retrieve data corresponding to a higher target node.
因此,本申请实施例中判断是否执行所述查询指令本质上是通过比对发出查询指令的用户的用户权限与查询指令希望查询的目标节点的权限阈值的大小实现的。Therefore, in the embodiment of the present application, determining whether to execute the query instruction is essentially achieved by comparing the user authority of the user issuing the query instruction with the authority threshold of the target node that the query instruction wishes to query.
作为本申请的一个实施例,如图4所示,上述S104包括:As an embodiment of the present application, as shown in FIG. 4, the foregoing S104 includes:
S1041,从所述查询指令中提取出目标节点以及用户信息。S1041: Extract the target node and user information from the query instruction.
在本申请实施例中,查询指令至少包括两个参数,一个参数为目标节点,另一个参数为用户信息。In the embodiment of the present application, the query instruction includes at least two parameters, one parameter is the target node, and the other parameter is user information.
S1042,根据所述目标节点的所述描述信息识别出所述目标节点的权限阈值,并从所述用户信息中提取出用户权限等级。S1042: Identify the authority threshold of the target node according to the description information of the target node, and extract a user authority level from the user information.
可选地,方式一:事先为每一个等级的节点赋予一个权限阈值,在这种情况下,一旦从查询指令中解析出目标节点,就可以根据该目标节点在分类树模型中等级,确定出权限阈值。Optionally, method one: assign a permission threshold to each level of node in advance. In this case, once the target node is parsed from the query instruction, it can be determined according to the level of the target node in the classification tree model Permission threshold.
可选地,方式二:提取所述目标节点对应的所述描述信息作为目标数据,将目标数据根据预设的转换规则转换为目标矩阵后,通过支持向量机算法确定目标矩阵对应的权限阈值,从查询指令中解析出目标节点,若目标节点的权限阈值高于用户权限,则判定不执行所述查询指令。若目标节点的权限阈值不高于用户权限,则判定执行所述查询指令。Optionally, method two: extract the description information corresponding to the target node as target data, convert the target data into a target matrix according to a preset conversion rule, and determine the authority threshold corresponding to the target matrix through a support vector machine algorithm, The target node is parsed from the query instruction, and if the authority threshold of the target node is higher than the user authority, it is determined not to execute the query instruction. If the authority threshold of the target node is not higher than the user authority, it is determined to execute the query instruction.
具体的通过支持向量机算法确定目标矩阵对应的权限阈值的方法包括:获取每一个权限阈值对应的主成分矩阵,计算所有权限阈值对应的主成分矩阵的平均值,生成平均主成分矩阵,并通过公式:
Figure PCTCN2020092811-appb-000003
计算各个权限阈值的训练参数,其中,P i表示权限阈值i的训练参数,X i表示权限阈值i的主成分矩阵,X’表示平均主成分矩阵,δ表示X i与X’的协方差矩阵。反复执行:从一个以上的权限阈值中选择一个权限阈值作为被选阈值,将被选阈值对应的训练参数组成正向训练集,将被选阈值以外的权限阈值对应的训练参数组成负向训练集,并根据所述正向训练集以及所述负向训练集,通过现有的SVM算法计算出被选阈值的分类超平面。直至计算出全部权限阈值的分类超平面。计算所述目标矩阵与各个权限阈值的分类超平面的欧式距离,作为各个权限阈值对应的欧式距离,将欧式距离最小的权限阈值作为目标节点对应的权限阈值。
The specific method for determining the authority threshold corresponding to the target matrix through the support vector machine algorithm includes: obtaining the principal component matrix corresponding to each authority threshold, calculating the average value of the principal component matrix corresponding to all authority thresholds, generating the average principal component matrix, and passing formula:
Figure PCTCN2020092811-appb-000003
Calculate training parameters each permission threshold value, wherein, P i represents the permission threshold training parameter i, X i represents the main ingredient matrix permission threshold value of i, X 'represents an average primary ingredient matrix, [delta] represents X i and X' is a covariance matrix . Repeated execution: select one permission threshold from more than one permission threshold as the selected threshold, compose the training parameters corresponding to the selected threshold into a positive training set, and compose the training parameters corresponding to the permission threshold outside the selected threshold into a negative training set , And according to the positive training set and the negative training set, the classification hyperplane of the selected threshold is calculated through the existing SVM algorithm. Until the classification hyperplane of all permission thresholds is calculated. Calculate the Euclidean distance between the target matrix and the classification hyperplane of each authority threshold as the Euclidean distance corresponding to each authority threshold, and use the authority threshold with the smallest Euclidean distance as the authority threshold corresponding to the target node.
可以理解地,通过支持向量机进行权限阈值的识别相当于预先设定一套权限阈值的设定标准。(即预先设定每一个权限阈值对应的多个主成分矩阵),而不是直接确定一个等 级节点的权限阈值。这样可以根据目标数据中各个属性的属性值的不同,客观的确定权限阈值,突出目标数据中部分细微不同,给最终确定的权限阈值的影响,提高权限阈值的精度。Understandably, the recognition of the permission threshold through the support vector machine is equivalent to a set of pre-setting standards for the permission threshold. (That is, preset multiple principal component matrices corresponding to each authority threshold), instead of directly determining the authority threshold of a level node. In this way, the authority threshold can be objectively determined according to the attribute value of each attribute in the target data, highlighting some subtle differences in the target data, affecting the final authority threshold, and improving the accuracy of the authority threshold.
此外,一个分类树模型的节点可能是非常多的,可以达到上千个,这样就很难直接为每一个节点都设置合理的权限阈值,因此,通过方式二,当我们设置好一套标准后,由于每一个节点都必然有一个描述信息,因此我们就可以更加便捷地自动为各个节点设置准确的权限阈值。In addition, a classification tree model may have a large number of nodes, which can reach thousands, so it is difficult to directly set a reasonable permission threshold for each node. Therefore, through method 2, when we set a set of standards , Since each node must have a description information, we can automatically set the accurate permission threshold for each node more conveniently.
S1043,若所述用户权限等级不低于所述权限阈值,则判定执行所述查询指令。S1043: If the user authority level is not lower than the authority threshold, determine to execute the query instruction.
S1044,若所述用户权限等级低于所述权限阈值,则判定不执行所述查询指令。S1044: If the user authority level is lower than the authority threshold, it is determined not to execute the query instruction.
可以理解地,本申请实施例可以确保数据查询的安全性Understandably, the embodiments of this application can ensure the security of data query
在S105中,若判定执行所述查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型。In S105, if it is determined to execute the query instruction, extract the target node from the query instruction, and query and output the target node as the root node through the index of each node in the updated classification tree model Local classification tree model.
可选地,查询出所有包含所述目标节点的ID的索引,作为目标索引;将各个所述目标索引中在所述目标节点的ID之前的ID删除,得到一个以上的局部索引数据;拼合各条所述局部索引数据,得到用于表征所述局部分类树模型的局部索引数据集合;根据所述局部索引数据集合,绘制并输出所述局部分类树模型。Optionally, query all the indexes containing the ID of the target node as the target index; delete the ID before the ID of the target node in each target index to obtain more than one partial index data; Piece of the local index data to obtain a local index data set for characterizing the local classification tree model; draw and output the local classification tree model according to the local index data set.
在S106中,若判定不执行所述查询指令,则通过struct2拦截器对所述查询指令进行拦截,并将所述用户信息以及所述查询指令的对应关系存入历史拦截记录。In S106, if it is determined that the query instruction is not executed, the query instruction is intercepted by the struct2 interceptor, and the corresponding relationship between the user information and the query instruction is stored in the historical interception record.
可以理解地,在本申请实施例中,通过获取分类树模型并根据当前各节点的父节点生成当前各节点的索引,若接收到节点更新请求,则从所述节点更新请求中提取出关键词,并基于关键词和各个节点的描述信息,判断是否对分类树模型进行更新;若判定对分类树模型进行更新,则从分类树模型中选取一个节点作为被选节点并为被选节点添加子节点,生成所述子节点的索引;在接收到用户输入的查询指令后,若判定执行查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以目标节点为根节点的局部分类树模型,从而提高对分类树模型进行查询或更新时的效率。Understandably, in the embodiment of the present application, by obtaining the classification tree model and generating the index of each current node according to the parent node of each current node, if a node update request is received, keywords are extracted from the node update request , And based on the keywords and description information of each node, determine whether to update the classification tree model; if it is determined to update the classification tree model, select a node from the classification tree model as the selected node and add children to the selected node Node, generating the index of the child node; after receiving the query instruction input by the user, if it is determined to execute the query instruction, extract the target node from the query instruction, and pass each node in the updated classification tree model , Query and output the local classification tree model with the target node as the root node, thereby improving the efficiency of querying or updating the classification tree model.
对应于上文实施例所述的数据库的查询方法,图5示出了本申请实施例提供的数据库的查询装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the database query method described in the above embodiment, FIG. 5 shows a structural block diagram of a database query device provided in an embodiment of the present application. For ease of description, only parts related to the embodiment of the present application are shown.
参照图5,该装置包括:Referring to Figure 5, the device includes:
获取模块501,用于获取当前用于表征数据库中各数据集合关系的分类树模型,生成分类树模型中各节点的索引;The obtaining module 501 is configured to obtain a classification tree model currently used to characterize the relationship between each data set in the database, and generate an index of each node in the classification tree model;
判断模块502,用于若接收到用于增加节点的节点更新请求,则从所述节点更新请求中提取出多个关键词,调取当前的所述分类树模型中各节点的描述信息,并基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新;The judgment module 502 is configured to, if a node update request for adding a node is received, extract multiple keywords from the node update request, retrieve the description information of each node in the current classification tree model, and Determine whether to update the current classification tree model based on the keywords and the description information;
更新模块503,用于若判定对当前的所述分类树模型进行更新,则根据所述节点更新请求从所述分类树模型中选取一个节点作为被选节点,并为所述被选节点添加一个子节点,生成所述子节点的索引,以更新所述分类树模型;The update module 503 is configured to, if it is determined to update the current classification tree model, select a node from the classification tree model as the selected node according to the node update request, and add a node to the selected node Child node, generating an index of the child node to update the classification tree model;
查询模块504,用于在接收到用户输入的查询指令后,若判定执行所述查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型。The query module 504 is configured to, after receiving the query instruction input by the user, if it is determined to execute the query instruction, extract the target node from the query instruction and pass the index of each node in the updated classification tree model , Query and output the local classification tree model with the target node as the root node.
可选地,所述生成分类树模型中各节点的索引,包括:从当前的所述分类树模型中逐一选定除根节点以外的节点,将被选定的节点到所述根节点路径上的全部节点的ID,按照从根节点向下层节点的顺序进行组合,作为所述被选定的节点的索引,以在遍历当前的所 述分类树模型中的除根节点以外的全部节点后,生成当前各节点的索引。Optionally, the generating the index of each node in the classification tree model includes: selecting nodes other than the root node from the current classification tree model one by one, and transferring the selected node to the root node on the path The IDs of all nodes are combined in the order from the root node to the lower nodes, as the index of the selected node, to generate the current classification tree model after traversing all nodes except the root node The index of each node.
可选地,所述基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新,包括:Optionally, the determining whether to update the current classification tree model based on the keywords and the description information includes:
统计所述关键词在各个节点的所述描述信息中的出现次数以各个所述描述信息中的词语总数;计算所述当前的分类树模型中包含的节点的总数,作为第一节点数量,并统计所对应的描述信息中包含所述关键词的节点的数量,作为第二节点数量;通过公式:
Figure PCTCN2020092811-appb-000004
计算所述节点更新请求与各个节点的关联度,所述Y i为节点更新请求与所述分类树模型中的节点i的关联度,所述n i为所述关键词在节点i的所述描述信息中的出现次数,所述k i为节点i的描述信息中的词语总数,所述h为所述第一节点数量,所述b为所述第二节点数量;若所述分类树模型中存在至少一个节点与所述更新请求的关联度不小于预设的关联度阈值,则判定不对当前的所述分类树模型进行更新;若所述分类树模型中所有节点与所述更新请求的关联度均小于预设的关联度阈值,则判定对当前的所述分类树模型进行更新。
Count the number of occurrences of the keywords in the description information of each node with the total number of words in each description information; calculate the total number of nodes included in the current classification tree model as the first number of nodes, and Count the number of nodes containing the keyword in the corresponding description information as the number of second nodes; by formula:
Figure PCTCN2020092811-appb-000004
Calculate the degree of association between the node update request and each node, the Y i is the degree of association between the node update request and the node i in the classification tree model, and the n i is the keyword in the node i The number of occurrences in the description information, the k i is the total number of words in the description information of the node i, the h is the number of the first node, and the b is the number of the second node; if the classification tree model If there is at least one node in the update request with a degree of relevance that is not less than the preset relevance threshold, it is determined not to update the current classification tree model; if all nodes in the classification tree model are related to the update request If the association degrees are all less than the preset association degree threshold, it is determined to update the current classification tree model.
可选地,所述从所述分类树模型中选取一个节点作为被选节点,包括:通过公式:
Figure PCTCN2020092811-appb-000005
计算所述节点更新请求归属于各个节点的归属系数,其中,所述W i表示所述节点更新请求归属于节点i的归属系数,所述Y i为节点更新请求与节点i的关联度,所述F i为节点更新请求与节点i的父节点的关联度,所述B i为节点更新请求与节点i的兄弟节点的关联度的平均值;选取与所述节点更新请求的归属系数最高的节点作为被选节点。
Optionally, the selecting a node from the classification tree model as the selected node includes: using a formula:
Figure PCTCN2020092811-appb-000005
Calculate the attribution coefficient of the node update request to each node, where W i represents the attribution coefficient of the node update request to node i, and the Y i is the degree of association between the node update request and node i, so The F i is the degree of association between the node update request and the parent node of node i, and the B i is the average value of the degree of association between the node update request and the sibling nodes of node i; the one with the highest attribution coefficient of the node update request is selected The node is the selected node.
可选地,在所述接收到用户输入的查询指令后,还包括:从所述查询指令中提取出目标节点以及用户信息;根据所述目标节点的所述描述信息识别出所述目标节点的权限阈值,并从所述用户信息中提取出用户权限等级;若所述用户权限等级不低于所述权限阈值,则判定执行所述查询指令;若所述用户权限等级低于所述权限阈值,则判定不执行所述查询指令。Optionally, after receiving the query instruction input by the user, the method further includes: extracting the target node and user information from the query instruction; and identifying the target node according to the description information of the target node Authority threshold, and extract the user authority level from the user information; if the user authority level is not lower than the authority threshold, it is determined to execute the query instruction; if the user authority level is lower than the authority threshold , It is determined not to execute the query instruction.
可选地,若判定不执行所述查询指令,则通过struct2拦截器对所述查询指令进行拦截,并将所述用户信息以及所述查询指令的对应关系存入历史拦截记录。Optionally, if it is determined that the query instruction is not to be executed, the query instruction is intercepted by the struct2 interceptor, and the corresponding relationship between the user information and the query instruction is stored in the historical interception record.
可选地,所述通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型,包括:查询出所有包含所述目标节点的ID的索引,作为目标索引;将各个所述目标索引中在所述目标节点的ID之前的ID删除,得到一个以上的局部索引数据;拼合各条所述局部索引数据,得到用于表征所述局部分类树模型的局部索引数据集合;根据所述局部索引数据集合,绘制并输出所述局部分类树模型。Optionally, the querying and outputting the local classification tree model with the target node as the root node through the index of each node in the updated classification tree model includes: querying all IDs containing the target node As the target index; delete the ID before the ID of the target node in each target index to obtain more than one partial index data; combine each piece of the partial index data to obtain The local index data set of the classification tree model; according to the local index data set, the local classification tree model is drawn and output.
可以理解地,本申请实施例通过获取分类树模型并根据当前各节点的父节点生成当前各节点的索引,若接收到节点更新请求,则从所述节点更新请求中提取出关键词,并基于关键词和各个节点的描述信息,判断是否对分类树模型进行更新;若判定对分类树模型进行更新,则从分类树模型中选取一个节点作为被选节点并为被选节点添加子节点,生成所述子节点的索引;在接收到用户输入的查询指令后,若判定执行查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以目标节点为根节点的局部分类树模型,从而提高对分类树模型进行查询或更新时的效率。Understandably, the embodiment of the present application obtains the classification tree model and generates the index of each current node according to the parent node of each current node. If a node update request is received, keywords are extracted from the node update request, and based on Keywords and the description information of each node to determine whether to update the classification tree model; if it is determined to update the classification tree model, select a node from the classification tree model as the selected node and add child nodes for the selected node to generate The index of the child node; after receiving the query instruction input by the user, if it is determined to execute the query instruction, extract the target node from the query instruction, and pass the index of each node in the updated classification tree model, Query and output the local classification tree model with the target node as the root node, thereby improving the efficiency when querying or updating the classification tree model.
图6是本申请一实施例提供的服务器的示意图。如图6所示,该实施例的服务器6包括:处理器60、存储器61以及存储在所述存储器61中并可在所述处理器60上运行的计算机程序62,例如数据库的查询程序。所述处理器60执行所述计算机程序62时实现上述各个数据库的查询方法实施例中的步骤,例如图1所示的步骤101至106。或者,所述处 理器60执行所述计算机程序62时实现上述各装置实施例中各模块/单元的功能,例如图5所示单元501至504的功能。Fig. 6 is a schematic diagram of a server provided by an embodiment of the present application. As shown in FIG. 6, the server 6 of this embodiment includes a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and running on the processor 60, such as a database query program. When the processor 60 executes the computer program 62, the steps in the above embodiments of the query method for each database are implemented, such as steps 101 to 106 shown in FIG. 1. Alternatively, when the processor 60 executes the computer program 62, the functions of the modules/units in the foregoing device embodiments, such as the functions of the units 501 to 504 shown in FIG. 5, are realized.
示例性的,所述计算机程序62可以被分割成一个或多个模块/单元,所述一个或者多个模块/单元被存储在所述存储器61中,并由所述处理器60执行,以完成本申请。所述一个或多个模块/单元可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序62在所述服务器6中的执行过程。Exemplarily, the computer program 62 may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 61 and executed by the processor 60 to complete This application. The one or more modules/units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 62 in the server 6.
所述服务器6可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述服务器可包括,但不仅限于,处理器60、存储器61。本领域技术人员可以理解,图6仅仅是服务器6的示例,并不构成对服务器6的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述服务器还可以包括输入输出设备、网络接入设备、总线等。The server 6 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The server may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art can understand that FIG. 6 is only an example of the server 6 and does not constitute a limitation on the server 6. It may include more or less components than shown, or a combination of certain components, or different components, for example The server may also include input and output devices, network access devices, buses, and the like.
所称处理器60可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called processor 60 may be a central processing unit (Central Processing Unit, CPU), other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
所述存储器61可以是所述服务器6的内部存储单元,例如服务器6的硬盘或内存。所述存储器61也可以是所述服务器6的外部存储设备,例如所述服务器6上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器61还可以既包括所述服务器6的内部存储单元也包括外部存储设备。所述存储器61用于存储所述计算机程序以及所述服务器所需的其他程序和数据。所述存储器61还可以用于暂时地存储已经输出或者将要输出的数据。The storage 61 may be an internal storage unit of the server 6, such as a hard disk or a memory of the server 6. The memory 61 may also be an external storage device of the server 6, for example, a plug-in hard disk, a smart media card (SMC), or a secure digital (SD) card equipped on the server 6. Flash Card, etc. Further, the memory 61 may also include both an internal storage unit of the server 6 and an external storage device. The memory 61 is used to store the computer program and other programs and data required by the server. The memory 61 can also be used to temporarily store data that has been output or will be output.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部的或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and conciseness of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned functions can be allocated to different functional units and modules as required. Module completion means dividing the internal structure of the device into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist alone physically, or two or more units can be integrated into one unit. The above-mentioned integrated units can be hardware-based Formal realization can also be realized in the form of software functional units. In addition, the specific names of the functional units and modules are only used to facilitate distinguishing each other, and are not used to limit the protection scope of the present application. For the specific working process of the units and modules in the foregoing system, reference may be made to the corresponding process in the foregoing method embodiment, which is not repeated here.
在本申请的示例性实施例中,还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现如上所述方法的步骤。可选的,该计算机可读存储介质可以是非易失性的存储介质,也可以是易失性的存储介质。In the exemplary embodiment of the present application, a computer-readable storage medium is also provided, and the computer-readable storage medium stores a computer program, and the computer program implements the steps of the above method when executed by a processor. Optionally, the computer-readable storage medium may be a non-volatile storage medium or a volatile storage medium.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail or recorded in an embodiment, reference may be made to related descriptions of other embodiments.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部的单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
所述集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部的或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中。If the integrated module/unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, this application implements all or part of the processes in the above-mentioned embodiments and methods, and can also be completed by instructing relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that it can still implement the foregoing The technical solutions recorded in the examples are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the application, and should be included in Within the scope of protection of this application.

Claims (20)

  1. 一种数据库的查询方法,其中,包括:A database query method, including:
    获取当前用于表征数据库中各数据集合关系的分类树模型,生成分类树模型中各节点的索引;Acquire the classification tree model currently used to characterize the relationship between each data set in the database, and generate the index of each node in the classification tree model;
    若接收到用于增加节点的节点更新请求,则从所述节点更新请求中提取出关键词,调取当前的所述分类树模型中各节点的描述信息,并基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新;If a node update request for adding a node is received, keywords are extracted from the node update request, and the description information of each node in the current classification tree model is retrieved based on the keywords and the Description information, to determine whether to update the current classification tree model;
    若判定对当前的所述分类树模型进行更新,则根据所述节点更新请求从所述分类树模型中选取一个节点作为被选节点,并为所述被选节点添加子节点,生成所述子节点的索引,以更新所述分类树模型;If it is determined to update the current classification tree model, a node is selected from the classification tree model as the selected node according to the node update request, and child nodes are added to the selected node to generate the child The index of the node to update the classification tree model;
    在接收到用户输入的查询指令后,若判定执行所述查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型。After receiving the query instruction input by the user, if it is determined to execute the query instruction, the target node is extracted from the query instruction, and the index of each node in the updated classification tree model is used to query and output The target node is a local classification tree model of the root node.
  2. 如权利要求1所述的数据库的查询方法,其中,所述生成分类树模型中各节点的索引,包括:5. The database query method according to claim 1, wherein said generating the index of each node in the classification tree model comprises:
    从当前的所述分类树模型中逐一选定除根节点以外的节点,将被选定的节点到所述根节点路径上的全部节点的ID,按照从根节点向下层节点的顺序进行组合,作为所述被选定的节点的索引,以在遍历当前的所述分类树模型中的除根节点以外的全部节点后,生成当前各节点的索引。Select nodes other than the root node from the current classification tree model one by one, and combine the IDs of all nodes on the path from the selected node to the root node in the order from the root node to the lower nodes, as The index of the selected node is used to generate the index of each current node after traversing all nodes except the root node in the current classification tree model.
  3. 如权利要求1所述的数据库的查询方法,其中,所述基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新,包括:The database query method according to claim 1, wherein the determining whether to update the current classification tree model based on the keywords and the description information comprises:
    统计所述关键词在各个节点的所述描述信息中的出现次数以各个所述描述信息中的词语总数;Counting the number of occurrences of the keywords in the description information of each node and the total number of words in each description information;
    计算所述当前的分类树模型中包含的节点的总数,作为第一节点数量,并统计所对应的描述信息中包含所述关键词的节点的数量,作为第二节点数量;Calculate the total number of nodes included in the current classification tree model as the number of first nodes, and count the number of nodes containing the keywords in the corresponding description information as the number of second nodes;
    通过公式:
    Figure PCTCN2020092811-appb-100001
    计算所述节点更新请求与各个节点的关联度,所述Y i为节点更新请求与所述分类树模型中的节点i的关联度,所述n i为所述关键词在节点i的所述描述信息中的出现次数,所述k i为节点i的描述信息中的词语总数,所述h为所述第一节点数量,所述b为所述第二节点数量;
    By formula:
    Figure PCTCN2020092811-appb-100001
    Calculate the degree of association between the node update request and each node, the Y i is the degree of association between the node update request and the node i in the classification tree model, and the n i is the keyword in the node i The number of occurrences in the description information, the k i is the total number of words in the description information of the node i, the h is the number of the first nodes, and the b is the number of the second nodes;
    若所述分类树模型中存在至少一个节点与所述更新请求的关联度不小于预设的关联度阈值,则判定不对当前的所述分类树模型进行更新;If the correlation degree between at least one node in the classification tree model and the update request is not less than a preset correlation degree threshold, it is determined not to update the current classification tree model;
    若所述分类树模型中所有节点与所述更新请求的关联度均小于预设的关联度阈值,则判定对当前的所述分类树模型进行更新。If the degree of association between all nodes in the classification tree model and the update request is less than a preset degree of association threshold, then it is determined to update the current classification tree model.
  4. 如权利要求3所述的数据库的查询方法,其中,所述根据所述节点更新请求从所述分类树模型中选取一个节点作为被选节点,包括:The database query method according to claim 3, wherein the selecting a node from the classification tree model as a selected node according to the node update request comprises:
    通过公式:
    Figure PCTCN2020092811-appb-100002
    计算所述节点更新请求归属于各个节点的归属系数,其中,所述W i表示所述节点更新请求归属于节点i的归属系数,所述Y i为节点更新请求与节点i的关联度,所述F i为节点更新请求与节点i的父节点的关联度,所述B i为节点更新请求与节点i的兄弟节点的关联度的平均值;
    By formula:
    Figure PCTCN2020092811-appb-100002
    Calculate the attribution coefficient of the node update request to each node, where W i represents the attribution coefficient of the node update request to node i, and the Y i is the degree of association between the node update request and node i, so The F i is the degree of association between the node update request and the parent node of node i, and the B i is the average of the degree of association between the node update request and the sibling nodes of node i;
    选取与所述节点更新请求的归属系数最高的节点作为被选节点。The node with the highest attribution coefficient of the node update request is selected as the selected node.
  5. 如权利要求1所述的数据库的查询方法,其中,在所述接收到用户输入的查询指令后,还包括:8. The database query method according to claim 1, wherein after said receiving the query instruction input by the user, the method further comprises:
    从所述查询指令中提取出目标节点以及用户信息;Extract the target node and user information from the query instruction;
    根据所述目标节点的所述描述信息识别出所述目标节点的权限阈值,并从所述用户信息中提取出用户权限等级;Identifying the authority threshold of the target node according to the description information of the target node, and extracting the user authority level from the user information;
    若所述用户权限等级不低于所述权限阈值,则判定执行所述查询指令;If the user authority level is not lower than the authority threshold, it is determined to execute the query instruction;
    若所述用户权限等级低于所述权限阈值,则判定不执行所述查询指令。If the user authority level is lower than the authority threshold, it is determined not to execute the query instruction.
  6. 如权利要求5所述的数据库的查询方法,其中,若判定不执行所述查询指令,则通过struct2拦截器对所述查询指令进行拦截,并将所述用户信息以及所述查询指令的对应关系存入历史拦截记录。The database query method according to claim 5, wherein if it is determined that the query instruction is not executed, the query instruction is intercepted by the struct2 interceptor, and the corresponding relationship between the user information and the query instruction Store in historical interception records.
  7. 如权利要求1所述的数据库的查询方法,其中,所述通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型,包括:5. The database query method according to claim 1, wherein the query and output of the local classification tree model with the target node as the root node through the index of each node in the updated classification tree model comprises:
    查询出所有包含所述目标节点的ID的索引,作为目标索引;Query all indexes containing the ID of the target node as the target index;
    将各个所述目标索引中在所述目标节点的ID之前的ID删除,得到一个以上的局部索引数据;Deleting the ID before the ID of the target node in each target index to obtain more than one local index data;
    拼合各条所述局部索引数据,得到用于表征所述局部分类树模型的局部索引数据集合;Combine each piece of the local index data to obtain a local index data set for representing the local classification tree model;
    根据所述局部索引数据集合,绘制并输出所述局部分类树模型。According to the local index data set, draw and output the local classification tree model.
  8. 一种数据库的查询装置,其中,所述装置包括:A database query device, wherein the device includes:
    获取模块,用于获取当前用于表征数据库中各数据集合关系的分类树模型,生成分类树模型中各节点的索引;The acquiring module is used to acquire the classification tree model currently used to characterize the relationship between the data sets in the database, and to generate the index of each node in the classification tree model;
    判断模块,用于若接收到用于增加节点的节点更新请求,则根据所述节点更新请求从所述节点更新请求中提取出多个关键词,调取当前的所述分类树模型中各节点的描述信息,并基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新;The judgment module is configured to, if a node update request for adding a node is received, extract multiple keywords from the node update request according to the node update request, and call each node in the current classification tree model , And based on the keywords and the description information, determine whether to update the current classification tree model;
    更新模块,用于若判定对当前的所述分类树模型进行更新,则从所述分类树模型中选取一个节点作为被选节点,并为所述被选节点添加一个子节点,生成所述子节点的索引,以更新所述分类树模型;The update module is configured to, if it is determined to update the current classification tree model, select a node from the classification tree model as the selected node, and add a child node to the selected node to generate the child The index of the node to update the classification tree model;
    查询模块,用于在接收到用户输入的查询指令后,若判定执行所述查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型。The query module is used to extract the target node from the query instruction if it is determined to execute the query instruction after receiving the query instruction input by the user, and pass the index of each node in the updated classification tree model, Query and output a local classification tree model with the target node as the root node.
  9. 一种服务器,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其中,所述处理器执行所述计算机程序时实现以下步骤:A server includes a memory, a processor, and a computer program that is stored in the memory and can run on the processor, wherein the processor implements the following steps when the processor executes the computer program:
    获取当前用于表征数据库中各数据集合关系的分类树模型,生成分类树模型中各节点的索引;Acquire the classification tree model currently used to characterize the relationship between each data set in the database, and generate the index of each node in the classification tree model;
    若接收到用于增加节点的节点更新请求,则从所述节点更新请求中提取出关键词,调取当前的所述分类树模型中各节点的描述信息,并基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新;If a node update request for adding a node is received, keywords are extracted from the node update request, and the description information of each node in the current classification tree model is retrieved based on the keywords and the Description information, to determine whether to update the current classification tree model;
    若判定对当前的所述分类树模型进行更新,则根据所述节点更新请求从所述分类树模型中选取一个节点作为被选节点,并为所述被选节点添加子节点,生成所述子节点的索引,以更新所述分类树模型;If it is determined to update the current classification tree model, a node is selected from the classification tree model as the selected node according to the node update request, and child nodes are added to the selected node to generate the child The index of the node to update the classification tree model;
    在接收到用户输入的查询指令后,若判定执行所述查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型。After receiving the query instruction input by the user, if it is determined to execute the query instruction, the target node is extracted from the query instruction, and the index of each node in the updated classification tree model is used to query and output The target node is a local classification tree model of the root node.
  10. 如权利要求9所述的服务器,其中,所述处理器在执行所述生成分类树模型中各节点的索引时,具体执行以下步骤:9. The server according to claim 9, wherein the processor specifically executes the following steps when executing the index of each node in the generated classification tree model:
    从当前的所述分类树模型中逐一选定除根节点以外的节点,将被选定的节点到所述根节点路径上的全部节点的ID,按照从根节点向下层节点的顺序进行组合,作为所述被选定 的节点的索引,以在遍历当前的所述分类树模型中的除根节点以外的全部节点后,生成当前各节点的索引。Select nodes other than the root node from the current classification tree model one by one, and combine the IDs of all nodes on the path from the selected node to the root node in the order from the root node to the lower nodes, as The index of the selected node is used to generate the index of each current node after traversing all nodes except the root node in the current classification tree model.
  11. 如权利要求9所述的服务器,其中,所述处理器在执行所述基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新时,具体执行以下步骤:9. The server according to claim 9, wherein the processor performs the following steps when determining whether to update the current classification tree model based on the keywords and the description information:
    统计所述关键词在各个节点的所述描述信息中的出现次数以各个所述描述信息中的词语总数;Counting the number of occurrences of the keywords in the description information of each node and the total number of words in each description information;
    计算所述当前的分类树模型中包含的节点的总数,作为第一节点数量,并统计所对应的描述信息中包含所述关键词的节点的数量,作为第二节点数量;Calculate the total number of nodes included in the current classification tree model as the number of first nodes, and count the number of nodes containing the keywords in the corresponding description information as the number of second nodes;
    通过公式:
    Figure PCTCN2020092811-appb-100003
    计算所述节点更新请求与各个节点的关联度,所述Y i为节点更新请求与所述分类树模型中的节点i的关联度,所述n i为所述关键词在节点i的所述描述信息中的出现次数,所述k i为节点i的描述信息中的词语总数,所述h为所述第一节点数量,所述b为所述第二节点数量;
    By formula:
    Figure PCTCN2020092811-appb-100003
    Calculate the degree of association between the node update request and each node, the Y i is the degree of association between the node update request and the node i in the classification tree model, and the n i is the keyword in the node i The number of occurrences in the description information, the k i is the total number of words in the description information of the node i, the h is the number of the first nodes, and the b is the number of the second nodes;
    若所述分类树模型中存在至少一个节点与所述更新请求的关联度不小于预设的关联度阈值,则判定不对当前的所述分类树模型进行更新;If the correlation degree between at least one node in the classification tree model and the update request is not less than a preset correlation degree threshold, it is determined not to update the current classification tree model;
    若所述分类树模型中所有节点与所述更新请求的关联度均小于预设的关联度阈值,则判定对当前的所述分类树模型进行更新。If the degree of association between all nodes in the classification tree model and the update request is less than a preset degree of association threshold, then it is determined to update the current classification tree model.
  12. 如权利要求11所述的服务器,其中,所述处理器在执行所述根据所述节点更新请求从所述分类树模型中选取一个节点作为被选节点时,具体执行以下步骤:The server according to claim 11, wherein the processor performs the following steps when performing the selecting a node from the classification tree model as the selected node according to the node update request:
    通过公式:
    Figure PCTCN2020092811-appb-100004
    计算所述节点更新请求归属于各个节点的归属系数,其中,所述W i表示所述节点更新请求归属于节点i的归属系数,所述Y i为节点更新请求与节点i的关联度,所述F i为节点更新请求与节点i的父节点的关联度,所述B i为节点更新请求与节点i的兄弟节点的关联度的平均值;
    By formula:
    Figure PCTCN2020092811-appb-100004
    Calculate the attribution coefficient of the node update request to each node, where W i represents the attribution coefficient of the node update request to node i, and the Y i is the degree of association between the node update request and node i, so The F i is the degree of association between the node update request and the parent node of node i, and the B i is the average of the degree of association between the node update request and the sibling nodes of node i;
    选取与所述节点更新请求的归属系数最高的节点作为被选节点。The node with the highest attribution coefficient of the node update request is selected as the selected node.
  13. 如权利要求9所述的服务器,其中,所述处理器在执行所述通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型时,具体执行以下步骤:The server according to claim 9, wherein the processor, after executing the index of each node in the classification tree model after the update, queries and outputs a local classification tree model with the target node as the root node When, perform the following steps:
    查询出所有包含所述目标节点的ID的索引,作为目标索引;Query all indexes containing the ID of the target node as the target index;
    将各个所述目标索引中在所述目标节点的ID之前的ID删除,得到一个以上的局部索引数据;Deleting the ID before the ID of the target node in each target index to obtain more than one local index data;
    拼合各条所述局部索引数据,得到用于表征所述局部分类树模型的局部索引数据集合;Combine each piece of the local index data to obtain a local index data set for representing the local classification tree model;
    根据所述局部索引数据集合,绘制并输出所述局部分类树模型。According to the local index data set, draw and output the local classification tree model.
  14. 如权利要求9所述的服务器,其中,所述处理器在执行所述接收到用户输入的查询指令后,还执行以下步骤:9. The server of claim 9, wherein the processor further executes the following steps after executing the query instruction input by the user:
    从所述查询指令中提取出目标节点以及用户信息;Extract the target node and user information from the query instruction;
    根据所述目标节点的所述描述信息识别出所述目标节点的权限阈值,并从所述用户信息中提取出用户权限等级;Identifying the authority threshold of the target node according to the description information of the target node, and extracting the user authority level from the user information;
    若所述用户权限等级不低于所述权限阈值,则判定执行所述查询指令;If the user authority level is not lower than the authority threshold, it is determined to execute the query instruction;
    若所述用户权限等级低于所述权限阈值,则判定不执行所述查询指令。If the user authority level is lower than the authority threshold, it is determined not to execute the query instruction.
  15. 如权利要求14所述的服务器,其中,所述处理器还执行以下步骤:The server of claim 14, wherein the processor further performs the following steps:
    若判定不执行所述查询指令,则通过struct2拦截器对所述查询指令进行拦截,并将所述用户信息以及所述查询指令的对应关系存入历史拦截记录。If it is determined that the query instruction is not executed, the query instruction is intercepted by the struct2 interceptor, and the corresponding relationship between the user information and the query instruction is stored in the historical interception record.
  16. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中, 所述计算机程序被处理器执行时实现以下步骤:A computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the following steps:
    获取当前用于表征数据库中各数据集合关系的分类树模型,生成分类树模型中各节点的索引;Acquire the classification tree model currently used to characterize the relationship between each data set in the database, and generate the index of each node in the classification tree model;
    若接收到用于增加节点的节点更新请求,则从所述节点更新请求中提取出关键词,调取当前的所述分类树模型中各节点的描述信息,并基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新;If a node update request for adding a node is received, keywords are extracted from the node update request, and the description information of each node in the current classification tree model is retrieved based on the keywords and the Description information, to determine whether to update the current classification tree model;
    若判定对当前的所述分类树模型进行更新,则根据所述节点更新请求从所述分类树模型中选取一个节点作为被选节点,并为所述被选节点添加子节点,生成所述子节点的索引,以更新所述分类树模型;If it is determined to update the current classification tree model, a node is selected from the classification tree model as the selected node according to the node update request, and child nodes are added to the selected node to generate the child The index of the node to update the classification tree model;
    在接收到用户输入的查询指令后,若判定执行所述查询指令,则从所述查询指令中提取目标节点,并通过更新后的所述分类树模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型。After receiving the query instruction input by the user, if it is determined to execute the query instruction, the target node is extracted from the query instruction, and the index of each node in the updated classification tree model is used to query and output The target node is a local classification tree model of the root node.
  17. 如权利要求16所述的计算机可读存储介质,其中,所述生成分类树模型中各节点的索引时,所述计算机程序被处理器执行以具体实现以下步骤:16. The computer-readable storage medium according to claim 16, wherein, when the index of each node in the classification tree model is generated, the computer program is executed by a processor to specifically implement the following steps:
    从当前的所述分类树模型中逐一选定除根节点以外的节点,将被选定的节点到所述根节点路径上的全部节点的ID,按照从根节点向下层节点的顺序进行组合,作为所述被选定的节点的索引,以在遍历当前的所述分类树模型中的除根节点以外的全部节点后,生成当前各节点的索引。Select nodes other than the root node from the current classification tree model one by one, and combine the IDs of all nodes on the path from the selected node to the root node in the order from the root node to the lower nodes, as The index of the selected node is used to generate the index of each current node after traversing all nodes except the root node in the current classification tree model.
  18. 如权利要求16所述的计算机可读存储介质,其中,所述基于所述关键词以及所述描述信息,判断是否对当前的所述分类树模型进行更新时,所述计算机程序被处理器执行以具体实现以下步骤:The computer-readable storage medium of claim 16, wherein the computer program is executed by a processor when determining whether to update the current classification tree model based on the keywords and the description information To implement the following steps:
    统计所述关键词在各个节点的所述描述信息中的出现次数以各个所述描述信息中的词语总数;Counting the number of occurrences of the keywords in the description information of each node and the total number of words in each description information;
    计算所述当前的分类树模型中包含的节点的总数,作为第一节点数量,并统计所对应的描述信息中包含所述关键词的节点的数量,作为第二节点数量;Calculate the total number of nodes included in the current classification tree model as the number of first nodes, and count the number of nodes containing the keywords in the corresponding description information as the number of second nodes;
    通过公式:
    Figure PCTCN2020092811-appb-100005
    计算所述节点更新请求与各个节点的关联度,所述Y i为节点更新请求与所述分类树模型中的节点i的关联度,所述n i为所述关键词在节点i的所述描述信息中的出现次数,所述k i为节点i的描述信息中的词语总数,所述h为所述第一节点数量,所述b为所述第二节点数量;
    By formula:
    Figure PCTCN2020092811-appb-100005
    Calculate the degree of association between the node update request and each node, the Y i is the degree of association between the node update request and the node i in the classification tree model, and the n i is the keyword in the node i The number of occurrences in the description information, the k i is the total number of words in the description information of the node i, the h is the number of the first nodes, and the b is the number of the second nodes;
    若所述分类树模型中存在至少一个节点与所述更新请求的关联度不小于预设的关联度阈值,则判定不对当前的所述分类树模型进行更新;If the correlation degree between at least one node in the classification tree model and the update request is not less than a preset correlation degree threshold, it is determined not to update the current classification tree model;
    若所述分类树模型中所有节点与所述更新请求的关联度均小于预设的关联度阈值,则判定对当前的所述分类树模型进行更新。If the degree of association between all nodes in the classification tree model and the update request is less than a preset degree of association threshold, then it is determined to update the current classification tree model.
  19. 如权利要求18所述的计算机可读存储介质,其中,所述根据所述节点更新请求从所述分类树模型中选取一个节点作为被选节点时,所述计算机程序被处理器执行以具体实现以下步骤:The computer-readable storage medium according to claim 18, wherein, when a node is selected from the classification tree model as a selected node according to the node update request, the computer program is executed by a processor to specifically implement The following steps:
    通过公式:
    Figure PCTCN2020092811-appb-100006
    计算所述节点更新请求归属于各个节点的归属系数,其中,所述W i表示所述节点更新请求归属于节点i的归属系数,所述Y i为节点更新请求与节点i的关联度,所述F i为节点更新请求与节点i的父节点的关联度,所述B i为节点更新请求与节点i的兄弟节点的关联度的平均值;
    By formula:
    Figure PCTCN2020092811-appb-100006
    Calculate the attribution coefficient of the node update request to each node, where W i represents the attribution coefficient of the node update request to node i, and the Y i is the degree of association between the node update request and node i, so The F i is the degree of association between the node update request and the parent node of node i, and the B i is the average of the degree of association between the node update request and the sibling nodes of node i;
    选取与所述节点更新请求的归属系数最高的节点作为被选节点。The node with the highest attribution coefficient of the node update request is selected as the selected node.
  20. 如权利要求16所述的计算机可读存储介质,其中,所述通过更新后的所述分类树 模型中各节点的索引,查询并输出以所述目标节点为根节点的局部分类树模型时,所述计算机程序被处理器执行以具体实现以下步骤:16. The computer-readable storage medium according to claim 16, wherein when the updated index of each node in the classification tree model is used to query and output the local classification tree model with the target node as the root node, The computer program is executed by the processor to specifically implement the following steps:
    查询出所有包含所述目标节点的ID的索引,作为目标索引;Query all indexes containing the ID of the target node as the target index;
    将各个所述目标索引中在所述目标节点的ID之前的ID删除,得到一个以上的局部索引数据;Deleting the ID before the ID of the target node in each target index to obtain more than one local index data;
    拼合各条所述局部索引数据,得到用于表征所述局部分类树模型的局部索引数据集合;Combine each piece of the local index data to obtain a local index data set for representing the local classification tree model;
    根据所述局部索引数据集合,绘制并输出所述局部分类树模型。According to the local index data set, draw and output the local classification tree model.
PCT/CN2020/092811 2019-07-03 2020-05-28 Database query method and apparatus, server and medium WO2021000671A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910594593.1 2019-07-03
CN201910594593.1A CN110471916B (en) 2019-07-03 2019-07-03 Database query method, device, server and medium

Publications (1)

Publication Number Publication Date
WO2021000671A1 true WO2021000671A1 (en) 2021-01-07

Family

ID=68507411

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/092811 WO2021000671A1 (en) 2019-07-03 2020-05-28 Database query method and apparatus, server and medium

Country Status (2)

Country Link
CN (1) CN110471916B (en)
WO (1) WO2021000671A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113535677A (en) * 2021-06-29 2021-10-22 平安国际融资租赁有限公司 Data analysis query management method and device, computer equipment and storage medium
CN117290893A (en) * 2023-09-25 2023-12-26 北京万里开源软件有限公司 Database access method and system based on data tag
CN117390015A (en) * 2023-09-27 2024-01-12 希维科技(广州)有限公司 Method and device for storing battery passport and storage medium
CN117290893B (en) * 2023-09-25 2024-06-11 北京万里开源软件有限公司 Database access method and system based on data tag

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110471916B (en) * 2019-07-03 2023-05-26 平安科技(深圳)有限公司 Database query method, device, server and medium
CN110990864B (en) * 2019-11-27 2023-01-10 支付宝(杭州)信息技术有限公司 Report authority management method, device and equipment
CN111144578B (en) * 2019-12-27 2023-07-28 创新奇智(重庆)科技有限公司 Artificial intelligence model management system and management method in distributed environment
CN111309371A (en) * 2020-01-14 2020-06-19 网易(杭州)网络有限公司 Query method and device
CN111488341B (en) * 2020-03-27 2023-08-22 北京金山云网络技术有限公司 Database index management method and device and electronic equipment
CN112035659A (en) * 2020-08-12 2020-12-04 北京字节跳动网络技术有限公司 Data processing method and device
CN112559530A (en) * 2020-12-22 2021-03-26 京东数字科技控股股份有限公司 Asset data statistical method, device, equipment and computer readable medium
CN112948385B (en) * 2021-03-02 2024-02-13 深圳大学 Display method and device for sequence data distribution, storage medium and terminal equipment
CN113505142B (en) * 2021-07-08 2022-06-24 中电金信软件有限公司 Data query method and device and server
CN114710562B (en) * 2022-03-31 2022-11-08 珠海市鸿瑞信息技术股份有限公司 Big data-based equipment application log correlation analysis system and method
CN114491172B (en) * 2022-04-07 2022-08-05 深圳竹云科技股份有限公司 Rapid retrieval method, device and equipment for tree structure nodes and storage medium
CN114996291B (en) * 2022-08-05 2022-11-11 中汽信息科技(天津)有限公司 Self-adaptive priority multi-level data updating method
CN116257657B (en) * 2022-12-30 2024-02-06 北京瑞莱智慧科技有限公司 Data processing method, data query method, related device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005103951A1 (en) * 2004-04-23 2005-11-03 Novauris Technologies Limited Tree index based method for accessing automatic directory
CN101706808A (en) * 2009-11-17 2010-05-12 中国科学院软件研究所 Index tree based huge database access control method
CN106649464A (en) * 2016-09-26 2017-05-10 深圳市数字城市工程研究中心 Method of building Chinese address tree and device
CN107807932A (en) * 2016-09-08 2018-03-16 腾讯科技(深圳)有限公司 A kind of hierarchical data management method and system based on path enumeration
CN110471916A (en) * 2019-07-03 2019-11-19 平安科技(深圳)有限公司 Querying method, device, server and the medium of database

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8046353B2 (en) * 2007-11-02 2011-10-25 Citrix Online Llc Method and apparatus for searching a hierarchical database and an unstructured database with a single search query
EP2682878A1 (en) * 2012-07-04 2014-01-08 Software AG Method of processing relational queries in a database system and corresponding database system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005103951A1 (en) * 2004-04-23 2005-11-03 Novauris Technologies Limited Tree index based method for accessing automatic directory
CN101706808A (en) * 2009-11-17 2010-05-12 中国科学院软件研究所 Index tree based huge database access control method
CN107807932A (en) * 2016-09-08 2018-03-16 腾讯科技(深圳)有限公司 A kind of hierarchical data management method and system based on path enumeration
CN106649464A (en) * 2016-09-26 2017-05-10 深圳市数字城市工程研究中心 Method of building Chinese address tree and device
CN110471916A (en) * 2019-07-03 2019-11-19 平安科技(深圳)有限公司 Querying method, device, server and the medium of database

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113535677A (en) * 2021-06-29 2021-10-22 平安国际融资租赁有限公司 Data analysis query management method and device, computer equipment and storage medium
CN113535677B (en) * 2021-06-29 2024-04-02 平安国际融资租赁有限公司 Data analysis query management method, device, computer equipment and storage medium
CN117290893A (en) * 2023-09-25 2023-12-26 北京万里开源软件有限公司 Database access method and system based on data tag
CN117290893B (en) * 2023-09-25 2024-06-11 北京万里开源软件有限公司 Database access method and system based on data tag
CN117390015A (en) * 2023-09-27 2024-01-12 希维科技(广州)有限公司 Method and device for storing battery passport and storage medium

Also Published As

Publication number Publication date
CN110471916B (en) 2023-05-26
CN110471916A (en) 2019-11-19

Similar Documents

Publication Publication Date Title
WO2021000671A1 (en) Database query method and apparatus, server and medium
US11281793B2 (en) User permission data query method and apparatus, electronic device and medium
US11055407B2 (en) Distribution-based analysis of queries for anomaly detection with adaptive thresholding
US11120019B2 (en) Adapting a relational query to accommodate hierarchical data
US20170199902A1 (en) Outlier detection for streaming data
CN112711591B (en) Data blood margin determination method and device based on field level of knowledge graph
WO2021052177A1 (en) Log parsing method and device, server and storage medium
US11580147B2 (en) Conversational database analysis
Yun et al. Fastraq: A fast approach to range-aggregate queries in big data environments
TWI686707B (en) Method and device for obtaining data inventory
US20150039623A1 (en) System and method for integrating data
US11595427B2 (en) Systems and methods for rapidly generating security ratings
CN110442602A (en) Data query method, apparatus, server and storage medium
US20170083617A1 (en) Posterior probabilistic model for bucketing records
US11163801B2 (en) Execution of queries in relational databases
US10191942B2 (en) Reducing comparisons for token-based entity resolution
US11720563B1 (en) Data storage and retrieval system for a cloud-based, multi-tenant application
US20230252140A1 (en) Methods and systems for identifying anomalous computer events to detect security incidents
WO2021030138A1 (en) Cost-based optimization for document-oriented database queries
US20220215021A1 (en) Data Query Method and Apparatus, Computing Device, and Storage Medium
US11216413B1 (en) Processing platform configured for data set management utilizing metadata-based data set operational signatures
US11847121B2 (en) Compound predicate query statement transformation
US11531665B2 (en) Automated database index management
CN113590650A (en) Feature expression based structured query statement discrimination method and device
US20150286700A1 (en) Recording medium having stored thereon database access control program, method for controlling database access, and information processing apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20834793

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20834793

Country of ref document: EP

Kind code of ref document: A1