alias orientserver='cd /opt/orientdb/bin;./server.sh'
alias orientdb='cd /opt/orientdb/bin/;./console.sh'
基本命令
connect remote:localhost/db1 root pass
create class test
classes
create property test.name STRING
create property test.id STRING
create property test.publishtime DATE
insert into test(name,id) values ('name1','id1')
select * from cluster:test
insert into cluster:test_2(name,id) values ('name1','id1')
select * from cluster:test_2
select * from cluster:test_1
alter class test addcluster test_qa
info class test
clusters
browse class test
browse cluster test_2
display record 0 #会从上一个browse的结果中拿record的序号
load record #129:0
update #129:0 set name = 'name11'
load record #129:0 #version会变
#3种select方式
select from cluster:ouser
select from #10:3
select from [#10:1, #10:30, #10:5]
select value from index:dictionary where key='jay'
select from ouser where status='active' skip 0 limit 2
select count (status) from ouser where status='active' group by status order by name asc,password desc
Graph操作
#默认class
insert into v set name='Jay'
create vertex v set name='Jay'
#自定义class
create class male extends V
create class female extends V
create class relationship extends E
create vertex male set name='OYB'
create vertex female set name='meizi'
create vertex female set name='meizi2'
create vertex female set name='meizi3'
create vertex female set name='meizi4'
create vertex female set name='meizi5'
create edge relationship from (select from female ) to (select from male where name = 'OYB')
create vertex male set name='son'
create edge relationship from (select from male where name = 'OYB') to (select from male where name = 'son')
create vertex male set name='father'
create vertex female set name='mother'
create edge relationship from (select from female where name = 'mother' ) to (select from female where name = 'meizi')
create edge relationship from (select from male where name = 'father' ) to (select from female where name = 'meizi')
create edge relationship from (select from female where name = 'meizi' ) to (select from male where name = 'son')
OUT() To retrieve the adjacent outgoing vertices
IN() To retrieve the adjacent incoming vertices
BOTH() To retrieve the adjacent incoming and outgoing vertices
EXPAND() To transform the vertex collection in the result-set by expanding it
select expand(IN()) from male where name ='OYB'
traverse both() from ( select from male where name ='OYB')
select expand(both()) from female where name='meizi'
select expand(both()) from male where name like 'meizi%'