Create a graph model on orientDB

46 views
Skip to first unread message

John

unread,
Jul 11, 2017, 4:01:43 AM7/11/17
to OrientDB
Hello, I would like to use Orientdb  for is graph property

my graph model (very simple) 
Some tags (alias): tag1 (node), tag2 (note), tag3(node)
Some place: place 1 place 2 place 3 


tag1 ------> place1 
tag2-------> place2
tag2-------> place1
tag3-------> place3
tag3-------> place2

I create a classe for all node? 

create class tag1 extends V
create
class tag2 extends V

create
class tag3 extends V

create
class place1 extends V
create
class place2 extends V
create
class place3 extends V



create property tag1
.id Integer
create property tag1
.name String
insert
into tag1 set id=1, name='tag01'                  //  @rid=34:0

....
create property place1
.id Integer
create property place1
.name String
insert
into place1 set id=1, name='place01'                 //   @rid=21:0

....




Create edge from #34:0 to #21:0      // make this for the 4 other edges
...

I fink that is not the good process to make a graph on OrientDB
Can someone help me :)? 

alessand...@gmail.com

unread,
Aug 18, 2017, 9:50:51 AM8/18/17
to OrientDB

Hi,
I hope this can help you.
To create the graph you could use these query

create class Tag extends v
create property
Tag.name String


create
class Place extends v
create property
Place.name String


insert
into Tag set name="tag01"
insert
into Tag set name="tag02"
insert
into Tag set name="tag03"


insert
into Place name='place01'
insert
into Place name='place02'
insert
into Place name='place03'


create edge e
from (select from Tag where name="tag01") to (select from Place where name="place01")
create edge e
from (select from Tag where name="tag02") to (select from Place where name="place01")
create edge e
from (select from Tag where name="tag02") to (select from Place where name="place02")
create edge e
from (select from Tag where name="tag03") to (select from Place where name="place02")
create edge e
from (select from Tag where name="tag03") to (select from Place where name="place03")



Best regards,

Alessandro



Reply all
Reply to author
Forward
0 new messages