0

I have created properties and vertex like

schema.propertyKey('REFERENCE_ID').Int().multiple().create(); schema.propertyKey('Name').Text().single().create(); schema.propertyKey('PARENT_NAME').Text().single().create(); ... .... .. schema.propertyKey('XXX').Text().single().create(); schema.vertexLabel('VERT1').properties("REFERENCE_ID",.."PROPERTY10"....."PROPERTY15")//15 PROPERTIES schema.vertexLabel('VER2').properties("REFERENCE_ID",.."PROPERTY20"......"PROPERTY35")//35 PROPERTIES schema.vertexLabel('VERT3').properties("REFERENCE_ID",.."PROPERTY20"....."PROPERTY25")//25 PROPERTIES schema.vertexLabel('VERT4').properties("REFERENCE_ID",.."PROPERTY20"....."PROPERTY25")//25 PROPERTIES

and loaded csv data using DSG GRAPHLOADER(CSV TO(VERTEX)).

and created edge

schema.edgeLabel('ed1').single().create() schema.edgeLabel('ed1').connection('VERT1', 'VER2').add() schema.edgeLabel('ed1').single().create() schema.edgeLabel('ed1').connection('VERT1', 'VERT3').add() schema.edgeLabel('ed2').single().create() schema.edgeLabel('ed2').connection('VERT3','VERT4').add()

But I don't know how to map the data between vertex and edge. I want to join all these 4 vertex. Could you please help on this?

I'm new to dse. I just ran the above code in datastax studio successfully and I can see the loaded data. I need to join the vertex...

Sql code: I want same in dse germlin.

select v1.REFERENCE_ID,v2.name,v3.total from VERT1 v1
 join VER2 v2 on v1.REFERENCE_ID=v2.REFERENCE_ID
 join VERT3 v3 on v2.sid=v3.sid
Joseph Cho
  • 4,033
  • 4
  • 26
  • 33
JEYA
  • 1
  • 2

1 Answers1

2

there are 2 "main" options in DSE for adding edge data, plus one if you're also using DSE Analytics.

One is to use Gremlin, like what's documented here - https://docs.datastax.com/en/dse/6.0/dse-dev/datastax_enterprise/graph/using/insertTraversalAPI.html

This approach would be a traversal based approach and may not be the best/fastest choice for bulk operations

Another solution is to use the Graph Loader, check out the example with the .asEdge code sample here - https://docs.datastax.com/en/dse/6.0/dse-dev/datastax_enterprise/graph/dgl/dglCSV.html#dglCSV

If you have DSE Analytics enabled, you can also use DataStax's DSE GraphFrame implementation, which leverages Spark, to preform this task as well. Here's an example - https://docs.datastax.com/en/dse/6.0/dse-dev/datastax_enterprise/graph/graphAnalytics/dseGraphFrameImport.html

jlacefie
  • 614
  • 3
  • 5
  • this is working fine g.V().hasLabel("vert1").as("a",'REFERENCE_ID','S_NAME'). V().hasLabel("vert2").as("b",'TYPE','PHYSICAL') .filter(has("REFERENCE_ID","10234")) .where("a", eq("b")) .by("REFERENCE_ID") .V().hasLabel("vert3").as("c",'HEIGHT','P_REFERENCE') .where("a", eq("c")) .by("REFERENCE_ID") .select("REFERENCE_ID",'S_NAME',TYPE','PHYSICAL','HEIGHT','P_REFERENCE') .by("REFERENCE_ID") .by('S_NAME') .by('TYPE') .by('PHYSICAL') .by('HEIGHT') .by('P_REFERENCE') – JEYA Oct 12 '18 at 09:30