CN-122019838-A - Data writing method, electronic device and computer readable storage medium
Abstract
The application discloses a data writing method, electronic equipment and a computer readable storage medium. The method comprises the steps of responding to creation of an initial mixed index according to data to be written in a data writing instruction, determining a first sub-index and a second sub-index in the initial mixed index according to initial sub-indexes in the initial mixed index and a preset graph database, wherein the preset graph database comprises preset entity data, preset attribute data and an index relation between the preset entity data and the preset attribute data, the attribute data in the first sub-index exists in the preset graph database, carrying out index state conversion processing on the first sub-index in the preset graph database until the first sub-index in an available state is obtained, determining a target mixed index in the available state based on the first sub-index and the second sub-index in the available state, and writing the data to be written in the preset graph database based on the target mixed index corresponding to the data to be written. Thereby, the success rate of data writing is improved.
Inventors
- DENG ZHIGUO
- ZHOU MINGWEI
- ZHU LINHAO
- YANG FUXING
- YU YI
- REN ZHIHONG
Assignees
- 浙江大华技术股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251224
Claims (10)
- 1. A method of writing data, the method comprising: in response to receiving a data writing instruction, creating an initial mixing index according to data to be written in the data writing instruction; Determining a first sub-index and a second sub-index in the initial mixing index according to each initial sub-index in the initial mixing index and a preset map database, wherein the preset map database comprises preset entity data, preset attribute data and an index relation between the preset entity data and the preset attribute data, the attribute data in the first sub-index exists in the preset map database, the preset entity data is used for describing objects and/or things, and the preset attribute data is used for describing the attributes of the objects and/or things; performing index state conversion processing on the first sub-index in the preset map database until a first sub-index in an available state is obtained; determining a target mix index of the available state based on the first sub-index of the available state and the second sub-index; And writing the data to be written into the preset graph database based on the target mixed index corresponding to the data to be written.
- 2. The method of claim 1, wherein the step of performing index state transition processing on the first sub-index until a first sub-index of an available state is obtained comprises: Performing initial conversion processing on the initial index state of the first sub-index to obtain a first sub-index after state conversion; and in response to the index state of the first sub-index after the state conversion being an unavailable state, performing conversion processing on the first sub-index after the state conversion again to obtain the first sub-index of the available state.
- 3. The method according to claim 2, wherein the initial index state includes an initial unavailable state and a registered state, and the step of performing an initial conversion process on the initial index state of the first sub-index to obtain a state-converted first sub-index includes: In response to an initial index state of the first sub-index being the initial unavailable state, transitioning the first sub-index from the initial unavailable state to the registered state; And in response to the first sub-index being in the registered state, converting the first sub-index from the registered state to the available state, and obtaining the first sub-index after the state conversion.
- 4. The method of claim 1, wherein the initial sub-index includes attribute data, and wherein the step of determining the first sub-index and the second sub-index in the initial mix index from each initial sub-index in the initial mix index and a preset map database comprises: Judging whether preset attribute data which is the same as the attribute data in the initial sub-index exists in the preset map database or not, and obtaining a judging result; determining a corresponding initial sub-index as the first sub-index in response to the determination that the characterization exists; And determining a corresponding initial sub-index as the second sub-index in response to the judging result representation does not exist.
- 5. The method of claim 1, wherein prior to the step of determining the first and second sub-indices of the initial mix index from the initial sub-indices of the initial mix index and a preset map database, the method further comprises: Judging whether each initial sub-index is a joint index according to attribute data in each initial sub-index in the initial mixed index; If yes, determining a sub-index associated with the joint index from the preset map database; The sub-index associated with the joint index is added to the initial sub-index of the hybrid index.
- 6. The method according to claim 1, wherein the data writing instruction includes target attribute data corresponding to the data to be written, and the step of creating an initial hybrid index for the data to be written in the data writing instruction includes: Creating an initial sub-index between the data to be written and each target attribute data; each initial sub-index is determined as the initial mix index.
- 7. The method of claim 1, wherein after the step of determining a target mix index of available states based on the first sub-index and the second sub-index of available states, the method further comprises: In response to receiving a data query instruction, determining a target mixed index corresponding to data to be queried from the preset map database according to the data to be queried in the data query instruction; And determining a query result from the preset map database based on the target mixed index corresponding to the data to be queried.
- 8. The method of claim 7, wherein after the step of determining query results from the preset map database based on the target mix index corresponding to the data to be queried, the method further comprises: comparing the query data in the query result with preset writing data to obtain a comparison result; And responding to the comparison result to represent that the query data is completely consistent with the preset writing data, and determining that the mixed index optimization is successful.
- 9. An electronic device comprising a memory and a processor, wherein the memory stores program instructions and the processor invokes the program instructions from the memory to perform the method of any of claims 1-8.
- 10. A computer readable storage medium comprising program data stored thereon, which when executed by a processor is adapted to carry out the method according to any one of claims 1-8.
Description
Data writing method, electronic device and computer readable storage medium Technical Field The present application relates to the field of data processing technologies, and in particular, to a data writing method, an electronic device, and a computer readable storage medium. Background JanusGraph (Jie Na Si map database) is a distributed map database, and can effectively support the query processing of large-scale map data and the services of knowledge map support and the like through indexes, wherein the use of the indexes is a key for improving the data query efficiency. When data is accessed JanusGraph, an Hbase (Hadoop Database) table is written first, and then the data with the index created is written, that is, written into an ES (distributed search engine). The existing data writing method generally creates a corresponding index according to the character string type data, and writes data based on the index. However, when creating a new index for an existing attribute in the graph database, the state of the index needs to be converted, and the state conversion process may cause the index to be in an unavailable state due to factors such as abnormal service, external operation and the like, so that data cannot be successfully written into the index after the index is created. Disclosure of Invention The application mainly solves the technical problem of providing a data writing method, electronic equipment and a computer readable storage medium so as to improve the success rate of data writing. In order to solve the technical problems, the application provides a data writing method, which comprises the steps of responding to a received data writing instruction, creating an initial mixed index according to data to be written in the data writing instruction, determining a first sub-index and a second sub-index in the initial mixed index according to all initial sub-indexes in the initial mixed index and a preset graph database, wherein the preset graph database comprises preset entity data, preset attribute data and an index relation between the preset entity data and the preset attribute data, the attribute data in the first sub-index exists in the preset graph database, the preset entity data is used for describing objects and/or things, the preset attribute data is used for describing the attributes of the objects and/or things, performing index state conversion processing on the first sub-index in the preset graph database until the first sub-index in an available state is obtained, determining a target mixed index in the available state based on the first sub-index and the second sub-index in the available state, and writing the attribute data in the preset graph database to the target mixed index to be written in the data base based on the target to be written. In an embodiment, the step of performing index state conversion processing on the first sub-index until a first sub-index of an available state is obtained includes performing initial conversion processing on an initial index state of the first sub-index to obtain a first sub-index after state conversion, and performing re-conversion processing on the first sub-index after state conversion to obtain the first sub-index of the available state in response to the index state of the first sub-index after state conversion being an unavailable state. In one embodiment, the initial index state includes an initial unavailable state and a registered state, and the step of performing initial conversion processing on the initial index state of the first sub-index to obtain a first sub-index after state conversion includes converting the first sub-index from the initial unavailable state to the registered state in response to the initial index state of the first sub-index being the initial unavailable state, and converting the first sub-index from the registered state to the available state in response to the first sub-index being the registered state, to obtain the first sub-index after state conversion. In one embodiment, the initial sub-index includes attribute data, and the step of determining a first sub-index and a second sub-index in the initial hybrid index according to each initial sub-index in the initial hybrid index and a preset map database includes judging whether preset attribute data identical to the attribute data in the initial sub-index exists in the preset map database to obtain a judging result, determining a corresponding initial sub-index as the first sub-index in response to the judging result representation exists, and determining a corresponding initial sub-index as the second sub-index in response to the judging result representation does not exist. In one embodiment, before the step of determining the first sub-index and the second sub-index in the initial mixing index according to the initial sub-indexes in the initial mixing index and the preset map database, the method further comprises judging whether each initial sub-i