00init.mql 949 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. -- 15cypher 目录初始化:Cypher 图操作测试
  2. create class if not exists /test/aaa/test_graph (
  3. g_name varchar,
  4. g_type varchar,
  5. g_value int,
  6. indexes(g_name, g_type),
  7. keys(g_name)
  8. ) with nickname='test_graph'
  9. ;
  10. alter class /test/aaa/test_graph with nickname='test_graph'
  11. /**
  12. onerror(continue,'already exist')
  13. **/
  14. ;
  15. create edge type if not exists test.connect
  16. ;
  17. -- 插入图节点数据
  18. insert into /test/aaa/test_graph (g_name, g_type, g_value) values ('node_a', 'type_a', 10)
  19. ;
  20. insert into /test/aaa/test_graph (g_name, g_type, g_value) values ('node_b', 'type_a', 20)
  21. ;
  22. insert into /test/aaa/test_graph (g_name, g_type, g_value) values ('node_c', 'type_b', 30)
  23. ;
  24. insert into /test/aaa/test_graph (g_name, g_type, g_value) values ('node_d', 'type_b', 40)
  25. ;
  26. insert into /test/aaa/test_graph (g_name, g_type, g_value) values ('node_e', 'type_c', 50)
  27. ;
  28. -- 等待数据写入完成
  29. /**
  30. sleep(1s)
  31. **/
  32. ;