简体   繁体   中英

need to join the vertex in dse

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM