본문 바로가기

카테고리 없음

GraphDB GSQL learning I

From Guru14 

(TigerGraph 유튜브 동영상 강의 학습중)

 

그래프 디비가 무엇을 할 수 있는지를 찾으려면 

 

데이터 저장 구조와 무엇을 잘 할 수 있는지 어디까지 가능한지 알아야 하고

두가지가 동시에, 데이터 구조 어떻게 펼쳐져 있는지에 따라 모양새에 따라 

              그리고  쿼리가 어떻게 그려지고 작성되며 실제로 내부에서 위 데이터구조를 어떻게 흘러 타고 들어가 움직이는지 

같이 머릿속에 그려져야 한다.

그래야 원하는 데이터를 만들 수 있다. 

 

1.FROM X:x -(E1:e1)- Y:y

  ○E1 is an undirected edge. x, y bind to the end points of E1. e1 is alias to E1. 

2.FROM X:x -(E2>:e2)- Y:y

  ○Right directed edge, x binds to the source of E2, y binds to the target of E2. e2 is alias of E2.

3.FROM X:x -(<E3:e3)- Y:y

  ○Left directed edge, y binds to the source of E3, x binds to the target of E3.  e3 is alias of E3.

4.FROM X:x -(_:e)- Y:y 

  ○Any undirected edge pattern. "_" means any undirected edge type. e is alias of "_".

5.FROM X:x -(_>:e)- Y:y 

  ○Any right directed edge. "_>" means any right directed edge type. e is alias of "_>".

 

6.FROM X:x -(<_:e)- Y:y

  ○Any left directed edge. "<_" means any left directed edge type. e is alias of "<_".  

7.FROM X:x -((<_|_):e)- Y:y

  ○Any left directed or any undirected. "|" means OR. e is alias of (<_|_).

8.FROM X:x -((E1|E2>|<E3):e) - Y:y

  ○Disjunctive 1-hop edge. (x,y) are connected by E1 or E2 or E3. e is alias of (E1|E2>|<E3).

9.FROM X:x -()- Y:y 

  ○any edge (directed or undirected) match this 1-hop pattern

  ○Same as this: (<_|_>|_)

 

1.FROM X:x - (E1*) - Y:y

  ○X connect to Y via 0 or more repetition of undirected E1. * is called the Kleene star.

2.FROM X:x - (E2>*) - Y:y

  ○X connect to Y via 0 or more repetition of rightward E2

3.FROM X:x - (<E3*) - Y:y

  ○X connect to Y via 0 or more repetition of leftward E3

4.FROM X:x - (_*) - Y:y 

  ○X connect to Y via 0 or more undirected edges of any type

 

5.FROM X:x - (_>*) - Y:y

  ○X connect to Y via 0 or more right-directed edges of any type

6.FROM X:x - (<_*) - Y:y

  ○X connect to Y via 0 or more left-directed edges of any type

7.FROM X:x - ((E1|E2>|<E3)*) - Y:y

  ○Either E1, E2> or <E3 can be chosen at each repetition.

 

1.FROM X:x - (E1*2..) - Y:y

  ○Lower bounds only. There is a chain of at least 2 E1 edges.

2.FROM X:x - (E2>*..3) - Y:y

  ○Upper bounds only. There is a chain of between 0 and 3 E2 edges.

3.FROM X:x - (<E3*3..5) - Y:y

  ○Both Lower and Upper bounds. There is a chain of 3 to 5 E3 edges.

4.FROM X:x - ((E1|E2>|<E3)*3) - Y:y

  ○Exact bound. There is a chain of exactly 3 edges, where each edge is either E1, E2>, or <E3.

 

 

 

 

 

 

simple vertices and edges