Hi,
If you wish to track relations and remove them along with entities you
should use graph database.
To create link with java api you can assign document instance as a value
and link will be created automatically.
Like this:
document.field("link", doc);for link set just create simple Set and assign it as field value. I would recommend you to create schema for class we are doing serialization changes after which schema full approach will be much faster. On Fri, Mar 28, 2014 at 7:35 PM, Nhat Nguyen <[email protected]>wrote: > I used the version 1.7-rc2, sorry i forgot to tell. > > > On Friday, March 28, 2014 6:35:00 PM UTC+1, Nhat Nguyen wrote: >> >> Hi, >> >> i have tried to create a Link between two classes: >> >> CREATE CLASS POST >> CREATE CLASS COMMENT >> >> INSERT INTO POST (id, title) VALUES( 10, 'NoSQL movement' ) >> INSERT INTO POST (id, title) VALUES( 20, 'New OrientDB' ) >> >> INSERT INTO COMMENT (id, postId, text) VALUES( 0, 10, 'First' ) >> INSERT INTO COMMENT (id, postId, text) VALUES( 1, 10, 'Second' ) >> INSERT INTO COMMENT (id, postId, text) VALUES( 21, 10, 'Another' ) >> INSERT INTO COMMENT (id, postId, text) VALUES( 41, 20, 'First again' ) >> INSERT INTO COMMENT (id, postId, text) VALUES( 82, 20, 'Second Again' ) >> >> CREATE LINK comments TYPE linkset FROM comment.postId To post.id INVERSE >> (example from the wiki) >> >> I tried to insert this hand-by-hand in the "console.bat". Sadly the part >> with the "create link ..." failed. >> >> orientdb {documentStorage}> create link comments type linkset from >> comment.postId to post.id inverse >> [ >> Error: >> com.orientechnologies.orient.core.exception.OCommandExecutionException: >> Error on execution of command: sql.create link comments type linkset from >> comment.postId to post.id inverse >> Error: java.util.UnknownFormatConversionException: Conversion = '%' >> >> There was a second example with a "*.sql" file which was passed to the >> "console.bat" via start parameter. The weird thing was that this worked >> fine :P. >> >> >> Is there maybe a third solution how i can create a link via java-api? And >> what happens for example when i delete a comment which was linked to a post >> entry? Will this link be removed when the comment is removed? >> >> >> regards >> Nhat >> >> -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Best regards, Andrey Lomakin. Orient Technologies the Company behind OrientDB -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
