Specific embodiment
In the prior art, the label field in business record is generally stored with specific label substance.It continues to use above
Citing, referring to the following table 1.
Name |
Issuing time |
Product name |
Label |
Zhang San |
2019.1.1 |
A |
Zhejiang Province, digital product, 95 one-tenth it is new |
Li Si |
2018.12.2 |
B |
Fujian Province, dress ornament, 99 one-tenth it is new |
King five |
2018.10.7 |
C |
Shandong Province, digital product, 95 one-tenth it is new |
Table 1
As shown in table 1, every a line is a business record, wherein first three field of each business record is for recording
Business event information, such as name, commodity issuing time and the product name of commodity publisher.The 4th of each business record
A field (label field) is used to be recorded as the label substance of business event information distribution, i.e., province where commodity publisher,
The type of merchandise and commodity quality.
It should be noted that for each business record, when it includes label substance have multiple when, this multiple mark
The label classification that label content is belonged to respectively is often different.For example, for commodity A, tag class that " Zhejiang Province " is belonged to
It is not province, the label classification that " digital product " is belonged to is the type of merchandise, and the label classification that " 95 one-tenth are new " is belonged to is quality,
3 label substances of commodity A are respectively belonging to different label classifications.
With continued reference to table 1, the label substance of underlying commodity quality and the type of merchandise that has of commodity A and commodity C is identical.?
That is platform needs to repeat storage " digital product " and " 95 one-tenth new " twice.In practical applications, label classification often compared with
It is more, other than above-mentioned province, the type of merchandise and commodity quality, it is also possible to have more label classifications.It means that with
Business record increases in table 1, and many label substances may be redundantly stored thousands of times, this will expend very big deposit
Store up space.
It is well known that data are actually to be stored in binary form in the database.One Chinese character is come
It says, the memory space to be occupied is 2 bytes (i.e. 16 binary digits).For a number, convert thereof into
After binary form, the length of binary number is exactly its occupied memory space.By taking the commodity A in table 1 as an example, A pairs of commodity
Answer label substance " Zhejiang Province, digital product, 95 one-tenth it is new " include 9 Chinese characters and 1 number (i.e. 95).This 9 Chinese characters need
16*9=144 binary digit is occupied, the binary form of number 95 is 1011111, needs to occupy 7 binary digits.Also
It is to say, the corresponding label substance of commodity A needs to occupy 151 binary digits.
In table 1, only 3 label classifications, if label classification is more, in each business record occupied by label substance
Memory space will be bigger, in turn, repeat to store storage resource spent by label substance to be huge.
And in one or more embodiments of this specification, on the one hand, will be in each label under each label classification
Hold and the number of each label substance is stored in allocation list, on the other hand, tool can't be written in each business record
The label substance of body, but the clue for being used for inquiry tag content, the i.e. number of label substance is written.
On the one hand, by way of allocation list, it is only necessary to once store to each configuration information, effectively save
Storage resource, on the other hand, due to numbering, occupied memory space is often smaller (to need what is occupied to deposit much smaller than label substance
Store up space), therefore, this also can achieve the purpose for saving storage resource.
In order to make those skilled in the art more fully understand the technical solution in this specification embodiment, below in conjunction with this
Attached drawing in specification embodiment is described in detail the technical solution in this specification embodiment, it is clear that described
Embodiment is only a part of the embodiment of this specification, instead of all the embodiments.The embodiment of base in this manual,
Those of ordinary skill in the art's every other embodiment obtained, all should belong to the range of protection.
Below in conjunction with attached drawing, the technical solution that each embodiment of this specification provides is described in detail.
Fig. 1 is a kind of flow diagram of the method for storage service record that this specification embodiment provides, including following
Step:
S100: business event information is obtained, and distributes at least one label substance for the business event information.
In this specification embodiment, the corresponding allocation list of each label classification can be stored in advance.Wherein, for every
A label classification, the corresponding allocation list of label classification belong to the other each label substance of the tag class and every for storing
The number of a label substance.
In this specification embodiment, if only one label classification, belong to the tag class other any two
The number of a label substance must not be identical, so can uniquely determine corresponding label substance according to some number.If there is not
An only label classification, then, the number for belonging to the other any two label substance of the tag class must not be identical, meanwhile,
It is general to require the number for belonging to the different other any two label substances of tag class be identical.In addition, below, also mentioning
Two kinds of preferred embodiments have been supplied, in both preferred embodiments, have belonged to the different other any two of tag class
The number of label substance may be the same or different.
In this specification embodiment, if requirement belongs to the number of the different other any two label substances of tag class
Difference, then, in fact, the number of the label substance is practical for any label substance in each allocation list being pre-created
On be can be with the unique number of the unique identification label substance.
For example, different numbers can be distributed for each label classification first, it is assumed that each other number of tag class is 3 digits
Word, then, for each label classification, first 3 of the number of the other label substance of the tag class are the other number of the tag class.
Assuming that there is 3 label classifications, the other number of this 3 tag class is respectively 1,2,3, then, under the label classification for being 1 for number
Second label substance, number can be 102, for number be 2 label classification under first label substance, compile
Number it can be 201.The following table 2~4 illustratively give and correspond respectively to 3 other allocation lists of tag class.
Table 2
Table 3
Table 4
Certainly, different to belong to the specified number of the other each label substance of the tag class for each label classification
It surely is serial number, can also be specified according to any regular, as long as belonging to the number of the other each label substance of the same tag class not
It repeats.For example, can modify to table 2, the number in " Fujian Province " can be 111, and the number in " Zhejiang Province " can be
105, the number of " Shandong Province " can be 101, as shown in table 5 below.
Table 5
In this specification embodiment, business event information refers to related to the business event of any needs record occurred
Information.For example, under the scene of previously described commodity pass-along deal, business event can be that " user Zhang San was in 2019 1
The publication of the moon 1 commodity A " to be vended, corresponding business event information are " Zhang San, 2019.1.1, commodity A ".
In general, can be analyzed at least one corresponding label of business event information according to business event information
Hold, several alternative label substances can also be provided a user, be selected by users, as the corresponding mark of business event information
Sign content.
Herein, at least two label substances are assigned with if business event information, then business event information is corresponding
The label classification that each label substance is belonged to respectively is neither same.
S102: according to the allocation list being pre-created, the volume of the corresponding each label substance of the business event information is determined
Number.
In this specification embodiment, for each label classification, the label classification can be belonged to by known in advance
Whole label substances and number the corresponding allocation list of label classification is all written.In this way, in step s 102, so that it may be directed to
The corresponding each label substance of the business event information, according to the label substance, from the allocation list for storing the label substance
Read corresponding number.
It further, can not also the write-in times into the label classification corresponding allocation list in advance for each label classification
What content, when actually executing this method shown in FIG. 1, for the corresponding each label substance of business event information, if should
Label substance first appears, then being just label substance distribution number, and should by the label substance and its number deposit
In the corresponding allocation list of label classification that label substance is belonged to.
Specifically, when executing step S102, it can be directed to the corresponding each label substance of the business event information, sentenced
Whether the disconnected other allocation list of tag class corresponding to label substance ownership is stored with the label substance;If so, from corresponding to
The number of the label substance is read in the other allocation list of tag class of label substance ownership;It otherwise, is label substance distribution
Number, and match tag class that the number deposit of the label substance and the label substance corresponds to label substance ownership are other
Set table.
S104: label field is determined.
In this specification embodiment, the label field is in the business record of subsequent builds, for recording the industry
The field of the number of the corresponding label substance of business event information.That is, the label field determined includes the business event
The number of the corresponding each label substance of information.
By taking table 2~4 as an example, it is assumed that the label substance for being the distribution of business event information is Zhejiang Province, digital product, 95 one-tenth
Newly, it is possible to determine that the number in label substance " Zhejiang Province " is 102 according to table 2, determine that " number produces label substance according to table 3
The number of product " is 201, determines that the number of label substance " 95 one-tenth new " is 301 according to table 3.Then, available comprising inquiring
These three number label fields, be " 102,201,301 ".Due to 102 corresponding binary numbers be 1100110 (7 two into
Position processed), 201 corresponding binary numbers are 11001001 (8 binary digits), and 301 corresponding binary numbers are 100101101 (9
A binary digit), therefore, the above-mentioned occupied memory space of label field substantially 24 binary digits, much smaller than by this three
The number of bits (as it was noted above, 151 binary digits) that the content write-in label field of a label substance at least needs.
S106: it based on the business event information and the label field, constructs business record and stores.
And in this specification embodiment, it, can be by several industry of storage service event information after obtaining label field
Business field and the label field are encapsulated as business record write-in database and are stored.
Referring to table 6, wherein " name ", " issuing time ", " product name " are service fields, and " label substance " is label
Field.
Name |
Issuing time |
Product name |
Label substance |
Zhang San |
2019.1.1 |
A |
102、201、301 |
Table 6
By method shown in FIG. 1, although without specifically label substance in label field, it is with label field
Clue can inquire corresponding label substance from the allocation list being pre-created.So, on the one hand, in a manner of allocation list,
It only needs once to store each configuration information under each label classification, many storage resources will not be expended.Another party
Face, in the business record of write-in database, label field only includes the number for inquiry tag content, occupied storage
Space is smaller.
Corresponding to the method for storage label substance shown in FIG. 1, this specification embodiment also correspondence provides a kind of reading
The method of the corresponding label substance of business event information, as shown in Figure 2, comprising:
S201: business record is read, and extracts the label field in the business record.
S202: the number for including in the label field is read.
S204: based on the number for including in the label field, label substance is read from the allocation list being pre-created.
In this specification embodiment, when needing to read the corresponding label substance of each business event, it can obtain first
Take the label field in business record.In the label field and specific label substance, but several numbers are not included.
Corresponding label can be inquired into pre-stored each allocation list using each number in label field as clue
Content.Specifically, it is all unduplicated for numbering since each label substance is corresponding, in the label field
The each number for including, can navigate to the allocation list for recording the number, and then from the allocation list for recording the number, and reading should
Number corresponding configuration information.
For example, with reference to table 6,3 numbers, respectively 102,201,301 are read first from table 6.Then, it is read from table 2
102 corresponding label substance " Zhejiang Province " of number is taken, 201 corresponding label substance " digital product " of number is read from table 3, from
The corresponding label substance of number 301 " 95 one-tenth new " is read in table 4.
In addition, in this specification embodiment, using with store mark by the way of each one-to-one allocation list of label classification
Content and its number are signed, can also realize following technical effect:
1, when needing to increase new label substance for some label classification, it is only necessary in the corresponding configuration of label classification
Increase a label substance in table, and distributes binary number for the label substance.
For example, with reference to table 3, it is assumed that need to increase the new type of merchandise " books ", then, table 3 can be changed to the following table 9.
Table 72, when needing to increase new label classification, it is only necessary to for the label classification construct allocation list.For
For the business event of subsequent generation, the label substance of richer (more label classifications) can be distributed for the business event.
For example, newly increasing label classification " means of payment ", it is corresponding that " means of payment " can be increased on the basis of table 2~4
Allocation list, as shown in table 8 below.
Table 8
Correspondingly, after increasing allocation list, the label substance in relation to the means of payment can be distributed for business event.Example
Such as, on 2 2nd, 2019 publishing commodity D of user Zhu Liuyu, corresponding label substance can be Shandong Province, dress ornament, 99 one-tenth new, electricity
Son payment.So, it is based on table 2~4, table 8 can increase a business record, as shown in table 9 below on the basis of table 6.
Name |
Issuing time |
Product name |
Label substance |
Zhang San |
2019.1.1 |
A |
102、201、301 |
Zhu six |
2019.2.2 |
D |
103、202、302、、401 |
Table 9
To sum up, core of the invention thought is: on the one hand, specific label substance is detached from business record,
Label substance is individually stored using the mode of the corresponding allocation list of each label classification, avoids repeatedly storing identical label
Content, to save storage resource;On the other hand, by the number for the label substance recorded in allocation list (rather than label substance sheet
Body) label field in business record is written, to save storage resource.In this way, when wanting to read in the label in business record
Rong Shi can inquire corresponding label substance to allocation list using the number in label field as clue.
Any specific embodiment based on above-mentioned technical idea all should be in this hair used by those skilled in the art
Within bright technical scope claimed.
In the following, this specification embodiment illustratively provides two kinds of preferred embodiments, deposited with realizing preferably to save
Store up the effect in space.
Firstly, in order to realize both preferred embodiments, the number that is stored in the corresponding allocation list of each label classification
It can be specially binary number, also, the binary number for belonging to the other each label substance of same tag class should include
The binary digit of identical quantity.That is, being directed to each label classification, which returns for storing
Belong to the binary number of the other each label substance of the tag class and each label substance.
In both preferred embodiments, the number for belonging to the different other any two label substances of tag class can be with
Difference, can also be identical.
Further, for each label classification, the binary number of the other each label substance of the tag class is belonged to
It is determined as follows:
The sequencing that the corresponding allocation list of label classification is written according to the other each label substance of the tag class is belonged to,
By being ranked up after arriving first to belonging to the other each label substance of the tag class;
For the other each label substance of the tag class is belonged to, if the label substance is the corresponding configuration of label classification
Q-th of label substance in table, then the binary number of the label substance is the q of binary form;Q ∈ (0, ∞).
The following table 10~12 are the corresponding allocation lists of label classification (province, the type of merchandise, quality).
Table 10
Table 11
Table 12
Preferred embodiment one
For convenience of description, it is assumed that the other quantity of tag class is S, then, the quantity of allocation list is also S, each allocation list
It is corresponded with each label classification.Assuming that there are sequencings for each label classification, then, if natural number i ∈ (0, S+1), will return
The binary digit quantity for belonging to the binary number of the other label substance of i-th of tag class is denoted as Mi。
In this specification embodiment, it can be disposed in advance as follows with further progress:
Creation includes the label field template of N number of binary digit, and there are several sections, Mei Gewei in N number of binary digit
Section includes several binary digits.Wherein, in label field template described in i-th of label classification exist correspond only to i-th
Other section of tag class, if the binary number of the other label substance of the tag class for belonging to i-th has MiA binary digit,
Then corresponding to other section of i-th of tag class in the label field template includes PiA binary digit.And it is further desired that meeting
Mi≤Pi, and,
Theoretically, MiWith PiCloser to (and/or N withIt is closer), the binary digit of redundancy in the label field
Fewer, the occupied binary digit of label field obtained based on label field template is fewer, can more save storage money
Source.
It should be noted that in practice, the number of bits that common data type is supported in database is generally extremely
Less include following several situations: support storage 8 bits (byte type), support 16 bits (short type),
It supports storage 32 bits (int type), supports storage 64 bits (long type).Due to the label field
Template can be made of one or more data types, and therefore, the value of above-mentioned N is usually any number in 8,16,32,64
Value, is also possible to for any value in 8,16,32,64 to be added obtained numerical value with k*64, and k is the natural number greater than 0.
Herein, position section refers to the piece comprising at least one binary digit marked off in N number of continuous binary digit
Section.Position section can be planned in the label field template according to actual needs.Every section in the label field template it
Between can not can also have spaced binary digit with spaced binary digit;Every section in the label field can be just
Handy N number of binary digit to the greatest extent, there may also be certain binary digit redundancies.
Theoretically, the binary digit of redundancy is fewer in the label field template, the mark obtained based on label field template
The occupied memory space of section of signing is fewer.For example, it is assumed that needing marking off 3 position sections, 8 binary digits are occupied altogether, most
The strategy of saving is, using the data of one 8 byte types as label field template (i.e. N=8), in this way, marking off
After these three sections, the binary digit of redundancy is just not present, subsequent obtained label field can only occupy 8 binary digits.
If there is the binary digit at interval between the 3 positions section marked off, using one 8 byte categorical data conducts
Label field template is clearly inadequate, therefore is had to using one 16 short categorical datas as label field mould
Version, there are certain binary digit redundancy, subsequent obtained label field can occupy 16 binary digits.
In mode of priority one, work as Mi=PiWhen, other section of i-th of tag class is corresponded in the label field template
Include (x+1)th in the label field template to+Mi binary digits of xth, wherein if i=1, x=0;If i >=2, x are
The sum of the quantity of binary digit that the corresponding position section of preceding i-1 label classification is included.
Fig. 3 is the label field template schematic diagram that this specification embodiment provides.As shown in Figure 3, it is assumed that belong to 3 marks
The binary number for signing the label substance of classification all has 3 binary digits, then, the label field template can be 16
The short categorical data (N 16) of binary digit.3 position sections are marked off in this 16 binary digits, each section includes 3
Binary digit.In addition, remaining 7 binary digits are not divided into position section, it is the binary digit of redundancy.
For any allocation list, if the binary number of each label substance in the allocation list be in sequence successively into
(being serial number) of row distribution, then, the number of bits needs of binary number, which are enough to hold, in the allocation list carries in allocation list
The binary number of the last one label substance.Under the premise of meeting the condition, the number of bits of binary number is smaller,
Its occupied number of bits of corresponding position section is with regard to smaller, occupied by the subsequent label field obtained based on label field template
Memory space with regard to smaller.
For example, it is assumed that all provinces (totally 34) of exhaustive China are needed in table 10, and table 3 and 4 is constant, then, table 10
In the corresponding binary number of the last one configuration information be actually 34 binary form, i.e., 100010 (6 two into
Position processed), therefore, for table 2, the binary number of record needs to support 6 binary digits at least, as shown in table 13.
Table 13
In addition, the quantity for the binary digit that label field template includes, which should be enough to hold, carries S not in preferred embodiment one
Same binary number (this S binary digit number belongs to S allocation list).In this way, even being distributed for business event information
Label substance have S (label substances are determined under each label classification), it is every that the label field template can also hold load
The binary number of a label substance.
It is in fact in label field template is each label classification reserved location in preferred embodiment one, for industry
The corresponding each label substance of business event information, the binary number of the label substance can be written into the mark in label field template
The corresponding position section of the label classification that label content is belonged to.It needs to illustrate, in preferred embodiment one kind, for any two label
The binary number of classification, some label substance under one of label classification can be with some under another label classification
The binary number of label substance repeats.But due in label field template, being each label classification reserved location, because
This will not cause to obscure even the binary number for belonging to different other two label substances of tag class repeats.
Wherein, the position section (and binary digit of redundancy) that binary number is not written in label field can be sky.Such as
This, it is invalid bit section for empty position section, for empty binary digit that in label field, the position section that number is written, which is significance bit section,
It is the binary digit of redundancy.
In addition, if the coding rule to label substance is, the binary number of label substance is greater than 0, then, it is obtaining
It, can be by the position section in the 0 filling label field template in addition to the corresponding position section of hit label classification before label field
And/or binary digit.Wherein, hit label classification is the tag class that the corresponding label substance of the business event information is belonged to
Not.In this way, not being exactly significance bit section for 0 position section, the position section for being 0 is invalid bit section, remaining is the two of 0 in label field
System position is the binary digit of redundancy.
For example, it is based on table 2~4, it is assumed that it be the label substance that business event information is distributed is Shandong Province, number, that
, the label field obtained based on label field template can be as shown in Figure 4.It should be noted that due to position 3 corresponding marks of section
The relevant label substance of label classification (quality) is simultaneously not included in label substance set, therefore, it is also desirable to align the write-in of section 30.This
Outside, it is also necessary to be filled to not being written 0 by the binary digit of cut-in any bit section (binary digit of redundancy).In this way, final
The business record of storage can be as shown in table 14 below.
Name |
Issuing time |
Product name |
Label substance |
Zhang San |
2019.1.1 |
A |
0110010000000000 |
Table 14
In this way, in step S202, can be determined first each in the label field when needing to read label substance
Significance bit section (i.e. position section 1 and position section 2 in Fig. 4).Wherein, significance bit section is to have been written into the position section of binary number.Specifically,
Can be read first of the binary value of label field since table 12, first the reading corresponding position of label classification 1 section (due to
M1=3, therefore read 3), 011 is obtained, as two in first position section (corresponding to label classification 1 and significance bit section)
System number then, then reads the corresponding position of label classification 2 section (due to M2=3, therefore read 3), 001 is obtained, as the
Binary number in two position sections (corresponding to label classification 2 and significance bit section), then, then reads label classification 3 and corresponds to
Position section (due to M3=3, therefore read 3), 000 is obtained, is determined as invalid bit section and (corresponds to label classification 3, illustrate commodity
There is no the label substances under label classification 3 by A), so far, 3 position sections have read and have finished.
Then, for each significance bit section, the binary number that the significance bit section includes is read, and right from the significance bit section
In the other allocation list of the tag class answered, the corresponding label substance of the binary number is read.Referring to fig. 4, i.e., right from label classification 1
Binary number " 011 " corresponding label substance " Shandong Province " is read in the allocation list (table 10) answered, it is corresponding from label classification 2
Binary number " 001 " corresponding label substance " number " is read in allocation list (table 11).
Preferred embodiment two
In preferred embodiment two, it is similarly assumed that the other quantity of tag class is S, then, the quantity of allocation list is also S, is respectively matched
It sets table and each label classification corresponds.Assuming that there are sequencings for each label classification, then, if natural number i ∈ (0, S+1),
The binary digit quantity for belonging to the binary number of the other label substance of i-th of tag class is denoted as Mi。
In this specification embodiment, it can be disposed in advance as follows with further progress:
The classification field template comprising F binary digit, S≤F is pre-created.For i-th of label classification, the label
Exist in field template and corresponds only to the other binary digit of i-th of tag class.The label word comprising N number of binary digit is pre-created
Section template;
It is different from preferred embodiment one, in preferred embodiment two, position section is divided not in label field template, but in label
Except field template, a classification field template is separately created.Furthermore, it is desirable to specify S binary system in classification field template
Position, establishes the corresponding relationship between this S binary digit and S label classification.
Theoretically, F and S is closer, and the binary digit of redundancy is fewer in the classification field, is based on classification field template
The occupied binary digit of obtained classification field is fewer, can more save storage resource.In addition, N withMore connect
Closely, the binary digit of redundancy is fewer in the label field, and the label field obtained based on label field template is occupied
Binary digit is fewer, can more save storage resource.
In preferred embodiment two, F is one: 8,16,32,64 in following values.Alternatively, F is will be in 8,16,32,64
Any value be added obtained numerical value with k*64, k is the natural number greater than 0.
In preferred embodiment two, the preceding S binary digit in the classification field template can be with S label classification one by one
Corresponding, i.e., corresponding to the other binary digit of i-th of tag class in the described classification field template is i-th in the classification field template
A binary digit.
For example, with reference to Fig. 5, it is assumed that have 3 label classifications, it is possible to by the 1st binary system in classification field template
Position is used as the corresponding binary digit of label classification 1, and the 2nd binary digit in classification field template is right as label classification 2
The binary digit answered, using the 3rd binary digit in classification field template as the corresponding binary digit of label classification 3.
Based on preferred embodiment two, in step s 102, it can be directed to each label substance for the distribution of business event information,
The label classification that the label substance is belonged to is determined as effective label classification.Then, the class is written into the first specified numerical value
The corresponding binary digit of each effectively label classification in malapropism section template, wherein the first specified numerical value is 0 or 1.In turn,
The label field template is written into the binary number of the corresponding each label substance of the business event information, obtains label
Field.Wherein, correspond to effective other binary digit of tag class for each effective label classification, in the classification field to get over
Forward, then the binary number that effective other label substance of tag class is belonged in the label field is more forward.
It should be noted that in obtained label field, it can be with spaced binary digit between each binary number.Between
Every binary digit can for sky, 0 can also be filled with.If the binary digit at interval is filled with 0, compiled to read binary system
Number accuracy, then require the number for the binary digit being spaced between the binary number that any two are adjacent in the label field
Amount needs identical.
If it is intended to maximal efficiency utilizes the binary digit in label field template, then it can be by the business event information
The binary number of corresponding each label substance is spliced into numeric string and the label field template is written.In this way, label field
Not spaced binary digit between the adjacent binary number of middle any two.
Further, before obtaining classification field, the second specified numerical value can be written in the classification field template
Other binary digits in addition to the corresponding binary digit of effective label classification;Wherein, if the first specified numerical value is 1,
The second specified numerical value is 0, if the first specified numerical value is 0, the second specified numerical value is 1.
For example, referring to Fig. 6.3 label classifications are preset with, and are that there are two in label for the distribution of business event information
Hold, is respectively belonging to label classification 1 and label classification 3.Therefore, label classification 1 and label classification 3 can be determined as effectively first
Label classification, then, in classification field template, by the binary digit write-in 1 corresponding with label classification 3 of label classification 1, by it
Remaining binary digit write-in 0, obtains classification field.Then, according to the sequencing of label classification 1 and label classification 3, first by industry
Binary number (011) write-in of the corresponding label substance (being assumed to be Shandong Province) for belonging to label classification 1 of business event information,
Then the corresponding corresponding binary system of label substance (be assumed to be 95 one-tenth new) for belonging to label classification 3 of business event information is compiled
Number (001) write-in, remaining binary digit write-in 0.
In this way, needing in step S104 based on the business event information, the classification field and the label word
Section constructs business record and stores.The business record finally stored can be as shown in table 15 below.
Name |
Issuing time |
Product name |
Label classification |
Label substance |
Zhang San |
2019.1.1 |
A |
10100000 |
0110010000000000 |
Table 15
When needing to read label substance, the classification field in the business record can be extracted first, determines the class
Each significance bit in malapropism section.Wherein, significance bit is to have been written into the binary digit of the first specified numerical value.It specifically, can be from table
First of the binary value of classification field starts to read in 15, and the corresponding label classification of binary digit that value is 1 is determined as
Significance bit.As it can be seen that significance bit is the corresponding significance bit of label classification 1 significance bit corresponding with label classification 3.
Then, the numbering read in label field is divided into following two situation:
1, assume the binary digit that there is interval between the adjacent binary number of any two in label field, also,
The binary digit that binary number is not written is all sky, as shown in Figure 7.In this case, the binary system in the label field
Number highlights.It therefore, can be by institute if natural number j ∈ [1, L], L are the quantity of significance bit in the classification field
J-th of binary number in label field is stated as the corresponding binary number of j-th of significance bit in the classification field.
2, assume in label field between the adjacent binary number of any two there are specified quantity (can for 0 or other
Quantity) interval binary digit, also, be not written binary number binary digit value be 0, as shown in Figure 8.This feelings
Under condition, in fact, requiring the number of the binary digit at existing interval between the adjacent binary number of any two in label field
Amount is all identical.Therefore, if belonging to the other label substance of the corresponding tag class of j-th of significance bit in the classification field
Binary number has MjA binary digit;By the C+y+1 to C+y+M in the label fieldjA binary digit is corresponding
Binary value is determined as the corresponding binary number of j-th of significance bit and reads;Wherein: if j=1, y=0;If j >=2, y
The sum of the quantity of binary digit having for the corresponding binary number of preceding j-1 significance bit.
Then, for situation 1 and situation 2, can have for j-th of significance bit in the classification field from j-th
It imitates in allocation list corresponding to the corresponding label classification in position, reads mark corresponding to the corresponding binary number of j-th of significance bit
Sign content.
It specifically, is exactly to be read from 1 corresponding allocation list (table 10) of label classification in the label that binary number is 011
Hold " Shandong Province ", " is counted from the label substance that binary number is 001 is read in 3 corresponding allocation list (table 11) of label classification
Code ".
Some label substance in preferred embodiment two, for any two label classification, under one of label classification
Binary number can be repeated with the binary number of some label substance under another label classification.But due to
It is each label classification reserved location in classification field template, therefore, even belong in different other two labels of tag class
The binary number of appearance repeats, and will not cause to obscure.
In addition, in this specification embodiment, when to newly-increased tagged content under some label classification, if it is newly-increased
The digit of the binary number of the label substance distribution added is greater than the digit supported at present, it is possible to the label classification pair
Binary number in the allocation list answered increases by one.
For example, it is assumed that the binary number for being newly-increased label substance " books " distribution of table 11 is 1000 (decimal systems 8), that
, table 11 is changed to the following table 16, and table 10 can remain unchanged with table 12.
Table 14
In addition, for above-mentioned preferred embodiment one, it is assumed that newly increase a label classification and (correspondingly newly increase a configuration
Table), then, it needs newly to mark off one in label field template and corresponds to other section of the tag class.
For above-mentioned preferred embodiment two, it is assumed that a label classification (correspondingly newly increasing an allocation list) is newly increased,
So, it needs newly to specify the binary digit for corresponding to category field in classification field template.
Fig. 9 is a kind of structural schematic diagram of the device for storage service record that this specification embodiment provides, and is pre-created
Each allocation list and each label classification correspond, for each label classification, the corresponding allocation list of label classification is for depositing
Storage belongs to the number of the other each label substance of the tag class and each label substance;Belong to same tag class other
Anticipate two label substances number it is different;
Described device includes:
Module 901 is obtained, obtains business event information, and distribute at least one label for the business event information
Hold;
Number determining module 902 determines the corresponding each mark of the business event information according to the allocation list being pre-created
Sign the number of content;
Field determining module 903, determines label field;The label field includes that the business event information is corresponding every
The number of a label substance;
Memory module 904 is constructed business record and is stored based on the business event information and the label field.
The number for belonging to the different other any two label substances of tag class is different.
For each label classification, to belong to the tag class other each for storing for the corresponding allocation list of label classification
The number of label substance and each label substance, specific implementation are as follows:
For each label classification, to belong to the tag class other each for storing for the corresponding allocation list of label classification
The binary number of label substance and each label substance;Wherein, the two of the other each label substance of same tag class are belonged to
System number includes the binary digit of identical quantity.
For each label classification, the binary number for belonging to the other each label substance of the tag class passes through such as lower section
Formula determines:
The sequencing that the corresponding allocation list of label classification is written according to the other each label substance of the tag class is belonged to,
By being ranked up after arriving first to belonging to the other each label substance of the tag class;
For the other each label substance of the tag class is belonged to, if the label substance is the corresponding configuration of label classification
Q-th of label substance in table, then the binary number of the label substance is the q of binary form;Q ∈ (0, ∞).
The label field template being pre-created includes N number of binary digit, if natural number i ∈ [1, S], S are that tag class are other
Quantity exists in the label field template for i-th of label classification and corresponds only to other section of i-th of tag class, if returning
The binary number for belonging to the other label substance of i-th of tag class includes MiA binary digit is right in the label field template
It should include P in other section of i-th of tag classiA binary digit, Mi≤Pi,
The field determining module 903 will be in the label for the corresponding each label substance of the business event information
The other section of tag class for corresponding to label substance ownership is written in the label field template in the binary number of appearance, obtains
Label field.
If Mi=Pi, then corresponding to other section of i-th of tag class in the label field template includes the label field
(x+1)th is to xth+Mi binary digits in template;Wherein:
If i=1, x=0;
If the sum of the quantity of binary digit that i >=2, x include by the corresponding position section of preceding i-1 label classification.
The binary number of any label substance is greater than 0;
The field determining module 903 will remove life in the 0 filling label field template before obtaining label field
Position section and/or binary digit except the corresponding position section of middle label classification;Hitting label classification is the business event information pair
The label classification that the label substance answered is belonged to.
N is one: 8,16,32,64 in following values;
Or
N is that any value in 8,16,32,64 is added to obtained numerical value with k*64, and k is the natural number greater than 0.
The classification field template being pre-created includes the classification field template of F binary digit, if natural number i ∈ [1, S],
S is the other quantity of tag class, and S≤F exists in the classification field template and corresponds only to i-th for i-th of label classification
The other binary digit of tag class;The label field template being pre-created includes N number of binary digit, if belonging to i-th of tag class
The binary number of other label substance includes MiA binary digit,
The field determining module 903 will be in the label for the corresponding each label substance of the business event information
Hold belonged to label classification and is determined as effective label classification;First specified numerical value is written each in the classification field template
The effectively corresponding binary digit of label classification, obtains classification field;The first specified numerical value is 0 or 1;By the business event
The label field template is written in the binary number of the corresponding each label substance of information, obtains label field;Wherein, for
Each effectively label classification, it is more forward to correspond to effective other binary digit of tag class in the classification field, then the mark
The binary number that effective other label substance of tag class is belonged in signature section is more forward.
Corresponding to the other binary digit of i-th of tag class in the classification field template is the in the classification field template
I binary digit.
The field determining module 903 spells the binary number of the corresponding each label substance of the business event information
It is connected into numeric string and the label field template is written.
Before obtaining classification field the classification field is written in second specified numerical value by the field determining module 903
Other binary digits in template in addition to the corresponding binary digit of effective label classification;Wherein, if the first specified numerical value
It is 1, then the described second specified numerical value is 0, if the first specified numerical value is 0, the second specified numerical value is 1.
F is one: 8,16,32,64 in following values;
Or
F is that any value in 8,16,32,64 is added to obtained numerical value with k*64, and k is the natural number greater than 0.
The memory module 904 is based on the business event information, the classification field and the label field, structure
It builds business record and stores.
The number determining module 902, for the corresponding each label substance of the business event information, judgement corresponds to
Whether the other allocation list of tag class of label substance ownership is stored with the label substance;If so, from corresponding in the label
Hold the number that the label substance is read in the other allocation list of tag class of ownership;Otherwise, it distributes and numbers for the label substance, and will
The number deposit of the label substance and the label substance corresponds to the other allocation list of tag class of label substance ownership.
Figure 10 is the corresponding mark of reading business event information for corresponding to method shown in Fig. 2 that this specification embodiment provides
Sign the structural schematic diagram of the device of content, comprising:
Field extraction module 1001 reads business record, and extracts the label field in the business record;The business
Record is stored by any one of claim 1~15 the method;
Number read module 1002 reads the number for including in the label field;
Label substance read module 1003, based on the number for including in the label field, from the allocation list being pre-created
Middle reading label substance.
The number for belonging to the different other any two label substances of tag class is different;
The label substance read module 1003, for each number for including in the label field, from being pre-created
Allocation list in determine and be stored with the allocation list of the number;The corresponding label substance of the number is read from determining allocation list.
The number read module 1002 determines each significance bit section in the label field;Wherein, significance bit section is
The position section of binary number is written;For each significance bit section, the binary number that the significance bit section includes is read;
The position section that the value for including in the label field is not 0 is determined as significance bit by the number read module 1002
Section.
The label substance read module 1003 determines the corresponding tag class of significance bit section for each significance bit section
Not;From the determining corresponding allocation list of label classification, read in the corresponding label of binary number that the significance bit section includes
Hold.
The field extraction module 1001, extracts the classification field in the business record;It determines in the classification field
Each significance bit;Significance bit is to have been written into the binary digit of the first specified numerical value;
The number read module 1002, if natural number j ∈ [1, L], L are the quantity of significance bit in the classification field,
If the binary number for belonging to the other label substance of the corresponding tag class of j-th of significance bit in the classification field has MjIt is a
Binary digit;By the C+y+1 to C+y+M in the label fieldjThe corresponding binary value of a binary digit is determined as jth
The corresponding binary number of a significance bit is simultaneously read;Wherein: C is natural number;If j=1, y=0;If j >=2, y are preceding j-1
The sum of the quantity of binary digit that the corresponding binary number of a significance bit has.
The label substance read module 1003, for j-th of significance bit in the classification field, effectively from j-th
In allocation list corresponding to the corresponding label classification in position, label corresponding to the corresponding binary number of j-th of significance bit is read
Content.
This specification embodiment also provides a kind of computer equipment, includes at least memory, processor and is stored in
On reservoir and the computer program that can run on a processor, wherein processor realizes the institute of Fig. 1 and/or 2 when executing described program
The method shown.
Figure 11 shows one kind provided by this specification embodiment and more specifically calculates device hardware structural schematic diagram,
The equipment may include: processor 1510, memory 1520, input/output interface 1530, communication interface 1540 and bus
1550.Wherein processor 1510, memory 1520, input/output interface 1530 and communication interface 1540 are real by bus 1550
The now communication connection inside equipment each other.
Processor 1510 can use general CPU (Central Processing Unit, central processing unit), micro- place
Reason device, application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or one
Or the modes such as multiple integrated circuits are realized, for executing relative program, to realize technical side provided by this specification embodiment
Case.
Memory 1520 can use ROM (Read Only Memory, read-only memory), RAM (Random Access
Memory, random access memory), static storage device, the forms such as dynamic memory realize.Memory 1520 can store
Operating system and other applications are realizing technical solution provided by this specification embodiment by software or firmware
When, relevant program code is stored in memory 1520, and execution is called by processor 1510.
Input/output interface 1530 is for connecting input/output module, to realize information input and output.Input and output/
Module can be used as component Configuration (not shown) in a device, can also be external in equipment to provide corresponding function.Wherein
Input equipment may include keyboard, mouse, touch screen, microphone, various kinds of sensors etc., output equipment may include display,
Loudspeaker, vibrator, indicator light etc..
Communication interface 1540 is used for connection communication module (not shown), to realize the communication of this equipment and other equipment
Interaction.Wherein communication module can be realized by wired mode (such as USB, cable etc.) and be communicated, can also be wirelessly
(such as mobile network, WIFI, bluetooth etc.) realizes communication.
Bus 1550 include an access, equipment various components (such as processor 1510, memory 1520, input/it is defeated
Outgoing interface 1530 and communication interface 1540) between transmit information.
It should be noted that although above equipment illustrates only processor 1510, memory 1520, input/output interface
1530, communication interface 1540 and bus 1550, but in the specific implementation process, which can also include realizing normal fortune
Other assemblies necessary to row.In addition, it will be appreciated by those skilled in the art that, it can also be only comprising real in above equipment
Component necessary to existing this specification example scheme, without including all components shown in figure.
This specification embodiment also provides a kind of computer readable storage medium, is stored thereon with computer program, the journey
Method shown in Fig. 1 and/or 2 is realized when sequence is executed by processor.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
As seen through the above description of the embodiments, those skilled in the art can be understood that this specification
Embodiment can be realized by means of software and necessary general hardware platform.Based on this understanding, this specification is implemented
Substantially the part that contributes to existing technology can be embodied in the form of software products the technical solution of example in other words,
The computer software product can store in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are to make
It is each to obtain computer equipment (can be personal computer, server or the network equipment etc.) execution this specification embodiment
Method described in certain parts of a embodiment or embodiment.
System, method, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.A kind of typically to realize that equipment is computer, the concrete form of computer can
To be personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
In device, navigation equipment, E-mail receiver/send equipment, game console, tablet computer, wearable device or these equipment
The combination of any several equipment.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for method reality
For applying example, since it is substantially similar to the method embodiment, so describing fairly simple, related place is referring to embodiment of the method
Part explanation.Embodiment of the method described above is only schematical, wherein described be used as separate part description
Module may or may not be physically separated, can be each module when implementing this specification example scheme
Function realize in the same or multiple software and or hardware.Can also select according to the actual needs part therein or
Person's whole module achieves the purpose of the solution of this embodiment.Those of ordinary skill in the art are not the case where making the creative labor
Under, it can it understands and implements.
The above is only the specific embodiment of this specification embodiment, it is noted that for the general of the art
For logical technical staff, under the premise of not departing from this specification embodiment principle, several improvements and modifications can also be made, this
A little improvements and modifications also should be regarded as the protection scope of this specification embodiment.