Disclosure of Invention
The invention aims to provide a ship data index establishing method, a loading device and computer equipment, which can improve the storage and reading speed and reduce the maintenance cost after data change.
The purpose of the invention is realized by the following technical scheme:
a ship data index building method, the method comprising:
acquiring signal point data of a ship and attribute information of the signal point data;
storing the signal point data to a first database and acquiring a storage position corresponding to the signal point data;
and establishing an index relationship between the storage position and the attribute information according to the storage position and the attribute information.
In one embodiment, the obtaining of the signal point data of the ship and the attribute information of the signal point data includes:
acquiring initial signal point data and attribute information corresponding to the initial signal point data, and performing binary conversion on the initial signal point data to obtain preprocessed signal point data;
and inquiring a target compression ratio corresponding to the target attribute information stored in a second database, compressing the preprocessed signal point data according to the inquired compression ratio to obtain signal point data, and taking the attribute information corresponding to the initial signal point data as the attribute information of the signal point data.
In one embodiment, the attribute information includes name information and category information, and the establishing an index relationship between the storage location and the attribute information includes:
and establishing a first index relation among the storage position, the name information and the category information.
In one embodiment, the attribute information further includes an initial signal point data obtaining time and initial signal point data source information, and the establishing an index relationship between the storage location and the attribute information further includes:
and establishing a second index relationship among the storage position, the name information, the initial signal point data acquisition time and the initial signal point data source information.
A method for loading data stored by using the ship data index building method comprises the following steps:
acquiring target attribute information of target signal point data, and inquiring a target storage position corresponding to the target attribute information by combining an index relation between the attribute information and the storage position and the target attribute information;
and extracting target signal point data corresponding to the target storage position and stored in a first database.
In one embodiment, the method further comprises:
inquiring a target compression ratio which is stored in a second database and corresponds to the target attribute information;
decompressing the target signal point data according to the inquired target compression ratio to obtain target preprocessing signal point data, and performing reverse binary conversion on the target preprocessing signal point data to obtain target initial signal point data of the ship.
An apparatus for data index creation, the apparatus comprising:
the system comprises a first acquisition module, a first storage module and a second storage module, wherein the first acquisition module is used for acquiring signal point data of a ship and attribute information of the signal point data, storing the signal point data to a first database and acquiring a storage position corresponding to the signal point data;
and the index establishing module is used for establishing an index relation between the storage position and the attribute information according to the storage position and the attribute information.
A data loading apparatus, the apparatus comprising:
the second acquisition module is used for acquiring target attribute information of the target signal point data, and inquiring a target storage position corresponding to the target attribute information by combining the index relationship between the attribute information and the storage position and the target attribute information;
and the third acquisition module is used for extracting the target signal point data which is stored in the first database and corresponds to the target storage position.
A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor when executing the computer program implements the steps of:
acquiring signal point data of a ship and attribute information of the signal point data, storing the signal point data to a first database and acquiring a storage position corresponding to the signal point data;
and establishing an index relationship between the storage position and the attribute information according to the storage position and the attribute information.
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of:
acquiring signal point data of a ship and attribute information of the signal point data, storing the signal point data to a first database and acquiring a storage position corresponding to the signal point data;
and establishing an index relationship between the storage position and the attribute information according to the storage position and the attribute information.
According to the scheme of the invention, the method comprises the steps of acquiring signal point data of a ship and attribute information of the signal point data, storing the signal point data to a first database and acquiring a storage position corresponding to the signal point data; and establishing an index relationship between the storage position and the attribute information according to the storage position and the attribute information, wherein the storage structure in the first database is the index relationship between the storage position of each signal point data and the attribute information of the signal point data, and when new signal point data is stored or the signal point data is updated, only the signal point data needs to be newly added or the updated signal point data needs to be modified, the storage structure of the first database does not need to be modified, the storage and reading speed can be improved, and the maintenance problem after the data is changed is reduced.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the detailed description and specific examples, while indicating the scope of the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.
Fig. 1 is a schematic diagram of an internal structure of a server in one embodiment. The server comprises a processor, a nonvolatile storage medium, a network interface, an internal memory and an input device which are connected through a system bus. The non-volatile storage medium of the server is provided with an operating system, and the server further comprises a data index establishing device, wherein the data index establishing device is used for realizing a ship data index establishing method. The processor is used for providing calculation and control capacity and supporting the operation of the whole server. The internal memory in the server provides an environment for the operation of the data index establishing device in the nonvolatile storage medium, and the network interface is used for communicating with other servers or terminals, such as when the server responds to a click operation, a control command can be generated and sent to other servers or terminals, and the like. The input device is a keyboard, a mouse or a touch screen. Specifically, a server acquires signal point data of a ship and attribute information of the signal point data, stores the signal point data to a first database and acquires a storage position corresponding to the signal point data; and establishing an index relationship between the storage position and the attribute information according to the storage position and the attribute information. The server may be implemented by an independent server or a server cluster composed of a plurality of servers. Those skilled in the art will appreciate that the ship data index establishing method provided by the present application may be applied not only to the application environment shown in fig. 1, but also to various computers or servers.
In an embodiment, as shown in fig. 2, a ship data index establishing method is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps:
step S101, acquiring signal point data of a ship and attribute information of the signal point data;
step S102, storing the signal point data to a first database and acquiring a storage position corresponding to the signal point data;
specifically, a storage location flag may be set for the storage location, and the storage location may also be obtained by obtaining the target storage path.
Step S103, establishing an index relationship between the storage position and the attribute information according to the storage position and the attribute information.
Specifically, the storage structure in the first database is an index relationship between the storage location of each signal point data and the attribute information of the signal point data, and when new signal point data is stored or when the signal point data is updated, only new signal point data needs to be added or the updated signal point data needs to be modified, and the storage structure of the first database does not need to be modified.
In the ship data index establishing method, signal point data of a ship and attribute information of the signal point data are obtained, the signal point data are stored in a first database, and a storage position corresponding to the signal point data is obtained; and establishing an index relationship between the storage position and the attribute information according to the storage position and the attribute information, wherein the storage structure in the first database is the index relationship between the storage position of each signal point data and the attribute information of the signal point data, and when new signal point data is stored or the signal point data is updated, only the signal point data needs to be newly added or the updated signal point data needs to be modified, the storage structure of the first database does not need to be modified, the storage and reading speed can be improved, and the maintenance problem after the data is changed is reduced.
In one embodiment, as shown in fig. 3, the obtaining of the signal point data of the ship and the attribute information of the signal point data includes:
step S1011, acquiring initial signal point data of a ship and attribute information corresponding to the initial signal point data, and performing binary conversion on the initial signal point data to obtain preprocessed signal point data;
specifically, the initial signal point data is subjected to binary conversion, and after the binary conversion, the compression can improve the storage and reading speed and reduce the occupied space.
Step S1012, querying a target compression ratio corresponding to the target attribute information stored in the second database, compressing the preprocessed signal point data according to the queried compression ratio to obtain signal point data, and using the attribute information corresponding to the initial signal point data as the attribute information of the signal point data.
Specifically, the second database stores attribute information of a plurality of signal point data and compression ratios corresponding to the attribute information.
For example, the initial signal point data is data transmitted from a ship end, the attribute of the initial signal point data includes two types of switching value and analog value, and since the data amounts of the switching value data and the analog value data are different, the compression rate of the switching value data is one byte for eight switching value data, and the compression rate of the analog value data is four bytes for each analog value data.
In one embodiment, the attribute information includes name information and category information, and the establishing an index relationship between the storage location and the attribute information includes: and establishing a first index relation among the storage position, the name information and the category information.
Specifically, when the initial signal point data changes, the category information still belongs to the original category, and the set first index relationship structure does not need to be changed to store data, for example, when the ship signal point changes, the signal category still can only be an analog quantity or a switching quantity, so that the first index structure stored in the first database is not required to be changed to store corresponding data, and only the corresponding signal point data needs to be modified.
In one embodiment, the attribute information further includes an initial signal point data obtaining time and initial signal point data source information, and the establishing an index relationship between the storage location and the attribute information further includes: and establishing a second index relationship among the storage position, the name information, the initial signal point data acquisition time and the initial signal point data source information.
Specifically, a second index relationship between the storage location, the name information, the initial signal point data acquisition time and the initial signal point data source information is established, so that initial signal point data corresponding to a preset time period or a specified data source such as a specified ship can be conveniently inquired.
In one embodiment, as shown in fig. 4, there is provided a method for loading data stored by using the ship data index building method according to the foregoing embodiment, where the method includes:
step S401, acquiring target attribute information of target signal point data, and inquiring a target storage position corresponding to the target attribute information by combining the index relationship between the attribute information and the storage position and the target attribute information;
step S402, extracting target signal point data which is stored in a first database and corresponds to the target storage position.
For example, the name information is "ship end signal point unit", the corresponding type information is "analog quantity", and the corresponding signal point data can be extracted by only inquiring the storage location corresponding to the name "ship end signal point unit" with the type of "analog quantity".
In one embodiment, as shown in fig. 5, the method further includes:
step S403, inquiring a target compression rate stored in a second database and corresponding to the target attribute information;
specifically, the second database stores a plurality of pieces of attribute information and compression ratios corresponding to the pieces of attribute information.
And S404, decompressing the target signal point data according to the inquired target compression rate to obtain target preprocessing signal point data, and performing reverse binary conversion on the target preprocessing signal point data to obtain target initial signal point data of the ship.
Specifically, the second database stores a plurality of pieces of attribute information and compression ratios corresponding to the pieces of attribute information.
For example, the initial signal point data is data transmitted from a ship end, the attribute of the initial signal point data includes two types of switching value and analog value, and since the data amounts of the switching value data and the analog value data are different, the compression rate of the switching value data is one byte for eight switching value data, and the compression rate of the analog value data is four bytes for each analog value data.
In one embodiment, the querying the storage location corresponding to the attribute information according to the index relationship between the attribute information and the storage location includes: and acquiring name information and category information, and inquiring storage positions corresponding to the name information and the category information according to the name information, the category information and the first index relation.
Specifically, the storage location may be queried through name information and category information, or may be queried through name information, initial signal point data acquisition time, and initial signal point data source information.
In one embodiment, the querying the storage location corresponding to the attribute information according to the index relationship between the attribute information and the storage location further includes: and inquiring storage positions corresponding to the name information, the initial signal point data acquisition time and the initial signal point data source information according to the name information, the initial signal point data acquisition time, the initial signal point data source information and the second index relation.
It should be understood that although the various steps in the flow charts of fig. 2-5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 6, there is provided a data index creating apparatus, including:
a first obtainingmodule 601, configured to obtain signal point data of a ship and attribute information of the signal point data;
astorage module 602, configured to store the signal point data in a first database and obtain a storage location corresponding to the signal point data;
anindex establishing module 603, configured to establish an index relationship between the storage location and the attribute information according to the storage location and the attribute information.
In one embodiment, as shown in fig. 7, the first obtainingmodule 601 includes:
a first obtainingunit 6011, configured to obtain initial signal point data and attribute information corresponding to the initial signal point data, and perform binary conversion on the initial signal point data to obtain preprocessed signal point data;
a second obtainingunit 6012, configured to query a target compression ratio stored in the second database and corresponding to the target attribute information, compress the preprocessed signal point data according to the queried compression ratio to obtain signal point data, and use attribute information corresponding to the initial signal point data as attribute information of the signal point data.
In one embodiment, the attribute information includes name information and category information, and theindex creating module 603 is specifically configured to create a first index relationship among the storage location, the name information, and the category information.
In one embodiment, the attribute information further includes an initial signal point data obtaining time and initial signal point data source information, and theindex establishing module 603 is further specifically configured to establish a second index relationship among the storage location, the name information, the initial signal point data obtaining time, and the initial signal point data source information.
In one embodiment, as shown in fig. 8, there is provided a data loading apparatus, the apparatus comprising:
a second obtainingmodule 801, configured to obtain target attribute information of target signal point data, and query a target storage location corresponding to the target attribute information by using an index relationship between the attribute information and the storage location and the target attribute information;
adata extracting module 802, configured to extract target signal point data stored in the first database and corresponding to the target storage location.
In one embodiment, as shown in fig. 9, the apparatus further includes:
thequery module 803 is configured to query a target compression rate stored in the second database and corresponding to the target attribute information;
a third obtainingmodule 804, configured to decompress the target signal point data according to the queried target compression rate to obtain target preprocessed signal point data, and perform reverse binary conversion on the target preprocessed signal point data to obtain target initial signal point data of the ship.
In one embodiment, the second obtainingmodule 801 is specifically configured to obtain name information and category information, and query a storage location corresponding to the name information and the category information according to the name information, the category information, and the first index relationship.
In one embodiment, the second obtainingmodule 801 is further configured to obtain name information, initial signal point data obtaining time, and initial signal point data source information, and query storage locations corresponding to the name information, the initial signal point data obtaining time, the initial signal point data source information, and the second index relationship according to the name information, the initial signal point data obtaining time, the initial signal point data source information, and the second index relationship.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 10. The computer apparatus includes a processor, a memory, a network interface, and a database connected by a device bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The nonvolatile storage medium stores an operating device, a computer program, and a database. The internal memory provides an environment for the operation device in the nonvolatile storage medium and the execution of the computer program. The database of the computer device is used for storing data related to data index establishment. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a ship data index building method.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 11. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a ship data index building method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the configurations shown in fig. 10-11 are only block diagrams of some of the configurations relevant to the present disclosure, and do not constitute a limitation on the computing devices to which the present disclosure may be applied, and that a particular computing device may include more or less components than shown in the figures, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program: acquiring signal point data of a ship and attribute information of the signal point data, storing the signal point data to a first database and acquiring a storage position corresponding to the signal point data; and establishing an index relationship between the storage position and the attribute information according to the storage position and the attribute information.
In one embodiment, the obtaining of the signal point data of the ship and the attribute information of the signal point data when the processor executes the computer program comprises: acquiring initial signal point data and attribute information corresponding to the initial signal point data, and performing binary conversion on the initial signal point data to obtain preprocessed signal point data; and inquiring a target compression ratio corresponding to the target attribute information stored in a second database, compressing the preprocessed signal point data according to the inquired compression ratio to obtain signal point data, and taking the attribute information corresponding to the initial signal point data as the attribute information of the signal point data.
In one embodiment, the attribute information includes name information and category information when the processor executes the computer program, and the establishing the index relationship between the storage location and the attribute information includes: and establishing a first index relation among the storage position, the name information and the category information.
In one embodiment, the processor executes the computer program, where the attribute information further includes an initial signal point data obtaining time and initial signal point data source information, and the establishing the index relationship between the storage location and the attribute information further includes: and establishing a second index relationship among the storage position, the name information, the initial signal point data acquisition time and the initial signal point data source information.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program: acquiring target attribute information of target signal point data, and inquiring a target storage position corresponding to the target attribute information by combining an index relation between the attribute information and the storage position and the target attribute information; and extracting target signal point data corresponding to the target storage position and stored in a first database.
In one embodiment, the method further comprises, when the computer program is executed by the processor: inquiring a target compression ratio which is stored in a second database and corresponds to the target attribute information; decompressing the target signal point data according to the inquired target compression ratio to obtain target preprocessing signal point data, and performing reverse binary conversion on the target preprocessing signal point data to obtain target initial signal point data of the ship.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring signal point data of a ship and attribute information of the signal point data, storing the signal point data to a first database and acquiring a storage position corresponding to the signal point data; and establishing an index relationship between the storage position and the attribute information according to the storage position and the attribute information.
In one embodiment, the computer program, when executed by a processor, is configured to obtain signal point data of a ship and attribute information of the signal point data, and the method includes: acquiring initial signal point data and attribute information corresponding to the initial signal point data, and performing binary conversion on the initial signal point data to obtain preprocessed signal point data; and inquiring a target compression ratio corresponding to the target attribute information stored in a second database, compressing the preprocessed signal point data according to the inquired compression ratio to obtain signal point data, and taking the attribute information corresponding to the initial signal point data as the attribute information of the signal point data.
In one embodiment, the computer program, when executed by the processor, includes name information and category information, and the establishing an index relationship between the storage location and the attribute information includes: and establishing a first index relation among the storage position, the name information and the category information.
In one embodiment, the computer program when executed by the processor, the attribute information further comprises an initial signal point data acquisition time and initial signal point data source information, and the establishing an index relationship between the storage location and the attribute information further comprises: and establishing a second index relationship among the storage position, the name information, the initial signal point data acquisition time and the initial signal point data source information.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring target attribute information of target signal point data, and inquiring a target storage position corresponding to the target attribute information by combining an index relation between the attribute information and the storage position and the target attribute information; and extracting target signal point data corresponding to the target storage position and stored in a first database.
In one embodiment, the computer program when executed by the processor further comprises: inquiring a target compression ratio which is stored in a second database and corresponds to the target attribute information; decompressing the target signal point data according to the inquired target compression ratio to obtain target preprocessing signal point data, and performing reverse binary conversion on the target preprocessing signal point data to obtain target initial signal point data of the ship.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.