You have learnt all the basic concepts of Visual Query Builder in the previous article. In this article we will walk you through building several visual patterns step by step, and then show you more graph analytics questions and how to solve them with visual patterns.
In the config panel, change the vertex type to be department, and put it in result:
Expand the Filter section in the config panel:
Edit the filter to be (gender == "male"):
Confirm the change:
Then click department vertex pattern in the working panel to create an edge pattern between the two vertex patterns:
In the config panel, change the edge type to be work_in:
Apply the change, and drag the person vertex pattern to a better position:
Create a new visual pattern named FriendsManagerABC.
An edge pattern is added into the working panel:
Adjust the vertex patterns' positions:
Then, merge the top two vertex patterns:
Then, merge the right two vertex patterns:
Now you have a triangle visual pattern representing the three people relationship!
Change the vertices to be from parameter, and give a parameter name ind. This annotates the industry as an input vertex set when running the pattern:
Confirm the change, and notice there is an id condition on the industry vertex pattern:
Confirm the change, and the label of company vertex pattern becomes company as C:
Expand the Aggregation section in the config panel, and add an aggregation:
Confirm the change:
Expand the Order section in the config panel, and add a descending order of aggregation result countCompany:
Confirm the change:
Expand the Limit section in the config panel, check the use limit checkbox, and change limit to 2:
Confirm the change:
Change the industry vertex id to be "internet", and run the pattern again:
Again, you can choose to output everything in the matched subgraphs:
Expand Graph patterns section in the pattern list panel, then create a new visual pattern named SearchPeople. Create the following visual pattern following similar steps as above:
Click the left two person vertex patterns respectively to add the union widget:
Click the output person vertex pattern of the union widget, then click the right person vertex pattern, a subtract widget is added into the visual pattern:
Put the output person vertex pattern of the subtract widget into result:
Save and run the pattern:
A snowflake-like visual pattern is commonly used in this type of searching problems:
First, we get the friends and friends' friends of P. We use the programming skill to filter these friends, then we find the other skills that these people have. Then we count the number of people having these skills, and choose the top 5 skills as the result.
Clickin the pattern list pattern, input the pattern name, and click:
Clickin the toolbar to add a vertex pattern:
Confirm the change by click:
Clickin the toolbar to add another vertex pattern:
Clickto add a filter:
Clickin the toolbar, then click the person vertex pattern in the working panel:
Clickin the toolbar to save the pattern, and clickin the toolbar to run the pattern:
You can also try to output the entire matched subgraphs. Clickin the toolbar to enter output toggle mode, then click the person vertex pattern and the work_in edge pattern:
Clickin the toolbar again to exit output toggle mode, then clickto run the pattern:
Clickin the console panel to switch to graph schema:
Clickin the toolbar, then click the friend edge type in the graph schema:
Similarly, useto add another friend edge pattern and a manage edge pattern into the working panel:
Hold Shift key and choose the two vertex patterns on the left, then clickin the toolbar to merge them together:
Now, clickin the toolbar and put all the vertex patterns and edge patterns into result:
Clickagain to exit output toggle mode, clickto save the pattern, and clickto run the pattern:
Create a new visual pattern named IndustryCenterCity. Clickin the console panel to switch to graph schema.
Usein the toolbar to pick the company_locate_at edge type and belong_to edge type in graph schema:
Use Shift key to select the two company vertex patterns, and clickto merge them into one. Drag the vertex patterns to make their positions look good:
Click the industry vertex pattern, then clickin the toolbar (or double click the industry vertex pattern), now you are in edit mode:
Click the company vertex pattern, then clickin the toolbar, and change the Name to C:
Click the city vertex pattern, then clickin the toolbar:
Click, then click the city vertex pattern, then clickagain to exit output toggle mode, clickto save the pattern:
Click. Because the pattern has one input parameter ind, the Pattern parameters section in the pattern list panel expands:
Clickto add one industry vertex, and input "big data" for vertex id, then click :
Clickin the toolbar, and choose Union:
Clickin the toolbar, and choose Subtract: