A kind of relation data processing method and equipment
Technical field
The application is related to communication technical field, more particularly to a kind of relation data processing method.The application also relates to a kind of relation data processing equipment.
Background technology
With the continuous development of internet, people increasingly tend to carry out activity and communication with other users by website and other platforms.For the network user, website or platform typically provide exclusive service by registering account number as it.The network user is mutually linked by its user name each oneself drafted in a network in internet, therefore the relational network and relation data of magnanimity are there is in internet.
Relational network is a kind of organizational form based on " network " (being connected with each other between node) rather than " colony " (clear and definite border and order), and this network is associated based on certain relation.For example, A, B are associated by relation one, B, and C is associated by relation two, and C, D are associated by relation three etc., then A, B, C, D etc. are based on various associations and are built into a network.In prior art generally by way of the visualization of implementation relation and network and static chart or interactive visual representing come implementation relation network, so as to further be excavated or matching treatment to data.
For platform operation business, with the development of its business, the data of accumulation will be more and more, and the various relations and structure relational network that contain in excavation mass data can preferably meet the analysis demand of business team.However, building for conventional relationship network generally is directed to the special relation data processing scheme of specific environment customisations, i.e., can only be processed for a certain relationship type.When new relationship type is occurred in that, need to develop again during expansion relation.Various uncertainty relationships in big data, because the species of relation is various, technical staff has often been difficult to energy for going to develop a set of code per class relation.
As can be seen here, it is higher that relation data processing scheme in the face of each conventional relationship network of the prior art customizes degree, need to arrange or develop different processing schemes for different relation datas, lack extensibility, in the case of in the face of massive relation data, prior art work disposal inefficiency.
The content of the invention
This application provides a kind of relation data processing method, to the quick horizontal extension of implementation relation network, so as to reducing resource overhead and lifting resource utilization.The method is comprised the following steps:
Determine the main information of each main body in relation data, and the relation information between the main body, the main body includes the first main body and the second main body, the main information at least includes main body value, body attribute and type ID corresponding with type of subject of the main body, and the relation information at least includes relations I D corresponding with relationship type;
Relation body table corresponding with the type of subject of first main body is obtained, the relation body table includes type ID of first main body and the corresponding relation of the body attribute of first main body;
The first list item, second list item comprising relations I D with the corresponding relation of type ID of second main body of type ID comprising first main body, and the 3rd list item comprising the relation information are generated respectively;
Set up the main body value corresponding relation of first list item, second list item, the 3rd list item, the relation body table and first main body.
Preferably, methods described is applied to the relational network adaptation layer in relational network system, and the relational network system also includes data Layer, relation Business Logic and front end presentation layer;
Wherein, the relational network adaptation layer is on the data Layer.
Preferably, first list item, second list item, the 3rd list item and the relation body table are configured at the relational network adaptation layer;Shown relation data is generated according to default total relation data interface protocol specification.
Preferably, the first list item corresponding with the type of subject is obtained, specially:
The current relation body table with the presence or absence of type ID comprising first main body of inquiry;
If existing, using the relation body table as first list item;
If not existing, the relation body table of type ID comprising first main body is created, and using the relation body table as first list item.
Preferably, after the main body value corresponding relation for setting up first list item, second list item, the 3rd list item, the relation body table and first main body, also include:
When the relational data access request for coming from user is received, according to the relation body table that there is currently, to the user currently valid type of subject is shown;
Corresponding relation according to corresponding to the main body value of the type of subject, relationship type and input that select with the user, obtains relation data corresponding with the corresponding relation;
According to the relation data production Methods network, and show the relational network to the user.
Preferably, the corresponding relation according to corresponding to the main body value of the type of subject, relationship type and input that select with the user obtains relation data corresponding with the corresponding relation, specially:
The type of subject selected according to the user and the main body value of input, obtain the first list item corresponding with type ID of the type of subject and main body value;
According to the corresponding relation, currently the second list item corresponding with first list item is obtained;
According to the second acquired list item to the user show currently with type ID and the main body corresponding relationship type of value;
According to the configuration information of the user input, and corresponding second list item of selected relationship type, it is determined that with second list item, first list item and the main body corresponding corresponding relation of value;
The relation data is generated according to the corresponding relation.
Preferably, the 4th list item and the 5th list item are also included in the relation data, the 4th list item includes the corresponding relation of relations I D and main body display properties, and the 5th list item includes the corresponding relation of type ID and relation display properties.
Preferably, according to the relation data production Methods network, and the relational network is shown to the user, specially:
Filtered and rendered according to the main body display properties of the 4th list item and the relation display properties of the 5th list item.
Correspondingly, present invention also provides a kind of relation data processing equipment, including:
Determining module, the main information of each main body in for determining relation data, and the relation information between the main body, the main body includes the first main body and the second main body, the main information at least includes main body value, body attribute and type ID corresponding with type of subject of the main body, and the relation information at least includes relations I D corresponding with relationship type;
Acquisition module, for obtaining relation body table corresponding with the type of subject of first main body, the relation body table includes type ID of first main body and the corresponding relation of the body attribute of first main body;
Generation module, for generating the first list item of type ID comprising first main body, the second list item comprising relations I D with the corresponding relation of type ID of second main body, and the 3rd list item comprising the relation information respectively;
Module is set up, for setting up first list item, second list item, the 3rd list item, the relation body table and the main body value corresponding relation of first main body.
Preferably, methods described is applied in relational network system as relational network adaptation layer, and the relational network system also includes data Layer, relation Business Logic and front end presentation layer;Wherein, the relational network adaptation layer is on the data Layer.
Preferably, first list item, second list item, the 3rd list item and the relation body table are configured at the relational network adaptation layer;Shown relation data is generated according to default total relation data interface protocol specification.
Preferably, the acquisition module obtains the first list item corresponding with the type of subject, specially:
The current relation body table with the presence or absence of type ID comprising first main body of inquiry;
If existing, using the relation body table as first list item;
If not existing, the relation body table of type ID comprising first main body is created, and using the relation body table as first list item.
Preferably, the module of setting up also includes after the main body value corresponding relation for setting up first list item, second list item, the 3rd list item, the relation body table and first main body:
When the relational data access request for coming from user is received, according to the relation body table that there is currently, to the user currently valid type of subject is shown;
Corresponding relation according to corresponding to the main body value of the type of subject, relationship type and input that select with the user, obtains relation data corresponding with the corresponding relation;
According to the relation data production Methods network, and show the relational network to the user.
Preferably, the corresponding relation for setting up module according to corresponding to the main body value of the type of subject, relationship type and input that select with the user obtains relation data corresponding with the corresponding relation, specially:
The type of subject selected according to the user and the main body value of input, obtain the first list item corresponding with type ID of the type of subject and main body value;
According to the corresponding relation, currently the second list item corresponding with first list item is obtained;
According to the second acquired list item to the user show currently with type ID and the main body corresponding relationship type of value;
According to the configuration information of the user input, and corresponding second list item of selected relationship type, it is determined that with second list item, first list item and the main body corresponding corresponding relation of value;
The relation data is generated according to the corresponding relation.
Preferably, described foundation in the relation data that module is generated according to the corresponding relation also includes the 4th list item and the 5th list item, 4th list item includes the corresponding relation of relations I D and main body display properties, and the 5th list item includes the corresponding relation of type ID and relation display properties.
Preferably, the module of setting up is according to the relation data production Methods network, and shows the relational network to the user, specially:
Filtered and rendered according to the main body display properties of the 4th list item and the relation display properties of the 5th list item.
By the technical scheme using the application, it is determined that after the relation information in relation data between the main information of each main body and the main body, obtain relation body table corresponding with the type of subject of first main body, and respectively generation includes the first list item of type ID of first main body, the second list item comprising relations I D with the corresponding relation of type ID of second main body, and the 3rd list item comprising the relation information, finally set up first list item, second list item, 3rd list item, the main body value corresponding relation of the relation body table and first main body.The method can not only realize the adaptation of any relation data, reduce the requirement to specific environment, so as to quickly be processed for relation data, reduce resource overhead and lift resource utilization.
Description of the drawings
Fig. 1 is a kind of schematic flow sheet of relation data processing method that the application is proposed;
Fig. 2 is a kind of structural representation of relation data processing equipment that the application is proposed;
Specific embodiment
In view of the technical problem proposed in background technology, present applicant proposes a kind of relation data processing method, the method can not only realize the adaptation processing of any relation data, so as to reducing the requirement to specific environment and providing the quick horizontal extension of relation, but also can decouple data and front end system, only different relation datas need to be provided, it is possible to different relational networks are quickly presented.
In current database development technology, the mode of three-tier architecture (3-tier architecture) is usually taken.Therefore an existing completeness relation network system mainly include three parts such as data Layer, relation Business Logic, front end presentation layer from processing function module to divide in the technical scheme of the application.The function of each layer is as follows:
(1) data access layer:Completed for each operation to data file using each function;
(2) Business Logic:The main operation being responsible for data Layer, and the operation of some data Layers is combined.
(3) front end presentation layer:The main request to user receives, and the return of data, for the access that client provides application program.
For the quick horizontal extension of implementation relation network, so as to reducing resource overhead and lifting resource utilization.Technical scheme with the addition of an adaptation layer on data Layer, referred to herein as " a kind of method and apparatus of the quick horizontal extension of relational network ", for decoupling data and business, to relation data quick extendible service be provided.
As shown in figure 1, a kind of schematic flow sheet of the relation data processing method proposed for the application, comprises the following steps:
Step S101, determine the main information of each main body in relation data, and the relation information between the main body, the main body includes the first main body and the second main body, the main information at least includes main body value, body attribute and type ID corresponding with type of subject of the main body, and the relation information at least includes relations I D corresponding with relationship type.
Quickly extended and decoupled because the application aims to existing relational network system, therefore relational network adaptation layer is provided with the relational network system including data Layer, relation Business Logic and front end presentation layer particular for property in the preferred embodiment of the application, the relational network adaptation layer is on data Layer.In further concrete application scene, the relational network adaptation layer is divided into by function services:Data-interface is serviced and system route service;From data base logic model partition:Including relation database table and route maintenance table two parts, route maintenance table contains the first list item involved in lower subsequent step, the second list item, the 3rd list item and relation body table and is configured at relational network adaptation layer.They are mainly used in safeguarding various relationship metadatas, and provide routing iinformation for front end system, and according to the different query analysis demands of user, by these routing iinformations, obtaining real relation data carries out visualization presentation.
Relation data is used for building the data of relational network, these data are organized according to the total relation data interface protocol that device is provided, for certain relation data, it generally comprises certain relation between multiple objects (generally two objects).For the object included in relation data, the application is classified as main body.One relation data is mainly made up of main body therein and relation.For each main body, the application is provided with unique corresponding mark for its type, value of the information that it is included at least including the main body, the attribute of the main body and with the ID corresponding to the type of the main body.Relationship type equally also has unique corresponding mark ID.Main body CODE is the unique mark of various relation main bodys, for distinguishing different main bodys in relational network;Relation CODE is the unique mark of various relations, for distinguishing different relations in relational network;Require unique.For example:Main body one:Mobile phone, main body two:People, relation:Binding relationship;Here can be defined as:The CODE of mobile phone body:phone;The CODE of user agent:user;The CODE of binding relationship:1001.
Meanwhile, in order to meet different relation scene and consider from versatility requirement, the value of the second main body is designed to the form of KEY-VALUE:K1=V1, K2=V2, K3=V3;The value of the associated plurality of main body two of K1=V4, K2=V5, K3=V6, one main body one, is all put into a field, is stitched together according to K-V format specifications above.
To build extendible relational network, the preferred embodiment of the application has been specifically designed for production Methods data general-purpose relation data interface protocol specification, and during specific use, the normative content is as shown in table 1 below:
Table 1
In order to make relation data evenly distributed as far as possible on the basis of ensureing that data are unique, the application is as follows for the setting protocol specification of the major key ROWKEY of the protocol specification table of relation above data:
It is MD5 (main body 1CODE+ main body 1VALUE+ relation CODE+ main body 2CODE+ date (digits of timestamp 10)+custom attributes (if there is)) (first 8) _ main body 1CODE_ main body 1VALUE_ relation CODE_ main body 2CODE_ dates (digits of timestamp 10) _ amount of money stepping (if there is), as shown in table 2 below:
Table 2
Step S102, obtains relation body table corresponding with the type of subject of first main body, and the relation body table includes type ID of first main body and the corresponding relation of the body attribute of first main body.
In a preferred embodiment, the application is provided with first relation body table, for recording relation data in primary body (the first main body) and its corresponding attribute.In concrete scene, relation body table is mainly used in decoupling the customized development of front end system, there is provided relation menu sheet first comprising the relation menu sheet shown in table 1 below, preserves the menu page content that foreground represents:
Table 3
Simultaneously, for the attribute of relation body table, relation body attribute allocation list can also be in addition set and stored, it is mainly used in preserving body attribute configuration information, code, front end page including main body needs attribute and display type for showing etc., as shown in table 4 below:
Table 4
It should be noted that being only a kind of preferred embodiment that the application specific embodiment is proposed as explanation " relation body table " with upper table 3 and table 4, other can realize that the scheme of effect same belongs to the protection domain of the application.
Step S103, generates respectively the first list item, second list item comprising relations I D with the corresponding relation of type ID of second main body of type ID comprising first main body, and the 3rd list item comprising the relation information.
When a new pending relation data is received, the application will determine that have recorded identical type of subject whether first, in a preferred embodiment, this step inquires about first the current relation body table with the presence or absence of type ID comprising first main body, if existing, using the relation body table as first list item;If not existing, the relation body table of type ID comprising first main body is created, and using the relation body table as first list item.
In specific implementation process, the application specific embodiment preserves the basic map information of various relations in the relational network of front end using relation routing table as shown in table 5 below, including information such as menu, relation, object table (HBase), current agent objects, the routing function of offer relation, is easy between various relations rapidly series connection and gets through.
Table 5
Simultaneously, the application specific embodiment also preserves the nodal information of various relation main bodys in the relational network of front end using relation body table as shown in table 6 below, code, description, icon including main body, whether effectively, body attribute details route target table (HBase) etc., the dynamic configuration of realization body, the exploitation of decoupling front end.
Table 6
Step S104, sets up the main body value corresponding relation of first list item, second list item, the 3rd list item, the relation body table and first main body.
Because relation data is the data for building relational network, these data are organized according to the total relation data interface protocol that device is provided, and route maintenance table is then, for safeguarding various relationship metadatas, and to provide routing iinformation for front end system.Therefore the application can be according to the different query analysis demands of user, and by these routing iinformations, obtaining real relation data carries out visualization presentation.
In the present embodiment, for the inquiry operation after corresponding relation foundation, i.e., when the relational data access request for coming from user is received, according to the relation body table that there is currently, to the user currently valid type of subject is shown;Subsequently the corresponding relation according to corresponding to the main body value of the type of subject, relationship type and input that select with the user, obtains relation data corresponding with the corresponding relation;Finally according to the relation data production Methods network, and show the relational network to the user.
Further, in the present embodiment, the generating mode of relation data is as follows:
Type of subject and the main body value of input that step a) is selected according to the user, obtain the first list item corresponding with type ID of the type of subject and main body value;
Step b) obtains currently the second list item corresponding with first list item according to the corresponding relation;
Step c) according to the second acquired list item to the user show currently with type ID and the main body corresponding relationship type of value;
Step d) is according to the configuration information of the user input, and corresponding second list item of selected relationship type, it is determined that with second list item, first list item and the main body corresponding corresponding relation of value;
Step e) generates the relation data according to the corresponding relation.
In order to preferably be shown to relation data, in a preferred embodiment of the application, also include the 4th list item and the 5th list item in the relation data, 4th list item includes the corresponding relation of relations I D and main body display properties, 5th list item includes the corresponding relation of type ID and relation display properties, and is filtered and rendered according to the main body display properties of the 4th list item and the relation display properties of the 5th list item.
In specific application scenarios, 4th list item can be configured according to relation nodal community allocation list as shown in table 7 below, the relation nodal community allocation list is used for preservation relation nodal community configuration information, including menu ID and NAME, KEY field attribute, measurement type, field are originated, whether need statistics, display type etc..
Table 7
5th list item can adopt relation custom attributes table as shown in table 8, the relation custom attributes table is used to preserve personalized customization attribute configuration information, in addition to general relational network shows related attribute, different demands may be directed to some special relationship nodes and provide personalized attribute, and this relation custom attributes table is just to provide for the demand of user individual and designs.
Table 8
Based on above-mentioned flow process, when needing to extend new relation toward relational network, it is only necessary to complete the exploitation of newly-increased relation data, the routing iinformation of newly-increased relation is then configured in dimension table.Specifically, the specification of total relation data interface protocol is first according to, new relation data is developed;Whether the main body that newly-increased relation is then inquired about in relation body table has been present, if it did not, needing relation main body newly-increased toward relation body table, if newly-increased main body has attribute information, needs newly-increased body attribute;Then configuration relation menu sheet, relation routing table, relation nodal community table successively, complete the addition of the routing iinformation of new relation;Finally, refresh the dimension table data buffer storage of front end system, the relation data of new extension so can be shown in relational network, it is achieved thereby that the diversity extension that relation data is processed.
Embodiment three
The same application design of flow process is realized based on above-mentioned relation data processing, a kind of relation data processing equipment is additionally provided in the embodiment of the present application, as shown in Fig. 2 the equipment includes:
Determining module 210, the main information of each main body in for determining relation data, and the relation information between the main body, the main body includes the first main body and the second main body, the main information at least includes main body value, body attribute and type ID corresponding with type of subject of the main body, and the relation information at least includes relations I D corresponding with relationship type.
Acquisition module 220, for obtaining relation body table corresponding with the type of subject of first main body, the relation body table includes type ID of first main body and the corresponding relation of the body attribute of first main body.
In the embodiment of the present application, methods described is applied in relational network system as relational network adaptation layer, and the relational network system also includes data Layer, relation Business Logic and front end presentation layer;
Wherein, the relational network adaptation layer is on the data Layer.
In the embodiment of the present application, first list item, second list item, the 3rd list item and the relation body table are configured at the relational network adaptation layer;Shown relation data is generated according to default total relation data interface protocol specification.
In the embodiment of the present application, the acquisition module obtains the first list item corresponding with the type of subject, specially:
The current relation body table with the presence or absence of type ID comprising first main body of inquiry;
If existing, using the relation body table as first list item;
If not existing, the relation body table of type ID comprising first main body is created, and using the relation body table as first list item.
Generation module 230, for generating the first list item of type ID comprising first main body, the second list item comprising relations I D with the corresponding relation of type ID of second main body, and the 3rd list item comprising the relation information respectively.
Module 240 is set up, the main body value corresponding relation of first list item, second list item, the 3rd list item, the relation body table and first main body is set up.
In specific application scenarios, the acquisition module, specifically for the current relation body table with the presence or absence of type ID comprising first main body of inquiry, and in the presence of using the relation body table as first list item, and establishment includes the relation body table of type ID of first main body when not existing, and using the relation body table as first list item.
In specific application scenarios, also include:
First display module, for when the relational data access for coming from user request is received, according to the relation body table that there is currently, to the user currently valid type of subject being shown,
Second display module, corresponding relation corresponding to the main body value of the type of subject, relationship type and the input that select with the user for basis, relation data corresponding with the corresponding relation is obtained, according to the relation data production Methods network, and shows the relational network to the user.
In specific application scenarios, it is described to set up module, the main body value acquisition of type of subject and input the first list item corresponding with type ID of the type of subject and main body value specifically for being selected according to the user, currently the second list item corresponding with first list item is obtained according to the corresponding relation, according to the second acquired list item to the user show currently with type ID and the main body corresponding relationship type of value, determined and second list item according to corresponding second list item of configuration information and selected relationship type of the user input, first list item and the main body are worth corresponding corresponding relation, the relation data is generated according to the corresponding relation.
In specific application scenarios, described foundation in the relation data that module is generated according to the corresponding relation also includes the 4th list item and the 5th list item, 4th list item includes the corresponding relation of relations I D and main body display properties, and the 5th list item includes the corresponding relation of type ID and relation display properties.
In specific application scenarios, the module of setting up shows the relational network according to the relation data production Methods network to the user, specially:
Filtered and rendered according to the main body display properties of the 4th list item and the relation display properties of the 5th list item.
Through the above description of the embodiments, those skilled in the art can be understood that the application can be realized by hardware, it is also possible to realize by the mode of software plus necessary general hardware platform.Based on such understanding, the technical scheme of the application can be embodied in the form of software product, it (can be CD-ROM that the software product can be stored in a non-volatile memory medium, USB flash disk, portable hard drive etc.) in, use including some instructions so that computer equipment (can be personal computer, server, or network equipment etc.) performs the method described in the application each implement scene.
It will be appreciated by those skilled in the art that accompanying drawing is a schematic diagram for being preferable to carry out scene, the module or flow process in accompanying drawing is not necessarily implemented necessary to the application.
It will be appreciated by those skilled in the art that the module in the device in implement scene can carry out being distributed in the device of implement scene according to implement scene description, it is also possible to carry out respective change and be disposed other than in one or more devices of this implement scene.The module of above-mentioned implement scene can merge into a module, it is also possible to be further split into multiple submodule.
Above-mentioned the application sequence number is for illustration only, does not represent the quality of implement scene.
Disclosed above is only that the several of the application are embodied as scene, but, the application is not limited to this, and the changes that any person skilled in the art can think of should all fall into the protection domain of the application.