test
test

Reputation: 91

Add a class vertex with properties and along with list of another class vertices and so on from JAVA in orient graph

Class A has properties and has list of class B and Class B has properties and has list of Class C. Class C has properties and so on.

I'm trying to save java object and using tinkerpop - trying to add in orient graph

so if i have to add class A vertices in orient graph. i need to add vertex of class A with prop1 and prop2 - i need to add vertex of class B with prop3 and prop4 with whatever count in list of Class A. - i need to add edge between between class A vertex and class B vertices so that it can carry the relationship A to B.

Again i need to add class C vertices in orient graph with whatever count in list of Class B. - I need to add edge between each class B vertex and Class C vertices so that it can carry the relationship between B to C.

If this goes to say 10th level, add vertices for each class could be mess and untidy to implement. it would be more of manual addition.

Is there any way i can save the class A vertex with class B vertices as list and class C list under class B in one shot instead of adding every class vertices and making relationship

I'm trying to achieve it do through java tinkerpop - gremlin, blueprints etc. Any suggestions/thoughts?

    class A {
     String prop1;
     String prop2;
     ArrayList<B> b;
     }

   class B {
   String prop3;
   String prop4; 
   ArrayList<C> c;      
   }

  Class C {
  String prop5;
  String prop6;
  }

Upvotes: 1

Views: 174

Answers (0)

Related Questions