OrientDB Class

列出class

1
list classes

创建class

1
create class Student

添加class属性

1
2
create property Student.name String
create property Student.birthDate Date

显示class

1
info class Student

查看记录

1
2
browser class Student
display record 0

删除Class结构

1
delete class MdsTab

在删除Class中如果Vertex中有数据,需要先删除数据

1
delete VERTEX MdsTab

添加关系

关系为 tabDataFlow 有 in 与 out 属性

  • 使用insert
1
2
insert into tabDataFlow (in, out) values (#22:0 ,#21:0 )
insert into tabDataFlow set out = ( select from MdsTab where id = '3') , in=(select from MdsTab where id = '4')
  • 这个不可用
1
insert into tabDataFlow (in, out) values ( select from MdsTab where id = '3' , select from MdsTab where id = '4')
  • 使用 create edge
1
2
3
CREATE EDGE tabDataFlow FROM #22:0 TO #21:0
CREATE EDGE tabDataFlow FROM (select from MdsTab where id = '2') TO (select from MdsTab where id = '3');
CREATE EDGE FROM #10:3 TO #11:4 SET brand = 'abc'
  • 批量添加关系

Watched使用子查询在数据库中的所有动作电影action和用户Luca之间创建类型的边缘

1
CREATE EDGE Watched FROM (SELECT FROM account WHERE name = 'Luca') TO (SELECT FROM movies WHERE [type.name](http://type.name/) = 'action')

添加节点

通过insert和create vertex添加

1
2
3
4
5
6
7
insert into `MdsTabCol` (id, tabId, tenantId, name) 
values
(11, 1, 10000, 'col11'),
(12, 1, 10000, 'col12');

CREATE VERTEX `MdsTabCol` SET
id=23, tabId=2, tenantId=10000 , name='tabCol23