datastax-enterprise-graph

how to query by vertex id in Datastax DSE 5.0 Graph in a concise way?

孤街浪徒 提交于 2020-01-23 13:33:27
问题 It seems that the unique id for vertices is community_id in DSE Graph. I have found that this works (id is long) : v = g.V().has("VertexLabel","community_id",id).next() none of those work: v = g.V("community_id",id).next() v = g.V("community_id","VertexLabel:"+id).next() v = g.V(id).next() v = g.V().hasId(id).next() v = g.V().hasId("VertexLabel:"+id).next() v = g.V("VertexLabel:"+id).next() Edit After some investigation I found that for a vertex v, v.id() returns a LinkedHashMap: Vertex v =

Error when launching the graph (DSEGraphFrame )

﹥>﹥吖頭↗ 提交于 2020-01-06 06:09:56
问题 I have a dse graph in validation/prod environement. The problem occurs when I try to launch a DSEGraphFrame query using Spark in Scala. val graph = spark.dseGraph("my_graph") generates the following exception: Exception in thread "main" com.datastax.driver.core.exceptions.InvalidQueryException: The method DseGraphRpc.getSchemaBlob does not exist. Make sure that the required component for that method is active/enabled at com.datastax.driver.core.exceptions.InvalidQueryException.copy

How to create a graph and its schema without using Datastax Studio but through Java?

老子叫甜甜 提交于 2020-01-03 02:22:13
问题 I was trying to create my first connection with DSE Graph through java.. public static void main(String args[]){ DseCluster dseCluster = null; try { dseCluster = DseCluster.builder() .addContactPoint("192.168.1.43") .build(); DseSession dseSession = dseCluster.connect(); GraphTraversalSource g = DseGraph.traversal(dseSession, new GraphOptions().setGraphName("graph")); GraphStatement graphStatement = DseGraph.statementFromTraversal(g.addV("test")); GraphResultSet grs = dseSession.executeGraph

How to return a Vertex in the tinkerpop/gremlin format instead of the DSE graph format?

为君一笑 提交于 2019-12-31 04:03:09
问题 I am trying to return a Vertex (in tinkerpop format) that it was just created with Gremlin: DseCluster dseCluster = DseCluster.builder() .addContactPoint(DbC.dseHost) .build(); DseSession dseSession = dseCluster.connect(); GraphTraversal traversal = graph.addV(VertexLabels.User) .property("username", "testuser") GraphStatement graphStatement = DseGraph.statementFromTraversal( traversal ); GraphResultSet grs = dseSession.executeGraph(graphStatement.setGraphName(DbC.graphName)); Vertex v = grs

how to return subgraph from gremlin that is in an easily consumable format for Java

此生再无相见时 提交于 2019-12-18 09:48:23
问题 I am very frustrated about very simple things when I try to do a single traversal and bring a lot of stuff from DSE Graph 5.0 at once using Gremlin.. In my simplified case I have: 1 entity with specific uuid entity can have zero (see optional) or more types I need to be able to return the entity and the types What I have so far that works is very ugly :( List list = g.V().hasLabel("Entity").has("uuid","6708ec6d-4518-4159-9005-9e9d642f157e").as("entity") .optional(outE("IsOfType").as("types"))

executeGraph() is not really needed in Datastax DSE 5.0 Graph with Java?

人走茶凉 提交于 2019-12-12 20:01:58
问题 It seems that in both approaches the vertex is stored and can be retrieved properly later. Common configuration: DseCluster dseCluster = DseCluster.builder() .addContactPoint("192.168.1.43") .build(); DseSession dseSession = dseCluster.connect(); GraphTraversalSource g = DseGraph.traversal( dseSession, new GraphOptions().setGraphName("graph") ); Approach 1: Vertex v = g.addV("User").property("uuid","testuuid231").next(); Approach 2: GraphStatement graphStatement = DseGraph

Iterating a GraphTraversal with GraphFrame causes UnsupportedOperationException Row to Vertex conversion

北慕城南 提交于 2019-12-11 12:08:01
问题 The following GraphTraversal<Row, Edge> traversal = gf().E().hasLabel("foo").limit(5); while (traversal.hasNext()) {} causes the following Exception: java.lang.UnsupportedOperationException: Row to Vertex conversion is not supported: Use .df().collect() instead of the iterator at com.datastax.bdp.graph.spark.graphframe.DseGraphTraversal.iterator$lzycompute(DseGraphTraversal.scala:92) at com.datastax.bdp.graph.spark.graphframe.DseGraphTraversal.iterator(DseGraphTraversal.scala:78) at com

how to query by vertex id in Datastax DSE 5.0 Graph in a concise way?

狂风中的少年 提交于 2019-12-06 06:30:59
It seems that the unique id for vertices is community_id in DSE Graph. I have found that this works (id is long) : v = g.V().has("VertexLabel","community_id",id).next() none of those work: v = g.V("community_id",id).next() v = g.V("community_id","VertexLabel:"+id).next() v = g.V(id).next() v = g.V().hasId(id).next() v = g.V().hasId("VertexLabel:"+id).next() v = g.V("VertexLabel:"+id).next() Edit After some investigation I found that for a vertex v, v.id() returns a LinkedHashMap: Vertex v = gT.next(); Object id = v.id(); System.out.println(id); System.out.println(id.getClass()); System.out

Gremlin: adding edges between nodes having the same property

烂漫一生 提交于 2019-12-02 10:12:43
问题 I am very new to Gremlin. I am trying to build a graph on DSE graph using Gremlin. I am able to create the vertices: a = graph.addVertex(label, 'label1', 'key', 1) b = graph.addVertex(label, 'label1', 'key', 2) c = graph.addVertex(label, 'label2', 'key', 1) d = graph.addVertex(label, 'label2', 'key', 2) Now i am looking to automatically add edges between two nodes with differents label where the property 'key' matches (i.e create and edge between a and c, and between b and c). I am stuggling

How to return a Vertex in the tinkerpop/gremlin format instead of the DSE graph format?

风格不统一 提交于 2019-12-02 07:33:32
I am trying to return a Vertex (in tinkerpop format) that it was just created with Gremlin: DseCluster dseCluster = DseCluster.builder() .addContactPoint(DbC.dseHost) .build(); DseSession dseSession = dseCluster.connect(); GraphTraversal traversal = graph.addV(VertexLabels.User) .property("username", "testuser") GraphStatement graphStatement = DseGraph.statementFromTraversal( traversal ); GraphResultSet grs = dseSession.executeGraph(graphStatement.setGraphName(DbC.graphName)); Vertex v = grs.one().as(Vertex.class); and I am getting this exception... java.lang.ClassCastException: com.datastax