Embodiment
Generally, in graphic data base (Graph Database), the summit (Vertex) in figure (Graph) is representative
Entity (Object) can be:People, thing, the object of objective reality, the event of abstract entities, form, task dispatching, figure
(Graph) relation representated by side (Edge) in can be:Dependence, social relationships etc..Each top in figure (Graph)
Point possesses vertex attribute (Vertex Property), and vertex attribute refers to corresponding entity attributes (age of such as people, name
Deng);Each edge in figure (Graph) also possesses side attribute (Edge Property), and side attribute refers between corresponding entity
The attribute of relation.Graphic data base can be applied to structure social networks, public traffic network, map and network and open up spectrum etc..
In correlation technique, because the subgraph (Subgraph) that user inquires about to obtain usually contains very more number of vertex and side number, make
User is not easy from inquiry obtained subgraph quick obtaining to some profile informations.It is proposed to this end that the application's is as follows
Scheme.In one embodiment, the graph data query engine instrument or data storage facility for realizing following proposal include but
It is not limited to:geabase、Neo4J、titan、GraphDB、MYSQL、ADS、HBASE、ODPS、HIVE、ORACLE、GREENPLUM
Deng.
Fig. 1 shows a kind of flow of the method for generation graphic data base Query Result that an exemplary embodiment provides.
As shown in figure 1, in one embodiment, this method comprises the steps 101~103, wherein:
In a step 101, graphic data base is inquired about according to the summit ID of input, obtains son corresponding with the summit ID
Figure.Wherein, the pel element in the subgraph includes summit and the side being connected between two summits.
Figure in graphic data base generally can be divided into digraph (Oriented Graph) and non-directed graph (Undirected
Graph), its query process is less identical.In one embodiment, if the figure stored in graphic data base to be checked is undirected
Figure, then only need to input the i.e. achievable inquiry of summit ID to be checked.In another embodiment, if graphic data base to be checked
The figure of middle storage is digraph, then user is while summit ID to be checked is inputted, it is also necessary to given query direction, its
In, the inquiry direction can be:Direction using the summit corresponding to the summit ID of input as starting point, or the summit ID institutes with input
Corresponding summit is the direction of terminal.
Shown in cooperation reference picture 2, Fig. 3, in the example of digraph, each summit in digraph is used to identify with one
The summit ID of the unique identities on the summit is corresponding, such as:A, b, c, also, each vertex correspondence is in a kind of vertex type
(Vertex Type), such as:type1、type2.Based on the digraph (Oriented Graph) shown in Fig. 2, if what user inputted
Summit ID to be checked is a, and the inquiry direction specified is:Direction using the summit corresponding to the summit ID of input as starting point, then look into
Obtained subgraph is ask as shown in figure 3, wherein, the subgraph is made up of summit a, b, c, d, e, f, g, h, wherein summit a is the subgraph
Starting point.On the contrary, if the summit ID to be checked of user's input is a, the inquiry direction specified is:With corresponding to the summit ID of input
Summit be terminal direction, then the subgraph for inquiring about to obtain is made up of summit a, j, i, q, k, p, and wherein summit a is the subgraph
Terminal.
In a step 102, according to the type of each pel element in the subgraph, determine at least one related to the type
Displaying desired value.
Displaying desired value is generally used for reflecting the index of correlation that the user of graphic data base is actually needed.For user
For, after graphic data base is inquired about, it is desirable at least one index wanted to know about is quickly learned from Query Result.It is actual
With when, user can adjust or set one or more indexs according to self-demand.In one embodiment, above-mentioned displaying index
Value can include but is not limited to following at least one:
1. the number of types on summit in subgraph;
2. belong to the number of vertex of each type in subgraph;
3. the vertex type side number consistent with terminal type is played in subgraph.
It will be illustrated herein so that above-mentioned three kinds show desired value as an example.
In one embodiment, the step 102 can be realized by procedure below:
Step 1021:The type on each summit in the subgraph obtained according to inquiry, obtains quaternary group information, wherein, four-tuple
Information includes starting point ID, plays vertex type, terminal ID and terminal type.
In the example shown in Fig. 3, the quaternary group information of acquisition is as shown in table 1.
Table 1:
Starting point ID |
Play vertex type |
Terminal ID |
Terminal type |
a |
type1 |
b |
type2 |
a |
type1 |
c |
type1 |
b |
type2 |
d |
type2 |
b |
type2 |
e |
type2 |
c |
type1 |
d |
type2 |
d |
type2 |
f |
type3 |
d |
type2 |
g |
type3 |
e |
type2 |
h |
type3 |
Step 1022:Quaternary group information based on acquisition, the vertex type side number consistent with terminal type is counted.
Based on table 1, count to obtain to play the vertex type side number consistent with terminal type as shown in table 2.
Table 2:
Play vertex type |
Terminal type |
The quantity on side |
type1 |
type1 |
1 |
type2 |
type2 |
2 |
type1 |
type2 |
2 |
type2 |
type3 |
3 |
Step 1023:Quaternary group information based on acquisition, statistics belong to the number of vertex of each type.
Based on table 1, the number of vertex for belonging to each type for counting to obtain is as shown in table 3.Wherein, it is same under certain type
Individual vertice counts are once.
Table 3:
Terminal type |
Belong to summit (i.e. terminal) number of the type |
type1 |
1 |
type2 |
3 |
type3 |
3 |
In step 103, the pel element for being used to describe the displaying desired value is included according to the displaying desired value, generation
Figure to be presented and show.
In one embodiment, the step 103 can be realized by procedure below:
Step 1031:Draw target point corresponding with each vertex type in the subgraph inquired.
Step 1032:Mark belong to the number of vertex of the type respectively for each target point of drafting.
Step 1033:Vertex type and terminal type are played according to statistics, drafting is connected on a target point or is connected to
Directed edge between two target points.
Step 1034:The vertex type side number consistent with terminal type has been marked respectively for each directed edge of drafting.
Fig. 4 is a kind of figure to be presented generated according to above-mentioned table 2 and table 3, wherein, during the figure is generated, first,
Three points are drawn out, the ID of these three points is respectively:type1、type2、type3.Then, according to the number for counting to obtain in table 3
Value, respectively ID are " type1 ", " type2 ", the corresponding numerical value of point mark of " type3 ":1st, 3,3 (can by ID and numerical value with
Certain form is labeled in a little).Then, according to table 2, it is " type2 " that drafting one, which is connected to the point that ID is " type1 " and ID,
Directed edge between point, a directed edge being connected between the point that ID is " type2 " and the point that ID is " type3 ", Yi Jiyi
Directed edge of the bar start, end on the point that ID is " type2 ".Finally, according to table 2, marked respectively on above-mentioned three directed edges
Note corresponding numerical value.By showing the figure to be presented shown in above-mentioned Fig. 4 to user, user can quickly view inputted top
Point ID is common for the downstream (being inquired about using the summit as starting point) on the summit of " a " or upstream (being inquired about using the summit as terminal)
The summit of how many type, how many summit, how many bar side of a type to another type etc. is believed under each type
Breath.Especially when the subgraph inquired is complex, the process of user's Query Information and acquisition information can be highly efficient.
In another embodiment, above-mentioned steps 102 can be realized by procedure below:
Step 1021:According to the type on each summit in the subgraph, quaternary group information is obtained, wherein quaternary group information includes
Starting point ID, play vertex type, terminal ID and terminal type.
Similarly, in the example shown in Fig. 3, the quaternary group information of acquisition is as listed in Table 1.
Step 1025:Play vertex type by corresponding with the summit ID of input in the quaternary group information of acquisition and replace with the top
Point ID.
In the example shown in Fig. 3, the quaternary group information obtained after replacement is as shown in table 4.
Table 4:
Step 1026:Based on the quaternary group information obtained after replacement, the vertex type side number consistent with terminal type has been counted.
In the example shown in Fig. 3, according to above-mentioned table 4, the vertex type side number consistent with the terminal type such as institute of table 5 has been counted
Show.
Table 5:
Play vertex type |
Terminal type |
The quantity on side |
a |
type2 |
1 |
a |
type1 |
1 |
type2 |
type2 |
2 |
type1 |
type2 |
1 |
type2 |
type3 |
3 |
Step 1027:Based on the quaternary group information before replacement, statistics belongs to the number of vertex of each type.
The obtained number of vertex for belonging to each type is counted as shown in upper table 3.
Finally, summit corresponding to the summit ID of input is added into above-mentioned table 3, obtains table 6:
Vertex type |
Number of vertex under the type |
a |
1 |
type1 |
1 |
type2 |
3 |
type3 |
3 |
According to above-mentioned table 5 and table 6, figure to be presented as shown in Figure 5 can be finally generated.Wherein, in order to further improve exhibition
Show effect, the present embodiment can increase the summit that the ID that is queried is " a " on the basis of above-mentioned Fig. 4, so as to which user is from the figure
In can view the summit for having which type that is joined directly together of summit that ID is " a ".
In other possible embodiments, the form of the figure to be presented of generation, the figure element type included and displaying desired value
Mark mode is not limited to example shown in Fig. 4 or Fig. 5, no longer enumerate herein.
In the above example that the application provides, after inquiry obtains subgraph corresponding with some summit ID, according to subgraph
The type of middle pel element, it may be determined that one or more displaying desired values related to the type, finally, utilize the exhibition of determination
Show desired value, generate figure to be presented and show, wherein, the figure to be presented includes the pel for being used for describing the displaying desired value
Element.Wherein, for the figure to be presented ultimately generated compared to original subgraph, its shared memory space is smaller, improves database
Search efficiency;On the other hand, user can check relevant displaying desired value by the figure to be presented of generation come quick, and lifting user obtains
Take the efficiency of useful information.
Fig. 6 shows the structure for a kind of electronic equipment that an exemplary embodiment provides.As shown in fig. 6, the electronics is set
Standby can be graphic data base server, the electronic equipment can including processor, internal bus, network interface, internal memory and
Nonvolatile memory, the hardware being also possible that certainly required for other business.Processor is read from nonvolatile memory
Computer program corresponding to taking is into internal memory and then runs, and a kind of generation graphic data base Query Result is formed on logic level
Device.Certainly, in addition to software realization mode, the application is not precluded from other implementations, for example, logical device or
Mode of software and hardware combining etc., that is to say, that the executive agent of following handling process is not limited to each logic unit,
Can be hardware or logical device.
As shown in fig. 7, in one embodiment, a kind of device 200 for generating graphic data base Query Result, including cargo tracer
Member 201, determining unit 202 and generation unit 203, wherein:
Query unit 201 is configured as inquiring about graphic data base according to the summit ID of input, obtains and ID pairs of the summit
The subgraph answered, the pel element in the subgraph include summit and the side being connected between two summits.
Determining unit 202 is configured as the type according to each pel element in the subgraph, determine it is at least one with it is described
The related displaying desired value of type.
Generation unit 203 is configured as according to the displaying desired value, and generation, which includes, to be used to describe the displaying desired value
Pel element figure to be presented and show.
Displaying index is usually the index viewed required for the user of graphic data base, during practice, Yong Huke
One or more indexs are adjusted or set according to self-demand.In one embodiment, the displaying index can be included but not
The one or more being limited in following indexs:
1. the number of types on summit in subgraph;
2. belong to the number of vertex of each type in subgraph;
3. the vertex type side number consistent with terminal type is played in subgraph.
Other feasible indexs are for example:Clustered according to the type on side, obtain belonging to each side type
The quantity on side, etc..
In one embodiment, if the figure stored in graphic data base to be checked is digraph, the query unit
201 are configured as:According to the summit ID of input and inquiry direction query graph graphic data storehouse, acquisition is corresponding with the summit ID to be had
To subgraph, wherein summit corresponding to the summit ID is the beginning or end of the directed subgraph.
As shown in figure 8, in another embodiment, in a kind of device 200 ' for generating graphic data base Query Result, including
Query unit 201, determining unit 202 and generation unit 203, wherein, on the basis of the device 200 shown in figure 7 above, this is true
Order member 202 can specifically include:
Quaternary group information obtaining unit 2021, the type according to each summit in the subgraph is configured as, obtains four-tuple
Information, wherein quaternary group information include starting point ID, play vertex type, terminal ID and terminal type.
Statistic unit 2022, it is configured as being based on the quaternary group information, it is consistent with terminal type has counted vertex type
Side number;And/or the number of vertex of each type is belonged to based on the quaternary group information, statistics.
Wherein, in one embodiment, the statistic unit 2022 can also further comprise:
Replacement unit, it is configured as the vertex type that rises corresponding with the summit ID of input in the quaternary group information by acquisition and replaces
For the summit ID.
Side number statistic unit, it is configured as, based on the quaternary group information obtained after replacement, having counted vertex type and terminal class
The quantity on the consistent side of type.
In one embodiment, the generation unit 203 can specifically include:
Point-rendering unit 2031, it is configured as drawing target point corresponding with each vertex type in the subgraph.
Point mark unit 2032, each target point being configured as drafting mark the number of vertex for belonging to the type respectively.
Edge drawing unit 2033, it is configured as playing vertex type and terminal type according to statistics, drafting is connected to a mesh
On punctuate or the directed edge that is connected between two target points.
Side marks unit 2034, is configured as having marked vertex type and terminal type one respectively for each directed edge of drafting
The side number of cause.
As can be seen that the technical scheme provided by above example, be able to will be looked into during graphic data base is inquired about
The complex subgraph ask, it is polymerize for one or more displaying index, changes into a relatively simple general view
Scheme (i.e. above-mentioned figure to be presented), consequently facilitating the user of graphic data base check at a glance required for information, can be
Exploitation and the efficiency of management of some projects are greatly promoted to a certain extent.
It should be noted that on the premise of not disagreing, said apparatus embodiment and above method embodiment can be each other
Supplement.
System, device, module or the unit that above-described embodiment illustrates, it can specifically be realized by computer chip or entity,
Or realized by the product with certain function.One kind typically realizes that equipment is computer, and the concrete form of computer can
To be personal computer, laptop computer, cell phone, camera phone, smart phone, personal digital assistant, media play
In device, navigation equipment, E-mail receiver/send equipment, game console, tablet PC, wearable device or these equipment
The combination of any several equipment.
For convenience of description, it is divided into various units during description apparatus above with function to describe respectively.Certainly, this is being implemented
The function of each unit can be realized in same or multiple softwares and/or hardware during application.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or computer program
Product.Therefore, the present invention can use the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Apply the form of example.Moreover, the present invention can use the computer for wherein including computer usable program code in one or more
The computer program production that usable storage medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.)
The form of product.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram
Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided
The processors of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce
A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real
The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to
Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or
The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted
Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or
The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one
The step of function of being specified in individual square frame or multiple square frames.
In a typical configuration, computing device includes one or more processors (CPU), input/output interface, net
Network interface and internal memory.
Internal memory may include computer-readable medium in volatile memory, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash RAM).Internal memory is computer-readable medium
Example.
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 instruction, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moved
State random access memory (DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electric erasable
Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM),
Digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus
Or any other non-transmission medium, the information that can be accessed by a computing device available for storage.Define, calculate according to herein
Machine computer-readable recording medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
It should also be noted that, term " comprising ", "comprising" or its any other variant are intended to nonexcludability
Comprising so that process, method, commodity or equipment including a series of elements not only include those key elements, but also wrapping
Include the other element being not expressly set out, or also include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that wanted including described
Other identical element also be present in the process of element, method, commodity or equipment.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer program product.
Therefore, the application can be using the embodiment in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Form.Deposited moreover, the application can use to can use in one or more computers for wherein including computer usable program code
The shape for the computer program product that storage media is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.)
Formula.
The application can be described in the general context of computer executable instructions, such as program
Module.Usually, program module includes performing particular task or realizes routine, program, object, the group of particular abstract data type
Part, data structure etc..The application can also be put into practice in a distributed computing environment, in these DCEs, by
Task is performed and connected remote processing devices by communication network.In a distributed computing environment, program module can be with
In the local and remote computer-readable storage medium including storage device.
Each embodiment in this specification is described by the way of progressive, identical similar portion between each embodiment
Divide mutually referring to what each embodiment stressed is the difference with other embodiment.It is real especially for system
For applying example, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method
Part explanation.
Embodiments herein is the foregoing is only, is not limited to the application.For those skilled in the art
For, the application can have various modifications and variations.All any modifications made within spirit herein and principle, it is equal
Replace, improve etc., it should be included within the scope of claims hereof.