The invention content is as follows:
the invention aims to provide a railway four-electricity digital engineering model establishing and storing method based on a NoSQL database.
In order to achieve the purpose, the invention adopts the technical scheme that:
a railway four-electricity digital engineering model establishing and storing method based on a NoSQL database is characterized in that: the method comprises the following steps:
s1, determining a logic structure of a NoSQL database, and determining four-level storage modes of a set, a document, a field and a key value;
s2, defining segment storage size of a railway four-electricity digital engineering model, and determining a basic method and means for segmenting a larger digital engineering model;
s3, carrying out format definition on the attribute information of the digital engineering model by using a JSON format under the NoSQL database, and storing the attribute information into the NoSQL database;
s4, establishing a storage engine index relation, and performing association processing on the digital engineering model stored in the NoSQL database and the attribute information of the digital engineering model;
s5, the insertion, updating, deletion and query performance of the four-electric digital engineering model result is realized, and the finally generated digital engineering model database of the NoSQL database is the final result of the model to be created and stored.
In step S1: determining the logical structure of a NoSQL database, wherein the NoSQL database consists of a set of sets, each set consists of any number of documents, each document consists of a series of custom fields, each field is a main key-value pair, wherein key is the name of the field, and value is the corresponding attribute value.
In step S2: for query quick response, the digital engineering model uses GridFS to segment a large file object into multiple small file segments, chunk, of 256 k/file segments, each of which will be stored as one document of the NoSQL database in a set of file segments.
In step S3: the basic data structure of the railway four-electricity digital engineering model under the NoSQL database is key: value, and is defined as follows:
{Guid:Object,
PGuid:Object,
Attribute:["property","geometry","compose","position",],}
in step S4: mapping the digital engineering model stored in the NoSQL database and the attribute information of the digital engineering model; annotating nodes and relationships with data attributes; the hierarchical relationship is unified in the document XML and JSON data model; the focus of the engineering digital model data model changes with the type of each NoSQL database, and the physical model and the logical data model are associated and mapped.
In step S6: establishing a storage engine index relationship, and establishing a unique index GUID field and a field of an association relation PGUID under the default condition; if the digital engineering model is divided into N segments, assigning the fields of the PGUID of the N segments to be the same unique identifier; a limited number of indexes are established, each index definition needs 8KB of space, and basic operation index relations of Update, Insert, Select, delete and the like are defined and realized.
Compared with the prior art, the invention has the following advantages and effects:
1. the railway four-electricity digital engineering is based on the NoSQL database, the relational characteristic of a complex relational database is removed, direct incidence relation does not exist among data, the expansion is very easy, and the expandable capability is brought on the level of architecture.
2. The invention has simple structure, realizes large data volume and high read-write performance, and particularly shows more obvious performance under the digital engineering of large data volume.
3. The invention establishes and stores a railway four-electrical engineering digital model based on NoSQL database technology, and stores the digital model by Key values (Key-Value). The storage process uses hash tables, each hash table has a specific Key and a pointer to point to specific data, and the Key-Value data model structure has the advantages of simplicity and easiness in deployment for an application system, and the digital engineering model has higher coupling degree with the attached information.
The specific implementation mode is as follows:
in order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The NoSQL database is a database technology newly developed in the process of dealing with big data problems, and compared with the traditional relational database, the NoSQL database data model is widely used due to the advantages of flexibility, high response speed, strong expandability and the like. In the field of railway four-electricity digital engineering, a digital engineering model and associated underlying structure data are created and stored, and the digital engineering model and the associated underlying structure data are core technologies for carrying out four-electricity digital engineering full-life-cycle application. The invention defines and stores the railway four-electric digital engineering model and related data in the NoSQL database, the NoSQL database can provide all functions required by meeting the requirements of high-performance time series application programs, and can rapidly analyze the model and present time series data to form the technical requirements required by delivering the time series application programs.
The invention comprises the following steps:
s1, determining a logic structure of the NoSQL database, and mainly determining four-level storage modes of a set, a document, a field and a key value;
s2, defining segment storage size of a railway four-electricity digital engineering model, and determining a basic method and means for segmenting a larger digital engineering model;
s3, carrying out format definition on the attribute information of the digital engineering model by using a JSON format under the NoSQL database, and storing the attribute information into the NoSQL database;
s4, establishing a storage engine index relation, and performing association processing on the digital engineering model stored in the NoSQL database and the attribute information of the digital engineering model;
s5, the insertion, updating, deletion and query performance of the four-electric digital engineering model result is realized, and the finally generated digital engineering model database of the NoSQL database is the final result of the model to be created and stored.
The steps are as follows:
in step S1: the logical structure of a NoSQL database is determined, wherein the NoSQL database consists of a group of collections (collections), each collection consists of any number of documents (documents), and each Document consists of a series of custom fields (fields), each Field is a main key-value pair (key-value pair), wherein key is the name of the Field, and value is the corresponding attribute value.
In step S2: to query for fast response, the digital engineering model uses GridFS to segment a large file object into multiple small chunks (file segments), typically 256 k/each, which will be stored as one document (document) of the NoSQL database in a chunk collection.
In step S3: the basic data structure of the railway four-electricity digital engineering model under the NoSQL database is (key: value), and is specifically defined as follows:
{Guid:Object,
PGuid:Object,
Attribute:["property","geometry","compose","position",],}
in step S4: and mapping the digital engineering model stored in the NoSQL database and the attribute information of the digital engineering model. The consistency of the relationships between the four-wire digital engineering digital model and the attribute data is concerned, so that the nodes and the relationships are annotated by using the data attributes, and the hierarchical relationships are unified in the document (XML and JSON) data model. The focus of the engineering digital model data model changes with the type of each NoSQL database and the physical model and logical data model are associated and mapped.
In step S6: establishing a storage engine index relationship, creating a unique index GUID field and a field of an incidence relation PGUID under the default condition in order to improve the query performance of a digital model field, and if the digital engineering model is divided into N segments, assigning the fields of the PGUIDs of the N segments to be the same unique identifier. Because indexes occupy a large amount of memory and also occupy a disk, a limited number of indexes need to be established, and preferably no duplicate indexes need to be established, each index defines the space of 8KB, and mainly defines and realizes the basic operation index relations of Update, Insert, Select, delete and the like.
Example (b):
the method comprises the following steps: and carrying out logic structure definition on the NoSQL database, and establishing and connecting the NoSQL database.
Step two: the segment storage size of the railway four-electricity digital engineering model is defined, and a basic method and a means for segmenting the digital engineering model with larger size are determined. It is specific to create two sets in the current database: the method comprises the steps of collecting fs.files and fs.chunks, wherein the fs.files and the fs.chunks are collected, and the fs.chunks are used for recording basic information such as names, creation time and types of digital engineering models; the latter block stores the binary data of the digital engineering model (and supports encrypting the binary data), and there is a "files _ id" key in "fs.chunks", which corresponds to "Guid" of "fs.files", and there is a key (int type) in "fs.chunks", which indicates the sequence of these blocks. The digital engineering model can be stored through the two sets. The digital analog data fragment after the fragmentation processing of the railway four-electric digital engineering is shown in figure 1.
Step three: and (3) carrying out format definition on the attribute information of the digital engineering model by using a JSON format under a NoSQL database. The definition and creation of the railway four-electric digital engineering and attribute information are shown in fig. 2.
The basic information is defined as follows:
{"Guid":ObjectId("51707CAA0-C83A-4288-94FF-CF3358A0F754"),
"project name" "high speed railway",
"project name" "Signal building communication machine room",
"Major": communication engineering ",
"Creation Date":"2021-5-31"}
the digital engineering entity attribute adopts embedded relation definition as follows
{"Guid":ObjectId("02D1A084-EC28-4909-ACA6-27288968BED1"),
"Entity":"987654321",
Attribute:["property","geometry","compose","position",],}
The logical relationship between the digital engineering entities adopts a reference formula as follows:
{"Guid":ObjectId("23A4478B-AB5C-4541-A832-B0C19BE4D076"),
"LogicalConnection":[
ObjectId("1707CAA0-C83A-4288-94FF-CF3358A0F754"),
ObjectId("1A18C185-B604-4221-BD1A-A8E521CF073A")]}
step four: and establishing an index relation between the digital engineering model and the attribute information of the digital engineering model in the NoSQL database. The implementation method comprises the following steps:
(1) ({ "Entity":1}), an index is created in the name key of the user set, where 1 represents the direction of creating the index and can take the values of 1 and-1.
(2) ({ "Entity":1, "Attribute":1}), a joint index of Entity and Attribute Attribute is created.
Step five: and (3) realizing the performance interface of inserting, updating, deleting and inquiring the four-electric digital engineering model result under the NoSQL database, wherein the finally generated digital engineering model database of the NoSQL database is the final result of the model to be created and stored by the program model.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all equivalent structural changes made by using the contents of the specification and the drawings of the present invention should be included in the scope of the present invention.