CN108984573A - There are the merging method and device of intersection set - Google Patents

There are the merging method and device of intersection set Download PDF

Info

Publication number
CN108984573A
CN108984573A CN201710413952.XA CN201710413952A CN108984573A CN 108984573 A CN108984573 A CN 108984573A CN 201710413952 A CN201710413952 A CN 201710413952A CN 108984573 A CN108984573 A CN 108984573A
Authority
CN
China
Prior art keywords
identification
union
determined
result
merging
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201710413952.XA
Other languages
Chinese (zh)
Inventor
彭远波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201710413952.XA priority Critical patent/CN108984573A/en
Publication of CN108984573A publication Critical patent/CN108984573A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a kind of merging method for having intersection set and devices, can obtain multiple set to be processed, determine element, set, the corresponding relationship between set identification according to the attaching relation of element and set;The quantity for determining the corresponding set identification of each element merges processing according to quantity set corresponding at least one element, obtains union;The corresponding relationship between each union and set identification is established, the identical union of corresponding set identification is merged;The quantity of the entire set obtained after being merged according to the identical union of corresponding set identification is determined as the set of output result.The present invention can quickly be handled a large amount of set, will wherein have the set of intersection to merge, so that it is determined that there is the relationship in the set of intersection between each set element.

Description

There are the merging method and device of intersection set
Technical field
The present invention relates to technical field of data processing more particularly to a kind of merging method for having intersection set and devices.
Background technique
In data processing field, such as database field, often need to ask intersection of sets collection or union.
When needing to carry out information merging, it is also necessary to be merged to the set for having intersection.Such as: to several by a variety of special There is the set of intersection to merge in the set of sharp information composition, to find the relationship between each patent information.Such as: set has Three, set A is that (applicant's company A, inventor Zhang San, invention classification is 1);Set B is (applicant B company, inventor Three, invention classification is 2);Set C is that (applicant B company, inventor Li Si, invention classification is 2);Set D be (applicant C company, Inventor king five, and invention classification is 4).Patent information in set A is extracted from patent document A to be obtained;Patent letter in set B Breath is extracted from patent document B to be obtained;Patent information in set C is extracted from patent document C to be obtained;Patent in set D Information is extracted from patent document D and is obtained.
Since set A, set B, set C have intersection each other, they can be merged into (applicant's A public affairs Department, applicant B company, inventor Zhang San, inventor Li Si, invention classification 1, invention classification is 2).And set D and other three collection There is no intersection between conjunction, there is no need to merge with other.
Pass through the set after merging, so that it may which determining has relationship between each element of set A, set B, set C.When So, also other use are merged to the set for having intersection.
It but how to be still the technical problem urgently to be resolved of this field one to there is the set of intersection to merge.
Summary of the invention
In view of the above problems, it proposes on the present invention overcomes the above problem or at least be partially solved in order to provide one kind A kind of merging method for having intersection set and device, the scheme for stating problem are as follows:
A kind of merging method having intersection set, comprising:
Obtain multiple set to be processed, according to the attaching relation of element and set determine element, set, set identification it Between corresponding relationship;
The quantity for determining the corresponding set identification of each element, according to the quantity it is corresponding at least one element gather into Row merging treatment, obtains union;
The corresponding relationship between each union and set identification is established, the identical union of corresponding set identification is closed And;
The quantity of the entire set obtained after being merged according to the identical union of corresponding set identification is determined as defeated The set of result out.
Optionally, described that processing is merged according to quantity set corresponding at least one element, union is obtained, Include:
When corresponding at least two set identification of element, which is determined as shared element, element is shared to each: This is shared the corresponding each set of element to merge, union is obtained, shares the corresponding set of element for the union as this, it will The set identification of the shared corresponding set of element is revised as the smallest set identification in the shared corresponding each set of element.
Optionally, the method also includes:
By comprising the quantity of the corresponding set identification of each element be that 1 set is determined as exporting one of result.
Optionally, it is described merged according to the identical union of corresponding set identification after the obtained quantity of entire set It is determined as the set of output result, comprising:
Whether the quantity of the set in result after judgement this time merging is greater than 1, if it is, by this knot after merging Set in fruit is determined as set to be processed, returns to the acquisition multiple set to be processed, and return with what is gathered according to element Category relationship determines the step of element, set, corresponding relationship between set identification;Otherwise, in the result by this after merging Set is determined as exporting one of result, and each output result is exported.
Optionally, the corresponding relationship by data to embodiment, it is described that member is determined according to element and the attaching relation of set Element is gathered, the corresponding relationship between set identification, comprising:
Unique set identification is respectively set for each set to be processed, generates comprising set identification and set First data pair;
The element of the first data centering set is unfolded, generates the second data comprising element and first data pair It is right.
Optionally, the quantity of the corresponding set of the determining each element, comprising:
To each element: the quantity of the element corresponding set identification in the second all data pair is determined, by the number Amount is determined as the quantity of the corresponding set of the element.
A kind of merging device having intersection set, comprising: relation determination unit, set combining unit, union combining unit Determination unit is exported with first,
The relation determination unit, for obtaining multiple set to be processed, the attaching relation according to element and set is true Determine element, set, the corresponding relationship between set identification;
The set combining unit, for determining the quantity of the corresponding set identification of each element, according to the quantity to extremely The corresponding set of an element merges processing less, obtains union;
The union combining unit, the corresponding relationship for establishing between each union and set identification, by corresponding set Identical union is identified to merge;
The first output determination unit, for what is obtained after being merged according to the identical union of corresponding set identification The quantity of entire set is determined as the set of output result.
Optionally, the set combining unit works as element specifically for determining the quantity of the corresponding set identification of each element When corresponding at least two set identification, which is determined as shared element, element is shared to each: this is shared into element pair Each set answered merges, and obtains union, shares the corresponding set of element for the union as this, this is shared element and is corresponded to The set identification of set be revised as the smallest set identification in the shared corresponding each set of element.
Optionally, described device further include:
Second output determination unit, the set for being 1 for the quantity of the corresponding set identification of each element for including are true It is set to one of output result.
Optionally, the first output determination unit, comprising: collective number judgment sub-unit, set to be processed determine son Unit and output determine subelement,
The collective number judgment sub-unit, for judging whether the quantity of the set in the result after this time merging is greater than 1, if it is, the triggering set to be processed determines subelement;Otherwise, it triggers the output and determines subelement;
The set to be processed determines subelement, for the set in this result after merging to be determined as collection to be processed It closes, and triggers the relation determination unit;
The output determines subelement, for being determined as the set in this result after merging to export one of result, And each output result is exported.
By above-mentioned technical proposal, a kind of merging method having intersection set provided by the invention and device can be obtained Multiple set to be processed determine element, set, the corresponding pass between set identification according to element and the attaching relation of set System;The quantity for determining the corresponding set identification of each element closes the corresponding set of at least one element according to the quantity And handle, obtain union;The corresponding relationship between each union and set identification is established, by the identical union of corresponding set identification It merges;The quantity of the entire set obtained after being merged according to the identical union of corresponding set identification is determined as defeated The set of result out.The present invention can quickly be handled a large amount of set, will wherein have the set of intersection to merge, So that it is determined that there is the relationship in the set of intersection between each set element.
The above description is only an overview of the technical scheme of the present invention, in order to better understand the technical means of the present invention, And it can be implemented in accordance with the contents of the specification, and in order to allow above and other objects of the present invention, feature and advantage can It is clearer and more comprehensible, the followings are specific embodiments of the present invention.
Detailed description of the invention
By reading the following detailed description of the preferred embodiment, various other advantages and benefits are common for this field Technical staff will become clear.The drawings are only for the purpose of illustrating a preferred embodiment, and is not considered as to the present invention Limitation.And throughout the drawings, the same reference numbers will be used to refer to the same parts.In the accompanying drawings:
Fig. 1 shows a kind of flow chart of merging method for having intersection set provided in an embodiment of the present invention;
Fig. 2 shows the flow charts that another kind provided in an embodiment of the present invention has the merging method of intersection set;
Fig. 3 shows a kind of structural schematic diagram of merging device for having intersection set provided in an embodiment of the present invention.
Specific embodiment
Exemplary embodiments of the present disclosure are described in more detail below with reference to accompanying drawings.Although showing the disclosure in attached drawing Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure It is fully disclosed to those skilled in the art.
As shown in Figure 1, may include: the embodiment of the invention provides a kind of merging method for having intersection set
S100, multiple set to be processed are obtained, element, set, set is determined according to the attaching relation of element and set Corresponding relationship between mark;
It in other embodiments of the present invention, can also be to be processed to each after obtaining multiple set to be processed Set carries out element duplicate removal processing, and identical element is avoided to occur in a set.
Wherein, the corresponding relationship can be described to be determined according to element and the attaching relation of set by data to embodiment Element, set, the corresponding relationship between set identification, can specifically include:
Unique set identification is respectively set for each set to be processed, generates comprising set identification and set First data pair;
The element of the first data centering set is unfolded, generates the second data comprising element and first data pair It is right.
Wherein, the data in the present invention are to can be pair pairs.Set expression, unique set identification can be used in set Setid expression can be used, element expression can be used in element, and the first data are to can be used pair to (setid, set) It indicates;Second data to can be used pair to (element, (setid, set)) indicate.
Wherein, pair is defined on header file to being stay in place form in c++<utility>in, one is provided comprising 2 The structural body template of data member.It is understood that the set of each pair centering is the set comprising element, rather than set name Word.
S200, the quantity for determining the corresponding set identification of each element, it is corresponding at least one element according to the quantity Set merges processing, obtains union;
Wherein, step S200 merges processing according to quantity set corresponding at least one element, obtains simultaneously The process of collection can specifically include:
When corresponding at least two set identification of element, which is determined as shared element, element is shared to each: This is shared the corresponding each set of element to merge, union is obtained, shares the corresponding set of element for the union as this, it will The set identification of the shared corresponding set of element is revised as the smallest set identification in the shared corresponding each set of element.
It is understood that then illustrating the element at least two set when corresponding at least two set of element In the presence of namely it is described at least two set have intersection, they can be merged at this time.When element only corresponds to a set When, then illustrate that the element only exists in a set.
Optionally, another kind provided in an embodiment of the present invention has the merging method of intersection set, can also include:
By comprising the quantity of the corresponding set identification of each element be that 1 set is determined as exporting one of result.
It is understood that then illustrating in the set when the quantity of the corresponding set of each element in a set is 1 Each element be not present in other set to be processed, namely: the set and other set to be processed, can be with without intersection Using the set as one of output result.By this processing mode, collection of the set to be processed with other without intersection is allowed for It closes directly as output result and no longer carries out subsequent step, reduce the data volume of subsequent step processing, it is superfluous to reduce data It is remaining.
Wherein, the quantity of the corresponding set of the determining each element may include:
To each element: the quantity of the element corresponding set identification in the second all data pair is determined, by the number Amount is determined as the quantity of the corresponding set of the element.
Specifically, described to each element: determining the element corresponding set identification in the second all data pair The quantity is determined as the quantity of the corresponding set of the element, may include: by quantity
It is that index is grouped pair to (element, (setid, set)) with element, obtains pair pairs (element, list (setid, set)), it is corresponding to element in (element, list (setid, set)) according to pair Setid quantity determines the quantity of the corresponding set of element.
Wherein, list (setid, set) is the list of element corresponding (setid, set).
It is described that element is shared to each: this being shared into the corresponding each set of element and is merged, obtains union, simultaneously by this Collection is revised as the shared element pair as the shared corresponding set of element, by the set identification for sharing the corresponding set of element Answer it is each set in the smallest set identification, may include:
Element is shared to each: using this share element as the pair of element to (element, list (setid, Set each set set in the list (setid, set) in)) merges, and obtains pair to (element, (setid, set)), In, pair is pair in (element, list (setid, set)) to the setid in (element, (setid, set)) The smallest set identification setid in list (setid, set).
S300, establish corresponding relationship between each union and set identification, by the identical union of corresponding set identification into Row merges;
Wherein, the corresponding relationship between each union and set identification is established, may include:
Pair is transformed to pair to (setid, set) to (element, (setid, set)).
Specifically, the identical union of corresponding set identification is merged, may include:
With setid be key to pair to (setid, set)) be grouped, obtain pair to (setid, list (set));
Pair is traversed to (setid, list (set)), list (set) is merged into a set set, obtains pair pairs (setid, set).
The determining work of quantity of S400, the entire set obtained after being merged according to the identical union of corresponding set identification For the set for exporting result.
Wherein, as shown in Fig. 2, step S400 may include:
Whether the quantity of the set in result after S410, judgement this time merging is greater than 1, if so, thening follow the steps S420;Otherwise, step S430 is executed;
S420, the set in this result after merging is determined as set to be processed, returns to step S100;
If the collective number that the corresponding set of each set identification obtains after merging is greater than 1, illustrate set not Merge and complete, needs to merge again.
S430, the set in this result after merging is determined as to export one of result;
S440, each output result is exported.
If the collective number that the corresponding set of each set identification obtains after merging is 1, illustrate each set merging A set has only been obtained afterwards, this set is the result after merging to all set for having intersection.
The present invention can quickly be handled a large amount of set, will wherein have the set of intersection to merge, thus Determine the relationship in the set for having intersection between each set element.
For convenience of understanding, embodiment illustrated in fig. 2 is illustrated below, it should be noted that the step 1 of lower section to Step 15 is not corresponded with embodiment illustrated in fig. 1 step S100 to step S440:
If there are three set to be processed, it is respectively as follows:
Set a:(identity card 1, name 1, identity card 2, name 2);
Set b:(identity card 1, cell-phone number 1, identity card 3, cell-phone number 3);
Set c:(cell-phone number 3, address 3, cell-phone number 4, address 4).
Step 1, be set a, unique set identification is respectively set is 001,002,003 by set b, set c, generate as follows Pair pairs:
(001, (identity card 1, name 1, identity card 2, name 2));
(002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3));
(003, (cell-phone number 3, address 3, cell-phone number 4, address 4)).
Step 2, the quantity for determining the corresponding set identification of each element, due to having element corresponding in above three set Set identification is greater than 1, therefore above three set can not be directly as output result.In above three set, identity card 1, hand The corresponding set identification of the two elements of machine number 3 is two, the two elements are determined as shared element, shared according to the two The corresponding relationship of element and set identification obtains pair pairs:
(001, identity card 1);
(002, identity card 1);
(002, cell-phone number 3);
(003, cell-phone number 3).
Step 3, by pair pairs in step 2 with the pair in step 1 to merging, obtain:
(001, (identity card 1, name 1, identity card 2, name 2), identity card 1));
(002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3), (identity card 1, cell-phone number 3));
(003, (cell-phone number 3, address 3, cell-phone number 4, address 4), cell-phone number 3).
If there is set identification does not have corresponding shared element, then the corresponding set of the set identification is exported.
Step 4, pair pairs obtained with shared element for key deployment step 3, obtain following pair pairs:
(identity card 1,001, (identity card 1, name 1, identity card 2, name 2));
(identity card 1,002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3));
(cell-phone number 3,002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3));
(cell-phone number 3,003, (cell-phone number 3, address 3, cell-phone number 4, address 4)).
Step 5, to share pair that element obtains step 4 to grouping, obtain following pair pairs:
(identity card 1, (001, (identity card 1, name 1, identity card 2, name 2)), (002, (identity card 1, cell-phone number 1, body Part card 3, cell-phone number 3)));
(cell-phone number 3,002, ((identity card 1, cell-phone number 1, identity card 3, cell-phone number 3)), (003, (cell-phone number 3, address 3, Cell-phone number 4, address 4))).
Step 6 merges the set of pair centering obtained in step 5, and each set merged is corresponding The smallest corresponding set identification of set as after merging in set identification, obtains following pair pairs:
(identity card 1,001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3));
(cell-phone number 3,002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3, address 3, cell-phone number 4, address 4)).
Step 7 will obtain pair to being transformed to following pair pairs in step 6:
(001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3));
(002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3, address 3, cell-phone number 4, address 4)).
Step 8 merges the identical union of the corresponding set identification of pair centering that step 7 obtains, and obtains Pair pairs identical as step 7.The quantity of the set in result after this time merging is 2, (be greater than 1), therefore after this is merged Result in set be determined as set to be processed, execute step 9;
Step 9, the quantity for determining the corresponding set identification of pair centering each element that step 8 obtains, since step 8 obtains Pair centering two set in have the corresponding set identification of element quantity be greater than 1, therefore the two set can not be direct As output result.In the two set, this corresponding set of 4 elements of identity card 1, cell-phone number 1, identity card 3, cell-phone number 3 Two are identified as, this 4 elements are determined as shared element, are obtained according to the corresponding relationship of this 4 shared elements and set identification To pair pairs:
(001, identity card 1);
(002, identity card 1);
(001, cell-phone number 1);
(002, cell-phone number 1);
(001, cell-phone number 3);
(002, cell-phone number 3);
(001, identity card 3);
(002, identity card 3).
Step 10, the pair couples of pair obtained with step 8 for obtaining step 9 obtain pair pairs to merging:
(001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3), (identity card 1, Cell-phone number 1, identity card 3, cell-phone number 3));
(002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3, address 3, cell-phone number 4, address 4), (identity card 1, Cell-phone number 1, identity card 3, cell-phone number 3)).
It, can not be directly as output as a result, need to continue to close since the two pair centerings have shared element And.
Step 11, pair pairs obtained with shared element for key deployment step 10, obtain following pair pairs:
(identity card 1,001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3));
(cell-phone number 1,001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3));
(cell-phone number 3,001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3));
(identity card 3,001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3));
(identity card 1,002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3, address 3, cell-phone number 4, address 4));
(cell-phone number 1,002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3, address 3, cell-phone number 4, address 4));
(cell-phone number 3,002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3, address 3, cell-phone number 4, address 4));
(identity card 3,002, (identity card 1, cell-phone number 1, identity card 3, cell-phone number 3, address 3, cell-phone number 4, address 4)).
Step 12 (is specifically grouped to grouping and merging to share element to the pair that step 11 obtains and Merge Scenarios is asked Referring to step 5 and step 6), following pair pairs is obtained:
(identity card 1,001, (identity card 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3, is lived at name 1 Location 3, cell-phone number 4, address 4));
(cell-phone number 1,001, (identity card 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3, is lived at name 1 Location 3, cell-phone number 4, address 4));
(cell-phone number 3,001, (identity card 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3, is lived at name 1 Location 3, cell-phone number 4, address 4));
(identity card 3,001, (identity card 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3, is lived at name 1 Location 3, cell-phone number 4, address 4)).
Step 13 will obtain pair to being transformed to following pair pairs in step 12:
(001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3, address 3, mobile phone Number 4, address 4));
(001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3, address 3, mobile phone Number 4, address 4));
(001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3, address 3, mobile phone Number 4, address 4));
(001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3, address 3, mobile phone Number 4, address 4)).
Step 14 merges the identical union of the corresponding set identification of pair centering that step 13 obtains, and obtains Pair pairs:
(001, (identity card 1, name 1, identity card 2, name 2, cell-phone number 1, identity card 3, cell-phone number 3, address 3, mobile phone Number 4, address 4)).
The quantity of the set in result after this time merging is 1, and the set in result after this is merged is determined as defeated One of result out.
Step 15 exports each output result.
Corresponding with above method embodiment, the present invention also provides a kind of merging devices for having intersection set.
As shown in figure 3, a kind of merging device for having intersection set provided in an embodiment of the present invention, may include: that relationship is true Order member 100, set combining unit 200, union combining unit 300 and the first output determination unit 400,
The relation determination unit 100, for obtaining multiple set to be processed, according to the attaching relation of element and set Determine element, set, the corresponding relationship between set identification;
In other embodiments of the present invention, relation determination unit 100, can also be right after obtaining multiple set to be processed Each set to be processed carries out element duplicate removal processing, and identical element is avoided to occur in a set.
Wherein, the corresponding relationship can be by data to embodiment, and the relation determination unit 100 may include: mark Subelement is set and subelement is unfolded in element,
Subelement is arranged in the mark, for obtaining multiple set to be processed, for each set to be processed point Unique set identification is not set, the first data pair comprising set identification and set are generated;
Subelement is unfolded in the element, for the element of the first data centering set to be unfolded, generate comprising element and Second data pair of first data pair.
Wherein, the data in the present invention are to can be pair pairs.Set expression, unique set identification can be used in set Setid expression can be used, element expression can be used in element, and the first data are to can be used pair to (setid, set) It indicates;Second data to can be used pair to (element, (setid, set)) indicate.
Wherein, pair is defined on header file to being stay in place form in c++<utility>in, one is provided comprising 2 The structural body template of data member.It is understood that the set of each pair centering is the set comprising element, rather than set name Word.
The set combining unit 200, for determining the quantity of the corresponding set identification of each element, according to the quantity pair The corresponding set of at least one element merges processing, obtains union;
Optionally, the set combining unit 200 can be specifically used for determining the number of the corresponding set identification of each element The element is determined as shared element, shares element to each: by this by amount when corresponding at least two set identification of element It shares the corresponding each set of element to merge, obtains union, share the corresponding set of element for the union as this, this is total to There is the set identification of the corresponding set of element to be revised as the smallest set identification in the shared corresponding each set of element.
It is understood that then illustrating the element at least two set when corresponding at least two set of element In the presence of namely it is described at least two set have intersection, they can be merged at this time.When element only corresponds to a set When, then illustrate that the element only exists in a set.
Wherein, the set combining unit 200 can be specifically used for:
To each element: the quantity of the element corresponding set identification in the second all data pair is determined, by the number Amount is determined as the quantity of the corresponding set of the element, merges place according to quantity set corresponding at least one element Reason, obtains union.
Further, set combining unit 200 can be specifically used for:
It is that index is grouped pair to (element, (setid, set)) with element, obtains pair pairs (element, list (setid, set)), it is corresponding to element in (element, list (setid, set)) according to pair Setid quantity determines the quantity of the corresponding set of element;
Element is shared to each: using this share element as the pair of element to (element, list (setid, Set each set set in the list (setid, set) in)) merges, and obtains pair to (element, (setid, set)), In, pair is pair in (element, list (setid, set)) to the setid in (element, (setid, set)) The smallest set identification setid in list (setid, set).
Wherein, list (setid, set) is the list of element corresponding (setid, set).
Optionally, can also include: in the merging device that another kind provided in an embodiment of the present invention has intersection set
Second output determination unit, the set for being 1 for the quantity of the corresponding set identification of each element for including are true It is set to one of output result.
It is understood that then illustrating in the set when the quantity of the corresponding set of each element in a set is 1 Each element be not present in other set to be processed, namely: the set and other set to be processed, can be with without intersection Using the set as one of output result.By this processing mode, collection of the set to be processed with other without intersection is allowed for It closes directly as output result and no longer carries out subsequent step, reduce the data volume of subsequent step processing, it is superfluous to reduce data It is remaining.
The union combining unit 300, the corresponding relationship for establishing between each union and set identification, by corresponding collection The identical union of mark is closed to merge;
Optionally, union combining unit 300 can be specifically used for:
Pair is transformed to pair to (setid, set) to (element, (setid, set));
With setid be key to pair to (setid, set)) be grouped, obtain pair to (setid, list (set));
Pair is traversed to (setid, list (set)), list (set) is merged into a set set, obtains pair pairs (setid, set).
The first output determination unit 400, for being obtained after being merged according to the identical union of corresponding set identification To entire set quantity be determined as output result set.
Wherein, the first output determination unit 400 may include: collective number judgment sub-unit, the determining son of set to be processed Unit and output determine subelement,
The collective number judgment sub-unit, for judging whether the quantity of the set in the result after this time merging is greater than 1, if it is, the triggering set to be processed determines subelement;Otherwise, it triggers the output and determines subelement;
If the collective number that the corresponding set of each set identification obtains after merging is greater than 1, illustrate set not Merge and complete, needs to merge again.
The set to be processed determines subelement, for the set in this result after merging to be determined as collection to be processed It closes, and triggers the relation determination unit;
The output determines subelement, for being determined as the set in this result after merging to export one of result, And each output result is exported.
If the collective number that the corresponding set of each set identification obtains after merging is 1, illustrate each set merging A set has only been obtained afterwards, this set is the result after merging to all set for having intersection.
The present invention can quickly be handled a large amount of set, will wherein have the set of intersection to merge, thus Determine the relationship in the set for having intersection between each set element.
The merging device for having intersection set includes processor and memory, and above-mentioned relation determination unit, set merge Unit, union combining unit and first output determination unit etc. store in memory as program unit, are held by processor Above procedure unit stored in memory go to realize corresponding function.
Include kernel in processor, is gone in memory to transfer corresponding program unit by kernel.Kernel can be set one Or more, the merging of intersection set is realized by adjusting kernel parameter.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/ Or the forms such as Nonvolatile memory, if read-only memory (ROM) or flash memory (flash RAM), memory include that at least one is deposited Store up chip.
The embodiment of the invention provides a kind of storage mediums, are stored thereon with program, real when which is executed by processor The existing merging method for having intersection set.
The embodiment of the invention provides a kind of processor, the processor is for running program, wherein described program operation There is the merging method of intersection set described in Shi Zhihang.
The embodiment of the invention provides a kind of equipment, equipment include processor, memory and storage on a memory and can The program run on a processor, processor perform the steps of when executing program
A kind of merging method having intersection set, comprising:
Obtain multiple set to be processed, according to the attaching relation of element and set determine element, set, set identification it Between corresponding relationship;
The quantity for determining the corresponding set identification of each element, according to the quantity it is corresponding at least one element gather into Row merging treatment, obtains union;
The corresponding relationship between each union and set identification is established, the identical union of corresponding set identification is closed And;
The quantity of the entire set obtained after being merged according to the identical union of corresponding set identification is determined as defeated The set of result out.
Optionally, described that processing is merged according to quantity set corresponding at least one element, union is obtained, Include:
When corresponding at least two set identification of element, which is determined as shared element, element is shared to each: This is shared the corresponding each set of element to merge, union is obtained, shares the corresponding set of element for the union as this, it will The set identification of the shared corresponding set of element is revised as the smallest set identification in the shared corresponding each set of element.
Optionally, the method also includes:
By comprising the quantity of the corresponding set identification of each element be that 1 set is determined as exporting one of result.
Optionally, it is described merged according to the identical union of corresponding set identification after the obtained quantity of entire set It is determined as the set of output result, comprising:
Whether the quantity of the set in result after judgement this time merging is greater than 1, if it is, by this knot after merging Set in fruit is determined as set to be processed, returns to the acquisition multiple set to be processed, and return with what is gathered according to element Category relationship determines the step of element, set, corresponding relationship between set identification;Otherwise, in the result by this after merging Set is determined as exporting one of result, and each output result is exported.
Optionally, the corresponding relationship by data to embodiment, it is described that member is determined according to element and the attaching relation of set Element is gathered, the corresponding relationship between set identification, comprising:
Unique set identification is respectively set for each set to be processed, generates comprising set identification and set First data pair;
The element of the first data centering set is unfolded, generates the second data comprising element and first data pair It is right.
Optionally, the quantity of the corresponding set of the determining each element, comprising:
To each element: the quantity of the element corresponding set identification in the second all data pair is determined, by the number Amount is determined as the quantity of the corresponding set of the element.
Equipment herein can be server, PC, PAD, mobile phone etc..
Present invention also provides a kind of computer program products, when executing on data processing equipment, are adapted for carrying out just The program of beginningization there are as below methods step:
A kind of merging method having intersection set, comprising:
Obtain multiple set to be processed, according to the attaching relation of element and set determine element, set, set identification it Between corresponding relationship;
The quantity for determining the corresponding set identification of each element, according to the quantity it is corresponding at least one element gather into Row merging treatment, obtains union;
The corresponding relationship between each union and set identification is established, the identical union of corresponding set identification is closed And;
The quantity of the entire set obtained after being merged according to the identical union of corresponding set identification is determined as defeated The set of result out.
Optionally, described that processing is merged according to quantity set corresponding at least one element, union is obtained, Include:
When corresponding at least two set identification of element, which is determined as shared element, element is shared to each: This is shared the corresponding each set of element to merge, union is obtained, shares the corresponding set of element for the union as this, it will The set identification of the shared corresponding set of element is revised as the smallest set identification in the shared corresponding each set of element.
Optionally, the method also includes:
By comprising the quantity of the corresponding set identification of each element be that 1 set is determined as exporting one of result.
Optionally, it is described merged according to the identical union of corresponding set identification after the obtained quantity of entire set It is determined as the set of output result, comprising:
Whether the quantity of the set in result after judgement this time merging is greater than 1, if it is, by this knot after merging Set in fruit is determined as set to be processed, returns to the acquisition multiple set to be processed, and return with what is gathered according to element Category relationship determines the step of element, set, corresponding relationship between set identification;Otherwise, in the result by this after merging Set is determined as exporting one of result, and each output result is exported.
Optionally, the corresponding relationship by data to embodiment, it is described that member is determined according to element and the attaching relation of set Element is gathered, the corresponding relationship between set identification, comprising:
Unique set identification is respectively set for each set to be processed, generates comprising set identification and set First data pair;
The element of the first data centering set is unfolded, generates the second data comprising element and first data pair It is right.
Optionally, the quantity of the corresponding set of the determining each element, comprising:
To each element: the quantity of the element corresponding set identification in the second all data pair is determined, by the number Amount is determined as the quantity of the corresponding set of the element.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
In a typical configuration, calculating equipment includes one or more processors (CPU), input/output interface, net Network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/ Or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable Jie The example of matter.
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.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including element There is also other identical elements in process, method, commodity or equipment.
It will be understood by those skilled in the art that embodiments herein can provide as method, system or computer program product. Therefore, complete hardware embodiment, complete software embodiment or embodiment combining software and hardware aspects can be used in the application Form.It is deposited moreover, the application can be used to can be used in the computer that one or more wherein includes computer usable program code The shape for the computer program product implemented on storage media (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) Formula.
The above is only embodiments herein, are not intended to limit this application.To those skilled in the art, Various changes and changes are possible in this application.It is all within the spirit and principles of the present application made by any modification, equivalent replacement, Improve etc., it should be included within the scope of the claims of this application.

Claims (10)

1. a kind of merging method for having intersection set characterized by comprising
Multiple set to be processed are obtained, element, set are determined, between set identification according to the attaching relation of element and set Corresponding relationship;
The quantity for determining the corresponding set identification of each element closes the corresponding set of at least one element according to the quantity And handle, obtain union;
The corresponding relationship between each union and set identification is established, the identical union of corresponding set identification is merged;
The quantity of the entire set obtained after being merged according to the identical union of corresponding set identification is determined as output knot The set of fruit.
2. the method according to claim 1, wherein described corresponding at least one element according to the quantity Set merges processing, obtains union, comprising:
When corresponding at least two set identification of element, which is determined as shared element, element is shared to each: by this It shares the corresponding each set of element to merge, obtains union, share the corresponding set of element for the union as this, this is total to There is the set identification of the corresponding set of element to be revised as the smallest set identification in the shared corresponding each set of element.
3. according to the method described in claim 2, it is characterized in that, the method also includes:
By comprising the quantity of the corresponding set identification of each element be that 1 set is determined as exporting one of result.
4. according to the method in any one of claims 1 to 3, which is characterized in that described according to corresponding set identification phase The quantity for the entire set that same union obtains after merging is determined as the set of output result, comprising:
Whether the quantity of the set in result after judgement this time merging is greater than 1, if it is, by this result after merging Set be determined as set to be processed, return it is described obtain multiple set to be processed, and closed according to the ownership of element and set It is the step of determining element, set, corresponding relationship between set identification;Otherwise, the set in the result by this after merging It is determined as exporting one of result, and each output result is exported.
5. the method according to claim 1, wherein the corresponding relationship is by data to embodiment, the basis Element and the attaching relation of set determine element, set, the corresponding relationship between set identification, comprising:
Unique set identification is respectively set for each set to be processed, generates first comprising set identification and set Data pair;
The element of the first data centering set is unfolded, generates the second data pair comprising element and first data pair.
6. according to the method described in claim 5, it is characterized in that, the quantity of the corresponding set of the determining each element, comprising:
To each element: determine the quantity of the element corresponding set identification in the second all data pair, the quantity is true It is set to the quantity of the corresponding set of the element.
7. a kind of merging device for having intersection set characterized by comprising relation determination unit, set combining unit, union Combining unit and the first output determination unit,
The relation determination unit determines member according to element and the attaching relation of set for obtaining multiple set to be processed Element is gathered, the corresponding relationship between set identification;
The set combining unit, for determining the quantity of the corresponding set identification of each element, according to the quantity at least one The corresponding set of a element merges processing, obtains union;
The union combining unit, the corresponding relationship for establishing between each union and set identification, by corresponding set identification Identical union merges;
The first output determination unit, the whole for being obtained after being merged according to the identical union of corresponding set identification The quantity of set is determined as the set of output result.
8. device according to claim 7, which is characterized in that the set combining unit is specifically used for determining each element The element is determined as shared element, to every when corresponding at least two set identification of element by the quantity of corresponding set identification One shared element: this is shared into the corresponding each set of element and is merged, union is obtained, shares element using the union as this The set identification for sharing the corresponding set of element is revised as minimum in the shared corresponding each set of element by corresponding set Set identification.
9. device according to claim 8, which is characterized in that described device further include:
Second output determination unit, for the set that the quantity of the corresponding set identification of each element for including is 1 to be determined as Export one of result.
10. device according to any one of claims 7 to 9, which is characterized in that the first output determination unit, packet Include: collective number judgment sub-unit, set to be processed, which determine subelement and export, determines subelement,
The collective number judgment sub-unit, for judging whether the quantity of the set in the result after this time merging is greater than 1, such as Fruit is then to trigger the set to be processed to determine subelement;Otherwise, it triggers the output and determines subelement;
The set to be processed determines subelement, for the set in this result after merging to be determined as set to be processed, And trigger the relation determination unit;
The output determines subelement, for being determined as the set in this result after merging to export one of result, and will Each output result output.
CN201710413952.XA 2017-06-05 2017-06-05 There are the merging method and device of intersection set Pending CN108984573A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710413952.XA CN108984573A (en) 2017-06-05 2017-06-05 There are the merging method and device of intersection set

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710413952.XA CN108984573A (en) 2017-06-05 2017-06-05 There are the merging method and device of intersection set

Publications (1)

Publication Number Publication Date
CN108984573A true CN108984573A (en) 2018-12-11

Family

ID=64501946

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710413952.XA Pending CN108984573A (en) 2017-06-05 2017-06-05 There are the merging method and device of intersection set

Country Status (1)

Country Link
CN (1) CN108984573A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020138353A1 (en) * 2000-05-03 2002-09-26 Zvi Schreiber Method and system for analysis of database records having fields with sets
CN1523522A (en) * 2003-02-18 2004-08-25 ������������ʽ���� Method and system for finding a K order statistic in a union of sorted sets
CN103279532A (en) * 2013-05-31 2013-09-04 北京鹏宇成软件技术有限公司 Filtering system and filtering method for removing duplication of elements of multiple sets and identifying belonged sets
CN103559263A (en) * 2013-11-04 2014-02-05 北京奇虎科技有限公司 Method and system for merging plurality of images
CN106547811A (en) * 2015-09-22 2017-03-29 国际商业机器公司 The distributed merging of data set
CN106649334A (en) * 2015-10-29 2017-05-10 北京国双科技有限公司 Conjunction word set processing method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020138353A1 (en) * 2000-05-03 2002-09-26 Zvi Schreiber Method and system for analysis of database records having fields with sets
CN1523522A (en) * 2003-02-18 2004-08-25 ������������ʽ���� Method and system for finding a K order statistic in a union of sorted sets
CN103279532A (en) * 2013-05-31 2013-09-04 北京鹏宇成软件技术有限公司 Filtering system and filtering method for removing duplication of elements of multiple sets and identifying belonged sets
CN103559263A (en) * 2013-11-04 2014-02-05 北京奇虎科技有限公司 Method and system for merging plurality of images
CN106547811A (en) * 2015-09-22 2017-03-29 国际商业机器公司 The distributed merging of data set
CN106649334A (en) * 2015-10-29 2017-05-10 北京国双科技有限公司 Conjunction word set processing method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
HOOMAN TAHAYORI; ALIREZA SADEGHIAN; ANDREA VISCONTI: "Operations on type-2 fuzzy sets based on the set of pseudo-highest intersection points of convex fuzzy sets", 《2010 ANNUAL MEETING OF THE NORTH AMERICAN FUZZY INFORMATION PROCESSING SOCIETY》 *
孙茂华胡磊朱洪亮李祺: "布尔电路上保护隐私集合并集运算的研究与实现", 《电子与信息学报》 *

Similar Documents

Publication Publication Date Title
CN109582716A (en) Data visualization treating method and apparatus
CN106372977B (en) A kind of processing method and equipment of virtual account
CN108650684A (en) A kind of correlation rule determines method and device
CN110019298A (en) Data processing method and device
CN110380985A (en) Flow control methods, device, equipment and storage medium based on trade link
CN110457182A (en) A kind of load balancing cluster example operating index monitoring system
CN114610475A (en) Training method of intelligent resource arrangement model
CN112839055B (en) Network application identification method and device for TLS encrypted traffic and electronic equipment
CN110019449A (en) There are the merging method and device of intersection set
WO2021120845A1 (en) Homogeneous risk unit feature set generation method, apparatus and device, and medium
CN106294530A (en) The method and system of rule match
CN106484881A (en) Document handling method and device
CN109558432A (en) Data processing method and device
CN109508791A (en) Vehicle damage management method
CN108984573A (en) There are the merging method and device of intersection set
CN105740274B (en) User account lookup method and device based on non-directed graph
CN110069529A (en) Process of aggregation method and device
CN108845844A (en) A kind of state transition method and device
CN110083437A (en) Handle the method and device of block chain affairs
CN109582396A (en) A kind of task status processing method, device, system and storage medium
CN110019544A (en) Data query method and system
CN110019357A (en) Data base querying scenario generation method and device
CN110019295A (en) Database index method, device, system and storage medium
CN110147404A (en) Data processing method and device
CN108076450A (en) A kind of method and device for identifying same user

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100080 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing

Applicant after: BEIJING GRIDSUM TECHNOLOGY Co.,Ltd.

Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing

Applicant before: BEIJING GRIDSUM TECHNOLOGY Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20181211