1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
| $ connect remote:localhost/Demo root hello plocal
$ update edge organRelation
set relation_key='warehouse|139|3_basesite|691704_2019-01-10_2019-01-10_2019-01-10',
order_date='2019-01-10',
service_type_list=['1'],
operate_date='2019-01-10',
order_type_list=['1','2'],
aging_type_list=['2','1','10','3'],
handdown_date='2019-01-10',
ts=1547122222751,
in=(select from organ where organ_key='basesite|691704'),
out=(select from organ where organ_key='warehouse|139|3')
upsert
where relation_key='warehouse|139|3_basesite|691704_2019-01-10_2019-01-10_2019-01-10'
update edge teach
from (select from Teacher where fullname='field1' limit 10)
to (select from student where s_name='field1' limit 10)
set relation=1
upsert where relation=1
UPDATE EDGE teach
FROM (SELECT FROM Teacher where fullname = 'field1' )
TO ( SELECT FROM student WHERE s_name= 'field1' )
relation = 1
UPSERT
WHERE relation = 1
UPDATE EDGE Friend SET out = (SELECT FROM Person WHERE name = 'John')
WHERE foo = 'bar'
UPDATE EDGE hasAssignee
FROM ( SELECT FROM Project WHERE id=:id )
TO ( SELECT FROM User WHERE login in :login )
UPSERT
WHERE hasAssignee.id = 56
UPDATE EDGE teach
FROM ( SELECT FROM Teacher WHERE name = 'Jay2' limit 1 )
TO ( SELECT FROM Student WHERE name= 'Tom1' limit 1 )
UPSERT
WHERE class = "chinese"
CREATE PROPERTY User.name STRING
CREATE PROPERTY teach.relation INT
UPDATE EDGE teach SET IN = (SELECT FROM Teacher where fullname = 'field1' ) OUT = ( SELECT FROM student WHERE s_name= 'field1' ) relation = 1 UPSERT WHERE relation = 1
1. insert vertex
CREATE CLASS Teacher EXTENDS V;
CREATE CLASS Student EXTENDS V;
CREATE VERTEX Teacher CONTENT { "name" : "Jay", "surname" : "Miner" };
CREATE VERTEX Student CONTENT { "name" : "Tom", "surname" : "Miner" };
INSERT INTO Teacher (name, surname) VALUES ("Jay1", "Miner1");
INSERT INTO Teacher (name, surname) VALUES ("Jay2", "Miner2");
INSERT INTO Teacher (name, surname) VALUES ("Jay3", "Miner3");
INSERT INTO Student (name, surname) VALUES ("Tom1", "Miner1");
INSERT INTO Student (name, surname) VALUES ("Tom2", "Miner2");
INSERT INTO Student (name, surname) VALUES ("Tom3", "Miner3");
2. update vertex
UPDATE Teacher SET name = 'Jay3' WHERE @rid = #
UPDATE Student SET name = 'Jay3' WHERE name == 'Jay'
3. insert edge
CREATE CLASS teach EXTENDS E;
CREATE EDGE teach FROM ( select from Teacher where name == "Jay1" limit 1) To ( select from Student where name == "Tom1" limit 1) Content {"class": "chinese"};
4. update edge
UPDATE EDGE teach FROM ( SELECT FROM Teacher WHERE name = 'Jay2' limit 1 ) TO ( SELECT FROM Student WHERE name= 'Tom1' limit 1 ) UPSERT WHERE class = "chinese"
UPDATE EDGE teach SET
in = ( SELECT FROM Teacher WHERE name = 'Jay2' limit 1 ),
out = ( SELECT FROM Student WHERE name= 'Tom1' limit 1 )
UPSERT
WHERE class == "chinese"
update teach set in = #73:105, out = #73:106 where @rid = #121:2
update teach
set in = (select rid from index:tid where key = ["#73:10000"] limit 1 ) ,
out = (select rid from index:tid where key = ["#73:12002"] limit 1)
upsert
where @rid = #121:10
limit 1
### 1. 定义Vertex
```sql
CREATE CLASS Person EXTENDS V;
CREATE PROPERTY Person.name STRING;
CREATE PROPERTY Person.age INTEGER;
CREATE PROPERTY Person.createTime DATETIME;
|