Disclosure of Invention
In view of the defects in the prior art, the present invention aims to provide a data access method for marking of an e-government system, which uses less storage space and has better access performance.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
a data access method for marking of an electronic government system comprises the following steps:
s1, classifying the objects in the E-government system according to the correlation among the object attributes, and describing the attributes of each class of objects by using a group of forms, wherein each form records a part of the attributes of the class of objects, each record in each form corresponds to one state of one object, and the objects are a group of data describing one object in the E-government system;
s2, establishing an object attribute table according to the state of the object in the E-government affair system, wherein the object attribute table comprises: a current state table, a history state table and a temporary state table;
and S3, accessing the data in the current state table, the historical state table or the temporary state table according to an access instruction input by a user.
Further, in the method for accessing data of a trace in an e-government system as described above, the step S3 includes:
s31, adding objects, changing attributes and deleting objects to the data in the current state table according to a first access instruction input by a user;
s32, adding objects, changing attributes and deleting objects to the data in the history state table according to a second access instruction input by the user;
and S33, after each object which is changing in the electronic government affair system is changed, deleting the corresponding record in the temporary state table.
Further, in the method for accessing data of a trace in an e-government system as described above, the step S1 further includes:
and when the number of the attributes of the object is lower than a preset value, defining all the attributes of the object in one form.
Further, according to the above-mentioned data access method for the traces of the e-government system, the current state table is used for storing the attribute values of the current state of the object, for each object currently existing in the e-government system, there is a unique record corresponding to the current state table, and a group of current state tables corresponding to the objects together determine the current state of the object.
Further, in the above-mentioned data access method for the leaves of the e-government system, in step S2, the creating a current status table includes:
a field is used for describing the time when the state of the part of the attribute of the object is updated or established;
and a field is used for describing the state update or establishing the corresponding event of the part of the attribute of the object.
Further, in the method for accessing data of a trace in an e-government system as described above, the step S31 includes:
when the first access instruction is to add a new object, inserting each attribute value of the new object into each current state table corresponding to the object;
when the first access instruction changes some attributes of an object, updating records corresponding to the object in each current state table corresponding to the attributes to be changed attribute values;
and when the first access instruction is to delete an object, all records corresponding to the object in each current state table corresponding to the object are deleted.
Further, according to the foregoing method for accessing data of an electronic government system trace, the historical state table is used for storing attribute values of each historical state of an object, and for each state of each object existing in the electronic government system, a record may correspond to each state, and a record may also correspond to a plurality of states of an object.
Further, in the above-mentioned data access method for the leaves of the e-government system, in step S2, the creating of the history status table includes:
describing the state change type of the object by using a field, wherein the state change type comprises an added object, an attribute change and a deleted object;
another field is used for describing the time of updating or establishing the state of the part of the attribute of the object;
and a field is used for describing the state update or establishing the corresponding event of the part of the attribute of the object.
Further, in the method for accessing data of a trace in an e-government system as described above, the step S32 includes:
when the second access instruction is to add a new object, inserting a new record in each history state table corresponding to the object, and marking the new record as new;
when the second access instruction is to change some attributes of an object, inserting a new record in each history state table corresponding to each changed attribute, recording the changed attribute value, marking the changed attribute value as changed, and not updating each history state table without attribute change;
and when the second access instruction is to delete an object, inserting a new record in each history state table corresponding to the object, and marking the record as deleted.
Further, the data access method for the electronic government system trace as described above, the temporary state table is used for temporarily storing the changing attribute in the course of one change of the object;
the electronic government affair system also comprises an attachment used for describing a data file of a certain attribute of the object, wherein the attachment is stored in a storage device in a compressed form of the data file, and the storage position and the file name of the attachment are stored in a corresponding object attribute table.
The invention has the beneficial effects that: the method provided by the invention can save the history state of the dynamically changed object in the e-government system, thereby realizing the trace and search of the dynamic data of the system, using less storage space and having better access performance.
Detailed Description
The invention is described in further detail below with reference to the drawings and the detailed description.
As shown in fig. 1, a method for accessing data marked by an e-government system includes:
s1, classifying the objects in the E-government system according to the correlation among the object attributes, and describing the attributes of each class of objects by using a group of forms, wherein each form records a part of the attributes of the class of objects, each record in each form corresponds to one state of one object, and the objects are a group of data describing a certain object in the E-government system;
s2, establishing an object attribute table according to the state of the object in the electronic government affair system, wherein the object attribute table comprises: a current state table, a history state table and a temporary state table;
and S3, accessing the data in the current state table, the historical state table or the temporary state table according to the access instruction input by the user.
Step S3 includes:
s31, adding objects, changing attributes and deleting objects to the data in the current state table according to a first access instruction input by a user;
s32, adding objects, changing attributes and deleting objects to the data in the history state table according to a second access instruction input by the user;
s33, after each object that is changing in the e-government system has changed, the corresponding record in the temporary status table is deleted.
Step S1 further includes:
and when the number of the attributes of the object is lower than a preset value, defining all the attributes of the object in one form.
The current state table is used for storing the attribute value of the current state of the object, each object currently existing in the e-government system has a unique record corresponding to the current state table, and a group of current state tables corresponding to the objects determine the current state of the object together.
In step S2, a current state table is established, which includes:
a field is used for describing the time when the state of the part of the attribute of the object is updated or established;
and a field is used for describing the state update or establishing the corresponding event of the part of the attribute of the object.
Step S31 includes:
when the first access instruction is to add a new object, inserting each attribute value of the new object into each current state table corresponding to the object;
when the first access instruction changes some attributes of an object, updating records corresponding to the object in each current state table corresponding to the attributes into changed attribute values;
and when the first access instruction is to delete one object, all records corresponding to the object in each current state table corresponding to the object are deleted.
The historical state table is used for storing attribute values of various historical states of the objects, and for each state of each object existing in the e-government system, one record corresponds to each state, and one record may also correspond to a plurality of states of one object.
In step S2, a history status table is created, including:
describing the state change type of the object by using a field, wherein the state change type comprises an added object, an attribute change and a deleted object;
another field is used for describing the time of updating or establishing the state of the part of the attribute of the object;
and a field is used for describing the state update or establishing the corresponding event of the part of the attribute of the object.
Step S32 includes:
when a second access instruction is to add a new object, inserting a new record in each history state table corresponding to the object, and marking the new record as new;
when the second access instruction is to change some attributes of an object, inserting a new record in each history state table corresponding to each changed attribute, recording the changed attribute value, marking the changed attribute value as changed, and not updating each history state table without attribute change;
and when the second access instruction is to delete an object, inserting a new record in each history state table corresponding to the object, and marking the record as deleted.
The temporary state table is used for temporarily storing the changing attributes in the one-time changing process of the object;
the electronic government affair system also comprises an attachment used for describing a data file of a certain attribute of the object, wherein the attachment is stored in a storage device in a compressed form of the data file, and the storage position and the file name of the attachment are stored in a corresponding object attribute table.
Example one
Taking a class of objects as an example, the specific processes of adding objects, changing objects, deleting objects and acquiring the states of the objects are described one by one.
As shown in table 1, the attributes of the object are divided into a plurality of attribute groups, such as attribute group a, attribute group B, attribute group C, and the like, where attribute group a includes attributes, such as attribute a1, attribute a2, attribute A3, and the like; the property group B comprises properties such as property B1, property B2, property B3 and the like; the property group C includes properties of property C1, property C2, property C3, and the like. The attributes of the object can be any type of numeric value, text, time, symbol, table, professional data, and the like.
The attribute group A corresponds to three object attribute tables of a current state table A, a historical state table A and a temporary state table A; the attribute group B corresponds to three object attribute tables of a current state table B, a historical state table B and a temporary state table B; the attribute group C corresponds to three object attribute tables of a current state table C, a historical state table C and a temporary state table C.
In this embodiment, the initial state of each object attribute table is null. The initial states of the current state tables corresponding to the attribute group A, B, C are shown in table 2, table 3, and table 4; the initial states of the history state tables corresponding to the attribute group A, B, C are shown in table 5, table 6, and table 7; the initial states of the temporary state tables corresponding to the attribute group A, B, C are shown in table 8, table 9, and table 10.
TABLE 1 object Attribute Structure
Table 2 current state table initial state for attribute group a
Table 3 current state table initial state of property group B
Table 4 current state table initial state of property group C
TABLE 5 History State Table initial State for Attribute group A
TABLE 6 History State Table initial State for Attribute group B
TABLE 7 History State Table initial State for Attribute group C
TABLE 8 temporary State Table initial State for Attribute group A
TABLE 9 temporary State Table initial State for Attribute group B
Table 10 temporary state table initial state for attribute set C
In this embodiment, when a new object is added, a new record is inserted into each history state table corresponding to each attribute group, each attribute value is stored in the new record, the change type field of the new record is set as "new", a new record is inserted into each current state table corresponding to each attribute group, and each attribute value is stored in the new record.
Optionally, when the current state table is not used, the above operation related to the current state table is omitted.
In this embodiment, after adding three objects 01, 02, and 03, the states of the object attribute tables corresponding to the attribute groups are as follows:
the states of the current state table corresponding to the attribute group A, B, C are shown in table 11, table 12, and table 13; the states of the history state tables corresponding to the attribute group A, B, C are shown in table 14, table 15, and table 16; the state of the temporary state table corresponding to the attribute group A, B, C is unchanged, as shown in tables 8, 9, and 10.
The newly added same object has the same update time and update event in the current state table and the historical state table corresponding to each attribute group.
Table 11 current state table a after adding objects
Table 12 current state table B after adding objects
Table 13 current state table C with three objects added
Table 14 History State table A after adding objects
Table 15 History State table B after adding objects
Table 16 History State table C after adding objects
In this embodiment, when an attribute of an object is changed, first, whether a record corresponding to the object already exists in a temporary state table corresponding to an attribute group to which the attribute belongs is searched for, if not, a record corresponding to the object is found in a current state table corresponding to the attribute group to which the attribute belongs, the record is inserted into the temporary state table, and then, the changed attribute value is updated to the record corresponding to the object in the temporary state table.
In this embodiment, when multiple attributes of an object are changed, the changed attribute values are sequentially updated to the record corresponding to the object in the temporary state table according to the above method, and when multiple attributes in the same attribute group are changed, the changed attribute values can be simultaneously updated to the record corresponding to the object in the temporary state table.
At the end of the state change of the object, finding out each record corresponding to the object in each temporary state table, inserting the record into each corresponding historical state table one by one, saving the corresponding update time and update event to the corresponding field of the new record, setting the change type field of the new record as 'change', updating the records to the records corresponding to the object in each corresponding current state table, and finally deleting all the records corresponding to the object in each temporary state table.
Optionally, when the temporary state table is not used, the above processing on the temporary state table is omitted, and the changed attribute values are directly inserted into the history state table and the current state table.
Optionally, when the current state table is not used, the operation on the current state table is omitted, and a record of the final state of the object is obtained from the historical state table instead.
In the process of changing the state of the object, if the change needs to be cancelled, all records corresponding to the object in each temporary state table are deleted.
In this embodiment, the states of two objects 01 and 02 are changed, wherein the attribute a1 of the object 01 is changed to 01a12, the attribute B1 of the object O2 is changed to 02B12, and the states of the object attribute tables corresponding to the attribute groups during and after the change are as follows:
during the change process, the state of the temporary state table corresponding to the attribute group a is shown in table 17; the state of the temporary state table corresponding to the attribute group B is shown in table 18; the temporary state table for attribute set C is unchanged as shown in table 10.
After the change, the current state table corresponding to property group A is shown in Table 19; the current state table corresponding to the attribute group B is shown in table 20; the current state table corresponding to the attribute group C is unchanged, as shown in table 13; the history state table corresponding to the attribute group a is shown in table 21; the history state table corresponding to the attribute group B is shown in table 22; the history state table corresponding to the attribute group C is unchanged, as shown in table 16; the temporary state table corresponding to the attribute group A, B, C is empty, as shown in tables 8, 9, and 10.
TABLE 17 temporary State table A in object Change Process
Table 18 temporary state table B during object change
Table 19 current state table a after object change
Table 20 current state table B after object change
Table 21 historical state table a after object change
Table 22 History State table B after object change
In this embodiment, when an object is deleted, a new record is inserted into each history state table corresponding to each attribute group, each attribute value is null, a change type field of the new record is set to "delete", and then a record corresponding to the object is searched in each current state table and deleted.
Optionally, when the current state table is not used, the above operation on the current state table is omitted.
In this embodiment, after the object 03 is deleted, the states of the object attribute tables corresponding to the attribute groups are as follows:
the states of the current state table corresponding to the attribute group A, B, C are shown in table 23, table 24, and table 25; the states of the history state tables corresponding to the attribute group A, B, C are shown in tables 26, 27, and 28; the temporary state table corresponding to the attribute group A, B, C is empty, as shown in tables 8, 9, and 10.
Table 23 current state table a after object deletion
Table 24 current state table B after object deletion
Table 25 current state table C after object deletion
Table 26 History State table A after object deletion
Table 27 History State table B after object deletion
Table 28 History State table C after object deletion
In this embodiment, the attachments are stored in the storage device in the form of data files, each attachment corresponds to an attribute of an object, and the attribute value is the storage location and the file name of the attachment. When the attachment is changed, the changed attachment is stored as a new data file, and the storage position and the file name of the new file are used as new attribute values to change the corresponding attribute according to the previous method; the attachments contained by the object are retained when the object is deleted.
In this embodiment, when the current state of an object is obtained, only the records corresponding to the object need to be searched by connecting each current state table. If only partial attributes of the object are acquired, only the current state tables to which the attributes belong need to be connected and searched.
Optionally, when the current state table is not used, each historical state table may be connected to search for a record corresponding to the object, where the latest update time is the current state of the object.
In this embodiment, when the history state of an object is obtained, each history state table is connected to look up a record corresponding to the object according to a given constraint condition. For example, to obtain the variation of object 0 from time T1 to time T2, the history status tables may be connected, and the condition time is limited to be greater than T1 and less than T2 to search all records of object 0. If only partial attributes of the object are acquired, only the historical state tables to which the attributes belong need to be connected and searched.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is intended to include such modifications and variations.