Hi Mitul,

I think you should have something like this:

create class Phone extends V;
create property Phone.phoneId STRING;
create property Phone.phone STRING;

create class Email extends V;
create property Email.emailId STRING;
create property Email.email STRING;

create class Address extends V;
create class Address.line1 STRING;
create class Address.line2 STRING;
create class Address.city STRING;
create class Address.zipcode STRING;

create class Person extends V;
create property Person.personId STRING;
create property Person.fname STRING;
create property Person.lname STRING;
create property Person.phones LINKLIST Phone;
create property Person.emails LINKLIST Email;
create property Person.addresses LINKLIST Address;


It seems you are trying to link Person to Email and back from Email to
Person. I guess one way relation should be more than enough. But I might be
wrong if you have different query requirements.

Regards,
Ameer




On Fri, Mar 7, 2014 at 12:12 AM, Mitul Golakiya <[email protected]>wrote:

> Hello All,
>
> I am new to OrientDB and we want to move from MongoDB to OrientDB. Because
> at this stage we have very complex requirements of joins between
> tables(means our modules) and also we are facing huge problem of memory
> consumption.
>
> We have a different modules into our system like persons, leads,
> support_cases. And these all modules are internally connected. So in
> MongoDB we can not perform a join between them to retrieve data with some
> complex relationships. So we want to give a try to OrientDB, if its fit
> well to our requirements.
>
> We have one person module and we are storing full object of person into
> MongoDB. Person can have multiple phones, emails & addresses and other
> custom fields.
>
> Here is the structure that we have currently in MongoDB:
>
> {
> personId: 'personId1',
> fname: 'Mitul',
> lname: 'Golakiya',
> phnoes: [
> { phoneId: 'phoneId1', phone: '9999999999' },
> { phoneId: 'phoneId2', phone: '9999999900' }],
> emails: [
> {emailId:'emailId1', email: '[email protected]'}
> ],
> addresses: []
> }
>
> We have embedded array for all because we want to retrieve all the fields
> when we want person object and also whole person object is passed via
> services while insertion of person.
> And also we have a requirement like, we have to update single phone, email
> & address object.
>
> So to update single object in OrientDB we have to take separate tables for
> email, phone & address.
>
> So now my problem is, I have to insert all the things separately and
> create a links between them.
>
> Here is my schema:
>
> In person I am creating three fields emails, phones & addresses with
> LINKSET (@rid) type with its relevant linked classes.
> And in email, phone & address table, I am saving LINK type field which
> contains personId (@rid).
>
> So I am performing following sequence for insertion of person.
>
> 1. First I have to insert person.
> 2. Then insert email with person.@rid.
> 3. Insert phones with person.@rid.
> 4. Insert address with person.@rid.
> 5. Now update person's table and insert a @rids of email, phone & address
> in LINKSET field.
>
> So it is taking too much time in insert as compared to mongo.
> Mongo is taking only 140-150 millisecond. And in OrientDB these five
> operations are taking more than 1 second.
>
> So is there any way by which I can make it fast or I can insert it in a
> single query with all LINKs ??
> Or any other way by which I can optimize the time by schema change or
> anything else.
>
> Thanks in advance.
>
> --
>
> ---
> 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/groups/opt_out.
>

-- 

--- 
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.

Reply via email to