CN-116521800-B - Database construction method, database construction device, and readable storage medium
Abstract
The application discloses a database construction method, database construction equipment and a computer readable storage medium, wherein the method comprises the steps of obtaining a data stream and extracting entity data contained in the data stream; determining a corresponding basic table according to the data type of the entity data, adding the entity data to the basic table to generate node data, determining the child node type, the child node and the main node of the node data, and sequentially associating the main node, the child node type and the node data by taking the main node as a first level. The technical problems that new entity relations are required to be established when the types of the entity relations of the graph database are increased in the related art, and development cost is increased are solved, and the technical effects that when the entity or the relation is newly increased, only data are required to be adjusted and the type is specified, fields are not required to be newly increased, and development cost is reduced are achieved.
Inventors
- PAN XIAOKANG
- JIANG YUHUA
- Zhong Haoling
Assignees
- 深圳市极限网络科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20230407
Claims (6)
- 1. A database construction method, characterized in that the database construction method comprises: Acquiring a data stream to be processed, and determining nouns and character strings in the data stream based on semantic recognition, wherein the data stream is received entity data, relationship data and attribute data; taking the noun and the character string as entity data contained in the data stream; Acquiring a preset basic table, wherein the basic table is divided into a character string table and an integer table; Storing the entity value of the entity data into the basic table according to the data type of the entity data; defining identifiers of the basic table according to the upper attribute of the entity data to generate node data; Taking the upper attribute of the node data as the node type of the node data; Taking the upper attribute of the node type as a child node type; taking the upper attribute of the child node type as a child node; Taking the upper attribute of the child node as a main node; sequentially associating the main node, the sub-nodes, the sub-node types and the node data by taking the main node as a first level; the step of sequentially associating the master node, the child node type and the node data with the master node as a first hierarchy includes: The main node, the sub node type, the node data and the node type are taken as entities, and the association relation among the entities is determined; According to the association relation, taking the main node as a first level and the sub-node as a second level, sequentially taking the main node, the sub-node type, the node data and the node type as a chain association, wherein one chain association represents information of one entity data; After determining the chain association of all the entity data, integrating all the chain association into an entity display diagram in a mode that the master node is opposite to the master node and the other nodes are sequentially corresponding to each other.
- 2. The database construction method of claim 1, wherein the step of storing the entity value of the entity data into the base table according to the data type of the entity data comprises: determining a data value of the entity data; storing the entity data to the integer form when the data value is digital; And when the data value is not digital or is not all digital, storing the entity data into the character string table.
- 3. The method for constructing a database according to claim 1, wherein after the step of sequentially associating the master node, the child node type, and the node data with the master node as a first hierarchy, the method further comprises: after all the entity data in the data stream are associated, determining the main node, the sub node type, the node data and the node type of the entity data; and generating an entity display diagram based on the main node, the child node type, the node data and the node type.
- 4. The database construction method of claim 3, wherein after the step of generating an entity representation based on the master node, the child node type, the node data, and the node type is completed, further comprising: Determining an icon identifier for the entity representation; the icon identifiers and the entity representation are stored to a storage brain.
- 5. A database construction apparatus comprising a memory, a processor and a database construction program stored on the memory and executable on the processor, the processor implementing the steps of the database construction method according to any one of claims 1 to 4 when the database construction program is executed.
- 6. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a database construction program which, when executed by a processor, implements the steps of the database construction method according to any one of claims 1 to 4.
Description
Database construction method, database construction device, and readable storage medium Technical Field The present application relates to the field of database management, and in particular, to a database construction method, a database construction apparatus, and a computer-readable storage medium. Background The graph database is a data management system which takes points and edges as basic storage units and takes efficient storage and query graph data as design principles. In the graph database, the relationship between data and the data itself are equally important, and they are stored as part of the data. Currently, before using a graph database to store entity relationships, entity definition models, entity attribute models, associated entity models, and relationship definition models need to be created in advance for each type of data. Setting entity identifiers for each entity in the data to be stored, storing each entity attribute and entity identifier of at least one entity into an entity definition model and an entity attribute model respectively, determining entity relation data corresponding to the entity according to the relation definition model, and storing the entity relation data into an associated entity model. However, in the case where the types of entity relationships in the knowledge graph stored in the graph database are increased, it is generally necessary to establish new entity relationships, which increases additional development costs. Disclosure of Invention The embodiment of the application solves the technical problems that new entity relations are required to be established when the types of the entity relations of the graph database are increased in the related art and the development cost is increased by providing a database construction method, database construction equipment and computer readable storage medium, and further realizes the technical effects that when the entity or the relation is newly increased, only data are required to be adjusted and the types are specified, no new field is required to be added, and the development cost is reduced. The embodiment of the application provides a database construction method, which comprises the following steps: Acquiring a data stream and extracting entity data contained in the data stream; determining a corresponding basic table according to the data type of the entity data, and adding the entity data to the basic table to generate node data; determining the type of the child node, the child node and the main node of the node data; And sequentially associating the main node, the sub-node type and the node data by taking the main node as a first level. Optionally, the step of obtaining a data stream and extracting entity data contained in the data stream includes: Acquiring the data stream to be processed, and determining nouns and character strings in the data stream based on semantic recognition; and taking the noun and the character string as the entity data. Optionally, the step of determining a corresponding base table according to the data type of the entity data, and adding the entity data to the base table to generate node data includes: Acquiring a preset basic table, wherein the basic table is divided into a character string table and an integer table; Storing the entity value of the entity data into the basic table according to the data type of the entity data; and defining identifiers of the basic table according to the upper attribute of the entity data to generate the node data. Optionally, the step of storing the entity value of the entity data in the base table according to the data type of the entity data includes: determining a data value of the entity data; storing the entity data to the integer form when the data value is digital; And when the data value is not digital or is not all digital, storing the entity data into the character string table. Optionally, the step of determining the child node type of the node data and the master node includes: Taking the upper attribute of the node data as the node type of the node data; taking the upper attribute of the node type as the child node type; Taking the upper attribute of the child node type as the child node; and taking the upper attribute of the child node as the main node. Optionally, the step of sequentially associating the master node, the child node type, and the node data with the master node as the first hierarchy includes: The main node, the sub node type, the node data and the node type are taken as entities, and the association relation among the entities is determined; and according to the association relation, the main node is used as a first level, the sub-nodes are used as a second level, and the main node, the sub-nodes, the sub-node types, the node data and the node types are sequentially associated. Optionally, after the step of sequentially associating the master node, the child node type, and the node data with the master node as t