orientdb学习记录

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%'

转载于:https://my.oschina.net/u/2935389/blog/877100

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值