Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a method of updating an object, it being noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than that presented herein.
Fig. 1 is a flowchart of a method for updating an object according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, whether the attribute type of the target object is increased or not is detected based on a preset database table and object information of the preset object under a preset platform, wherein the preset database table is provided with a plurality of redundant columns, and each row of data of the preset database table forms one target object.
In step S102, the preset database table may be a table in a database, where each column in the preset database table corresponds to a data type, for example, a string type, a numeric type, or the like. Optionally, other columns in the preset database table except for the columns already having the attribute type are redundant columns, for example, in table 2, the 1 st to 5 th columns all have corresponding attribute types, and the 6 th column has no corresponding attribute type, and the 6 th column is a redundant column. In addition, each redundant column has a corresponding data type, for example, the data type of column 6 is numeric type, and the data type of column 7 is string type. In the preset database table, the other columns except the redundant column are provided with corresponding data types, and the data type of each redundant column can be set by itself.
TABLE 2
1
|
2
|
3
|
4
|
5
|
6
|
7
|
Nickname
|
Sex
|
State of the country
|
Province of labor
|
City
|
|
|
Xiaoxian (Chinese character)
|
For male
|
China
|
Guangdong (Chinese character of Guangdong)
|
Shenzhen (Shenzhen medicine)
|
|
|
In addition, in step S102, the target object is an object composed of attribute data of the same fan under multiple preset platforms, where data of each line of the preset database table is composed as one target object. The preset platform can be an instant communication platform, a shopping platform and the like. The preset object may be a fan concerning a preset platform, for example, a fan concerning a WeChat public number. The object information of the preset object may include, but is not limited to, an object identification (e.g., a nickname, a micro signal, an avatar, an associated phone number, etc.), an object browsing record (e.g., a record of browsing an article under a micro signal public number), a degree of attention (e.g., a degree of attention under a microblog scene), a spaghetti amount, and the like.
Optionally, the attribute type of each fan under each preset platform may be compared with the attribute type of the target object, and if the attribute type of the target object does not include a certain attribute type of the fan corresponding to the target object under a certain preset platform, it may be determined that the attribute type of the target object is increased. For example, if fan a is a fan corresponding to the target object in table 2, and fan a has the attribute of the constellation under the wechat public number, it may be determined that the attribute type of the target object is increased.
Step S104, in the case of detecting the attribute type of the target object to be increased, acquiring the increased attribute type.
Still taking table 2 as an example, the fan a is the fan corresponding to the target object in table 2, and the fan a also has the attribute of "constellation" under the wechat public number, it can be determined that the attribute type of the target object is increased, and the increased attribute type "constellation" is extracted.
And step S106, updating a mapping record table based on the added attribute types, wherein the mapping record table stores the mapping relation between each attribute type of the target object and the corresponding column in the preset database table.
Optionally, table 3 shows an alternative mapping record table, where a first column of the table represents the attribute type of the target object, and a second column is a column of the attribute type in the preset database table, for example, a "nickname" is an attribute type in the first column in the preset database table. In addition, in the case that it is determined that the attribute type of the target object is increased, the increased attribute type and the column index corresponding to the column in the preset database table are filled in the mapping record table, for example, in table 3, "constellation" is the newly increased attribute type, and the column index in the preset database table is 7.
TABLE 3
Nickname
|
1
|
Sex
|
2
|
State of the country
|
3
|
Province of labor
|
4
|
City
|
5
|
Constellation
|
7 |
It should be noted that the mapping record table may be a table in the preset database. In addition, table 3 above is only an example of the mapping record table, and the mapping record table is not limited to the form shown in table 3 in practical application, and may be in other forms.
And step S108, mapping the attribute value corresponding to the added attribute type to a preset database table based on the mapping record table.
Optionally, after the mapping record table is updated, the position of the added attribute type in the preset database table may be determined through the updated mapping record table, and then the attribute value corresponding to the added attribute type is extracted from the fan data, for example, the attribute value corresponding to the "constellation" is extracted from the fan data, and the attribute value is mapped to the preset database table, so that the preset database table may be as shown in table 4.
TABLE 4
1
|
2
|
3
|
4
|
5
|
6
|
7
|
Nickname
|
Sex
|
State of the country
|
Province of labor
|
City
|
|
Constellation
|
Xiaoxian (Chinese character)
|
For male
|
China
|
Guangdong (Chinese character of Guangdong)
|
Shenzhen (Shenzhen medicine)
|
|
Aries seat |
Based on the schemes defined in steps S102 to S108, it can be known that, by using a manner of mapping and recording the fan attributes and the client attributes, whether the attribute types of the target object are increased is detected based on the preset database table and the object information of the preset object under the preset platform, when the attribute types of the target object are detected to be increased, the increased attribute types are obtained, then the mapping record table is updated based on the increased attribute types, and finally the attribute values corresponding to the increased attribute types are mapped into the preset database table based on the mapping record table.
It is easy to note that, in the above process, when the attribute type of the target object is increased, the extraction of the value corresponding to the increased attribute type can be realized without modifying the program code, thereby reducing the complexity of the system operation. In addition, in the process, when the attribute types in the preset database table are increased, only the attribute mapping is needed through the mapping record table, so that the complexity of database data migration is reduced.
Therefore, the scheme provided by the application achieves the aim of updating the attribute type without modifying the program code, thereby achieving the technical effect of reducing the complexity of database operation, and further solving the technical problem of complex operation caused by the fact that the attribute type can be updated only by changing the program code when the attribute type of the object is increased in the prior art.
In an alternative embodiment, before detecting whether the attribute type of the target object is increased based on the preset database table, it is required to determine whether the preset object and the target object belong to the same object under the preset platform. Specifically, object information of a preset object under a preset platform is firstly acquired, and then whether the preset object is matched with a target object is detected based on the object information, wherein under the condition that the preset object is matched with the target object, a plurality of first attribute types of the preset object under the preset platform are acquired.
Optionally, whether the object identifier of the preset object is matched with the object identifier of the target object may be determined by comparing the object identifier of the preset object with the object identifier of the target object, for example, whether a phone number associated with a micro signal of the preset object is consistent with a phone number associated with a micro signal of the target object, and if so, determining that the target object in the preset database table corresponds to the related information of the preset object. Further, in the case that the first attribute type and the second attribute type are determined to be matched, whether the first attribute type corresponding to the preset object is matched with the attribute type of the target object or not may be further compared.
Further, in the process of detecting whether the attribute type of the target object is increased based on the preset database table and the object information of the preset object under the preset platform, firstly, whether each first attribute type is matched with the attribute type of the target object in the preset database is detected, when the first attribute type which is not matched with the attribute type is detected, the attribute type of the target object is determined to be increased, a second attribute type is obtained, and the second attribute type is determined to be the increased attribute type. Wherein the second attribute type is the first attribute type that does not match the attribute type, for example, the attribute type of the target object includes: nickname, gender, country, province, city, the first attribute type of the preset object includes: the nickname, the gender, the country, the vermicelli amount and the attention degree are respectively compared with each first attribute type and each attribute type of the target object, for example, the first attribute type nickname is compared with all attribute types of the target object, if the comparison result indicates that the attribute type of the target object comprises the nickname attribute, the first attribute type gender is continuously detected until the attribute of the vermicelli amount does not exist in all attribute types of the target object, the vermicelli amount is determined to be the second attribute type, and the vermicelli amount is the added attribute type.
Further, after the added attribute type is determined, the mapping record table is updated based on the added attribute type. Specifically, the method includes the steps of firstly obtaining a target data type corresponding to an added attribute type, obtaining a target field identifier corresponding to a redundant column of a preset database table meeting a preset condition, then associating the added attribute type with the target field identifier to obtain a mapping record, and finally updating the mapping record table based on the mapping record. For example, for the attribute type of "vermicelli amount", the corresponding target data type is numerical type. And then detecting a redundant column of which the data type is a numerical type in the preset database table, for example, if the data type of the 8 th column of the preset database table is detected to be a numerical type, setting the attribute type of the column as the fan amount, and recording the mapping record of the fan amount and the 8 th column of the preset database table in the mapping record table.
It should be noted that, in the above process, the target field identifier may be, but is not limited to, a column number corresponding to the redundant column, for example, in the above example, the target field identifier is 8.
Optionally, before associating the added attribute type with the target field identifier, the target field identifier needs to be determined first. Specifically, the method includes the steps of firstly obtaining a candidate field with a data type in a preset database table as a target data type and an occupied state as an idle state, and then determining a field identifier of the candidate field as a target field identifier. For example, if the target data type is a numeric type, and the data types of the 7 th, 8 th, and 9 th columns of the redundant columns in the preset database table are numeric types, then the 7 th, 8 th, and 9 th columns may be determined to be the first fields. However, since the 7 th column is already occupied by the "attention" and the 8 th column is in an idle state, the identifier corresponding to the 8 th column is used as the target field identifier. In addition, the second field in the preset database table can be obtained first, then the first field with the data type being the target data type is obtained from the second field, and the field identification of the first field is determined as the target field identification. In addition, the second field and the first field with the data type as the target data type may be obtained from a preset database table, and then, the field identifications of the candidate fields which are in the idle state and have the data type as the target data type are determined as the target field identifications, for example, the field identifications of the second field are 7 and 9, the field identifications of the field with the data type as the target data type are 8 and 9, and then the field identification 9 is determined as the target field identification.
In addition, under the condition that a plurality of candidate fields exist, the candidate fields can be sorted based on the field identifications to obtain a sorting result, and the field identification of the candidate field at the first position is determined to be the target field identification according to the sorting result. For example, the data types of the 7 th, 8 th and 9 th columns of the redundant column are numerical type, the 7 th column is already occupied by the "attention", and the 8 th and 9 th columns are in an idle state, and both can be used as the "vermicelli amount". Since the 8 th column is located before the 9 th column, the identifier corresponding to the 8 th column is used as the target field identifier.
As can be seen from the above, the method provided by the present application implements mapping of the attribute types in the preset database table through the mapping record table, and therefore, when the attribute types are increased, the attribute types can be increased and the attributes can be extracted without re-modifying the code or restarting the server, thereby reducing the complexity of database data migration.
Example 2
According to an embodiment of the present invention, an embodiment of an apparatus for updating an object is further provided, where fig. 2 is a schematic diagram of an apparatus for updating an object according to an embodiment of the present invention, and as shown in fig. 2, the apparatus includes: a detection module 201, an acquisition module 203, an update module 205, and a mapping module 207.
The detection module 201 is configured to detect whether an attribute type of a target object is increased based on a preset database table and object information of the preset object under a preset platform, where the preset database table has a plurality of redundant columns, and each row of data of the preset database table forms one target object; an obtaining module 203, configured to, in a case that an increase in an attribute type of a target object is detected, obtain the increased attribute type; an updating module 205, configured to update a mapping record table based on the added attribute types, where a mapping relationship between each attribute type of the target object and a corresponding column in the preset database table is stored in the mapping record table; and the mapping module 207 is configured to map the attribute value corresponding to the added attribute type into a preset database table based on the mapping record table.
In an alternative embodiment, the apparatus for updating an object further comprises: the device comprises a first acquisition module, a first detection module and a second acquisition module. The first acquisition module is used for acquiring object information of a preset object under a preset platform before detecting the attribute type of the target object based on a preset database table; the first detection module is used for detecting whether a preset object is matched with a target object or not based on the object information; and the second acquisition module is used for acquiring a plurality of first attribute types of the preset object under the preset platform under the condition that the first attribute types are matched with the second attribute types.
In an alternative embodiment, the detection module comprises: the device comprises a second detection module and a first determination module. The second detection module is used for detecting whether each first attribute type is matched with the attribute type of the target object in the preset database; the first determining module is used for determining that the attribute type of the target object is increased to obtain a second attribute type when the first attribute type which does not match with the attribute type is detected, wherein the second attribute type is the first attribute type which does not match with the attribute type.
In an alternative embodiment, the apparatus for updating an object further comprises: a second determining module to determine the second attribute type as an added attribute type.
In an alternative embodiment, the update module includes: the device comprises a third acquisition module, a fourth acquisition module, a correlation module and a first updating module. The third obtaining module is used for obtaining the target data type corresponding to the added attribute type; the fourth acquisition module is used for acquiring the target field identifier corresponding to the redundant column of which the preset database table meets the preset condition; the association module is used for associating the added attribute types with the target field identification to obtain a mapping record; and the first updating module is used for updating the mapping record table based on the mapping record.
In an alternative embodiment, the fourth obtaining module includes: the device comprises a fifth obtaining module, a sixth obtaining module and a third determining module. The fifth acquisition module is used for acquiring a candidate field of which the data type in the preset database table is the target data type and the occupation state is the idle state; and the third determining module is used for determining that the field identifier of the candidate field is the target field identifier.
In an alternative embodiment, the apparatus for updating an object further comprises: the device comprises a sorting module and a fourth determining module. The sorting module is used for sorting the candidate fields based on the field identification under the condition that the candidate fields exist to obtain a sorting result; and the fourth determining module is used for determining the field identifier of the candidate field at the first position as the target field identifier according to the sorting result.
The device to be updated includes a processor and a memory, the detection module, the acquisition module, the update module, the mapping module, and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the extraction of the numerical value corresponding to the added attribute type can be realized without modifying program codes by adjusting kernel parameters, so that the complexity of system operation is reduced.
Example 3
An embodiment of the present invention provides a storage medium on which a program is stored, which when executed by a processor implements the method of updating an object in the above-described embodiments.
Example 4
The embodiment of the invention provides a processor, which is used for running a program, wherein the method for updating an object in the embodiment is executed when the program runs.
Example 5
An embodiment of the present invention provides a computing device, such as the schematic diagram of the computing device shown in fig. 3, and as can be seen from fig. 3, the computing device 30 includes a bus 301, at least one processor 302, and at least one memory 303 connected to the bus; the processor and the memory complete mutual communication through a bus; the processor is used for calling the program instructions in the memory to execute the method for updating the object. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device: detecting whether the attribute type of the target object is increased or not based on a preset database table and object information of the preset object under a preset platform, wherein the preset database table is provided with a plurality of redundant columns, and each row of data of the preset database table forms one target object; under the condition that the attribute type of the target object is detected to be increased, acquiring the increased attribute type; updating a mapping record table based on the added attribute types, wherein the mapping record table stores the mapping relation between each attribute type of the target object and a corresponding column in a preset database table; and mapping the attribute value corresponding to the added attribute type to a preset database table based on the mapping record table.
The computer program product described above is further adapted to perform a program for initializing the following method steps when executed on a data processing device: before detecting the attribute type of a target object based on a preset database table, acquiring object information of a preset object under a preset platform; detecting whether a preset object is matched with a target object based on the object information; and under the condition that the first attribute types are matched with the preset object, acquiring a plurality of first attribute types of the preset object under a preset platform.
The computer program product described above is further adapted to perform a program for initializing the following method steps when executed on a data processing device: detecting whether each first attribute type is matched with the attribute type of a target object in a preset database; and when the first attribute type which is not matched with the attribute type is detected, determining that the attribute type of the target object is increased to obtain a second attribute type, wherein the second attribute type is the first attribute type which is not matched with the attribute type.
The computer program product described above is further adapted to perform a program for initializing the following method steps when executed on a data processing device: the second attribute type is determined to be an added attribute type.
The computer program product described above is further adapted to perform a program for initializing the following method steps when executed on a data processing device: acquiring a target data type corresponding to the added attribute type; acquiring a target field identifier corresponding to a redundant column of which a preset database table meets a preset condition; associating the added attribute types with the target field identification to obtain a mapping record; the mapping record table is updated based on the mapping record.
The computer program product described above is further adapted to perform a program for initializing the following method steps when executed on a data processing device: acquiring a candidate field with a data type in a preset database table as a target data type and an occupied state as an idle state; and determining the field identification of the candidate field as the target field identification.
The computer program product described above is further adapted to perform a program for initializing the following method steps when executed on a data processing device: under the condition that a plurality of candidate fields exist, sorting the candidate fields based on the field identification to obtain a sorting result; and determining that the field identifier of the candidate field at the first position is the target field identifier according to the sorting result.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.