New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GIE][Doc] Update GIE tutorial #2583
Conversation
1. add real applications for graph traversal 2. Introduce gremlin match steps 3. Introduce some advanced techniques of gremlin in GIE 4. Add 5 LDBC BI Query as examples written with gremlin in GIE
🎊 PR Preview 845dc09 has been successfully built and deployed to https://alibaba-graphscope-build-pr-2583.surge.sh 🤖 By surge-preview |
plt.title('Comment Length Histogram for comments from China') | ||
plt.show() | ||
``` | ||
:::{figure-md} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can check https://alibaba-graphscope-build-pr-2583.surge.sh/interactive_engine/tutorial_ldbc_gremlin.html
for the review. These images are not shown. You can include an image as follows:
:::{figure-md}
<img src="../images/xx.png"
alt="xxx"
width="xx% to fit the preview">
Figure xx. The caption.
:::
1. The two `person` `know` each other | ||
2. The two `person` `studyAt` the same `university` | ||
|
||
With the previously taught knowledge, you may write the following code in GIE to achieve this purpose: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend proof-reading using chatgpt-like tools. The words can be improved a bit.
|
||
## Pattern Match | ||
|
||
Suppose you want to find two `persons` and the `universities` they `studyAt` in the Property Graph that: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Property Graph
-> graph
. Apply to the following.
|
||
- "Find two `persons` and the `universities` they `studyAt` in the Property Graph that the two `person` `know` each other and the two `person` `studyAt` the same `university`" | ||
|
||
or can be illustrated as a figure: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or can be illustrated as a graph pattern as shown in the following.
Figure 21. Pattern: two person know each other and study at the same university. | ||
::: | ||
|
||
Then you aim to find all the matched subgraphs of the Property Graph that are isomorphic to the pattern. For example, this is a sub-local-graph of university vertex(id = 144115188075858884) in the LDBC Graph: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sub-local-graph -> local graph
. Apply to the above and the follows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a bit too many Then
, and Here are
. As I said, proof-read using chatgpt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Recommend introducing subgraph isomorphism a little bit, and give a citation, e.g. from wikipedia,
Figure 22. sub-local-graph of a university vertex. | ||
::: | ||
|
||
and here are the matched subgraphs in this sub-local-graph: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here are the matched subgraphs in this sub-local-graph
. In the following, it occurs twice. Rephrase these sentences a bit.
[{'pA': v[216172782113783812], 'pB': v[216172782113783882], 'c': v[36], 'm': v[360287970189640010]}, {'pA': v[216172782113783812], 'pB': v[216172782113783882], 'c': v[37], 'm': v[360287970189640010]}, {'pA': v[216172782113783812], 'pB': v[216172782113784105], 'c': v[38], 'm': v[360287970189640010]}, {'pA': v[216172782113783812], 'pB': v[216172782113783882], 'c': v[41], 'm': v[360287970189640010]}, {'pA': v[216172782113784105], 'pB': v[216172782113783882], 'c': v[43], 'm': v[42]}, {'pA': v[216172782113783814], 'pB': v[216172782113783962], 'c': v[50], 'm': v[360287970189640135]}, {'pA': v[216172782113783814], 'pB': v[216172782113784171], 'c': v[52], 'm': v[360287970189640135]}, {'pA': v[216172782113784481], 'pB': v[216172782113784199], 'c': v[54], 'm': v[49]}, {'pA': v[216172782113783814], 'pB': v[216172782113784038], 'c': v[56], 'm': v[360287970189640135]}, {'pA': v[216172782113783816], 'pB': v[216172782113784144], 'c': v[175], 'm': v[360287970189640462], ......, }] | ||
``` | ||
|
||
## Advanced Techniques |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not advanced techniques. Relational Operations
are better terms.
|
||
which are all the vertices whose local id is 0. | ||
|
||
#### `where()` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can introduce the syntactic sugar of expr()
(in supported gremlin steps) for simplifying the filtering expression.
|
||
The output should be `[432]`. | ||
|
||
### Project Steps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, the syntactic sugar of expr()
can also be used. Cover some examples as well.
The key to this query is creating two sub execution branches to count the two windows separately. We can use gremlin's `by()` step to achieve the purpose. Assume the `TagClass's name='Actor'` `$date='2012-01-01'`, `$date+100='2012-04-09'$` and `$date+200='2012-07-18'`, we can write in GIE as: | ||
|
||
```python | ||
q1 = g.execute('g.V().has(\'tagclass\', \'name\', \'Actor\').in(\'hasType\').as(\'tag\')\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest breaking the BI 12 query step by step to actually instruct a user to how to program such a complex query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW. Just need to break down into one query, the others can be simply given for their reference.
1. Proof read sentences by chatGPT 2. Fixed the issue where images were not displayed correctly 3. `Property Graph` -> `graph`, `sub-logcal-graph` -> `local graph` 4. `Advanced Techniques` -> `Relational Operations` 5. Add introduction of `expr()` 6. Explian LDBC BI Query 2 step by step
…into GIE_tutorial
Add real applications for graph traversal
Introduce gremlin
match()
stepsIntroduce some advanced techniques of gremlin in GIE
Add 5 LDBC BI Queries as examples written with gremlin in GIE