天道酬勤,学无止境

datastax-enterprise-graph

Error when launching the graph (DSEGraphFrame )

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(InvalidQueryException.java:40) at com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java

2021-10-21 10:39:50    分类:问答    scala   apache-spark   gremlin   datastax-enterprise-graph   dse-graph-frames

使用 GraphFrame 迭代 GraphTraversal 会导致 UnsupportedOperationException Row 到 Vertex 转换(Iterating a GraphTraversal with GraphFrame causes UnsupportedOperationException Row to Vertex conversion)

问题 下列 GraphTraversal<Row, Edge> traversal = gf().E().hasLabel("foo").limit(5); while (traversal.hasNext()) {} 导致以下异常: 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.datastax.bdp.graph.spark.graphframe.DseGraphTraversal.hasNext(DseGraphTraversal.scala:129) 例外说使用.df().collect()但gf().E().hasLabel("foo"

2021-10-21 05:05:33    分类:技术分享    datastax   datastax-enterprise   datastax-java-driver   datastax-enterprise-graph

Gremlin:在具有相同属性的节点之间添加边(Gremlin: adding edges between nodes having the same property)

问题 我对 Gremlin 很陌生。 我正在尝试使用 Gremlin 在 DSE 图上构建图。 我能够创建顶点: 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) 现在我希望在属性“key”匹配的两个节点之间自动添加具有不同标签的边(即在 a 和 c 之间以及 b 和 c 之间创建和边)。 我正在努力做到这一点。 我尝试执行以下操作 g.V().hasLabel("label1").sideEffect{g.V().("label2").has("key",it.key).addEdge("link",it)} 但我收到以下错误: No signature of method: org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_Traverser.values() is applicable for argument types: (java.lang.String) values:

2021-10-15 12:40:22    分类:技术分享    graph   gremlin   tinkerpop   edges   datastax-enterprise-graph

在使用 Java 的 Datastax DSE 5.0 Graph 中真的不需要 executeGraph() 吗?(executeGraph() is not really needed in Datastax DSE 5.0 Graph with Java?)

问题 似乎在两种方法中都存储了顶点,以后可以正确检索。 常用配置: DseCluster dseCluster = DseCluster.builder() .addContactPoint("192.168.1.43") .build(); DseSession dseSession = dseCluster.connect(); GraphTraversalSource g = DseGraph.traversal( dseSession, new GraphOptions().setGraphName("graph") ); 方法一: Vertex v = g.addV("User").property("uuid","testuuid231").next(); 方法二: GraphStatement graphStatement = DseGraph.statementFromTraversal( g.addV("User").property("uuid","testuuid231") ); GraphResultSet grs = dseSession.executeGraph(graphStatement.setGraphName("graph")); Vertex v = grs.one().asVertex() // as(Vertex.class) is not

2021-10-09 01:59:11    分类:技术分享    java   datastax   gremlin   datastax-java-driver   datastax-enterprise-graph

如何以简洁的方式通过 Datastax DSE 5.0 Graph 中的顶点 id 进行查询?(how to query by vertex id in Datastax DSE 5.0 Graph in a concise way?)

问题 顶点的唯一 id 似乎是 DSE Graph 中的 community_id。 我发现这有效(id 很长): v = g.V().has("VertexLabel","community_id",id).next() 这些都不起作用: 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() 编辑 经过一番调查,我发现对于顶点 v,v.id() 返回一个 LinkedHashMap: Vertex v = gT.next(); Object id = v.id(); System.out.println(id); System.out.println(id.getClass()); System.out.println(g.V().hasId(id).next()); System.out.println(g.V(id).next()); 上面的打印: {~label=User, community_id=1488246528

2021-10-09 01:58:40    分类:技术分享    datastax   gremlin   datastax-enterprise-graph

如何在不使用 Datastax Studio 而是通过 Java 创建图形及其模式?(How to create a graph and its schema without using Datastax Studio but through Java?)

问题 我试图通过 java 创建我与 DSE Graph 的第一个连接。 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(graphStatement.setGraphName("graph")); System.out.println(grs.one().asVertex()); } finally { if (dseCluster != null) dseCluster.close(); }

2021-10-09 01:56:47    分类:技术分享    java   datastax   datastax-enterprise   datastax-java-driver   datastax-enterprise-graph

Iterating a GraphTraversal with GraphFrame causes UnsupportedOperationException Row to Vertex conversion

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.datastax.bdp.graph.spark.graphframe.DseGraphTraversal.hasNext(DseGraphTraversal.scala:129) Exception says to

2021-09-24 06:54:44    分类:问答    datastax   datastax-enterprise   datastax-java-driver   datastax-enterprise-graph

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

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.statementFromTraversal( g.addV("User").property("uuid","testuuid231") ); GraphResultSet grs = dseSession.executeGraph

2021-09-04 03:59:40    分类:问答    java   datastax   gremlin   datastax-java-driver   datastax-enterprise-graph

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

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(graphStatement.setGraphName("graph")); System.out.println(grs.one().asVertex()); } finally { if

2021-06-27 13:07:57    分类:问答    java   datastax   datastax-enterprise   datastax-java-driver   datastax-enterprise-graph

如何从 gremlin 返回一个易于使用的 Java 格式的子图(how to return subgraph from gremlin that is in an easily consumable format for Java)

问题 当我尝试进行一次遍历并使用 Gremlin 一次从 DSE Graph 5.0 中获取大量内容时,我对非常简单的事情感到非常沮丧。 在我的简化案例中,我有: 1 个具有特定 uuid 的实体实体可以有零(见可选)或更多类型我需要能够返回entity和types 到目前为止,我所拥有的东西非常丑陋:( List list = g.V().hasLabel("Entity").has("uuid","6708ec6d-4518-4159-9005-9e9d642f157e").as("entity") .optional(outE("IsOfType").as("types")) .select("entity", "types").toList(); List<Edge> typeEdges = new ArrayList<>(); Vertex entityV = null; for (Object obj : list) { entityV = ((Vertex)((LinkedHashMap) obj).get("entity")); Edge typeEdge = ((Edge)((LinkedHashMap) obj).get("types")); typeEdges.add(typeEdge); } 列表中的每一行都有实体和其中一种类型:/ 我这样做是因为

2021-06-26 19:19:23    分类:技术分享    java   datastax-enterprise   gremlin   datastax-enterprise-graph