Problem with/understanding the tutorial

1,023 views
Skip to first unread message

Sorin

unread,
Jun 29, 2011, 11:35:29 AM6/29/11
to OrientDB
Hi.
Can someone please explain me what am I doing wrong here? I can't
seem to get the link working. When it creates the link why does it say
it created 0 links? and when I want to remove postid why does it get
me Error: String index out of range: 28?

Kind Regards

[root@localhost bin]# java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

[root@localhost bin]# ./console.sh
ORIENT database v.1.0rc2 www.orientechnologies.com
Type 'help' to display all the commands supported.

> CREATE DATABASE local:../databases/test admin admin local
Creating database [local:../databases/test] using the storage type
[local]...
Database created successfully.

Current database is: local:../databases/test

> connect local:../databases/test admin admin
Connecting to database [local:../databases/test] with user
'admin'...OK

> CREATE CLASS POST

Class created successfully with id=2

> CREATE CLASS COMMENT

Class created successfully with id=3

> INSERT INTO POST (id, title) VALUES ( 10, 'NoSQL movement' );

Inserted record 'POST#5:0{id:10,title:NoSQL movement} v0' in 0.002000
sec(s).

> INSERT INTO POST (id, title) VALUES ( 20, 'New OrientDB' );

Inserted record 'POST#5:1{id:20,title:New OrientDB} v0' in 0.000000
sec(s).

>

> INSERT INTO COMMENT (id, postId, text) VALUES ( 0, 10, 'First' );

Inserted record 'COMMENT#6:0{id:0,text:First,postId:10} v0' in
0.000000 sec(s).

> INSERT INTO COMMENT (id, postId, text) VALUES ( 1, 10, 'Second' );

Inserted record 'COMMENT#6:1{id:1,text:Second,postId:10} v0' in
0.000000 sec(s).

> INSERT INTO COMMENT (id, postId, text) VALUES ( 21, 10, 'Another' );

Inserted record 'COMMENT#6:2{id:21,text:Another,postId:10} v0' in
0.001000 sec(s).

> INSERT INTO COMMENT (id, postId, text) VALUES ( 41, 20, 'First again' );

Inserted record 'COMMENT#6:3{id:41,text:First again,postId:20} v0' in
0.000000 sec(s).

> INSERT INTO COMMENT (id, postId, text) VALUES ( 82, 20, 'Second Again' );

Inserted record 'COMMENT#6:4{id:82,text:Second Again,postId:20} v0' in
0.000000 sec(s).

> CREATE LINK comments FROM comment.postId To post.id INVERSE
[==========] 100% Done.
Created 0 link(s) in 0.003000 sec(s).

> UPDATE comment REMOVE postId
Error: String index out of range: 28

> select * from post where comments.size() > 0

0 item(s) found. Query executed in 0.0030 sec(s).

Luca Garulli

unread,
Jun 30, 2011, 11:31:06 AM6/30/11
to orient-...@googlegroups.com
Hi,
there was a bug in the management of the link when the type was different than String. In your case (and the tutorial too) is an Integer. I've created a new test case for it to avoid the "create link" command breaks again.

Please try it against SVN trunk r3308.

Lvc@

BojanV

unread,
Nov 3, 2014, 5:10:46 AM11/3/14
to orient-...@googlegroups.com

Does this work now?
And what is the difference between "links" and "edges"? Are links used just in document model or in graph model also?

Mariusz Nosiński

unread,
Nov 6, 2014, 9:33:26 AM11/6/14
to orient-...@googlegroups.com
In graph models are Vertices and Edges. Edge connect two Vertices. Both can get properties and both are physical (are stored and can be fetched (excluding lightweight edges))). It's general concept.

Link is type of the property that store information about another vertex, It's like relation in Relational databases. If you want to use store more related vertices in one property you can use LinkSet.
Reply all
Reply to author
Forward
0 new messages