Tag: datastax enterprise graph

如何在不使用Datastax Studio但通过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(); } } 起初我得到的“图形”不存在..我必须通过DataStax Studio创建与特定图形的连接,因为它不在那里。 现在我需要在模式中放置标签,属性等。我知道如何在工作室中进行操作( https://docs.datastax.com/en/latest-dse/datastax_enterprise/graph/using/createSchemaStudio.html )但我想在代码中这样做。 如何在Java中访问模式对象,以便我可以进行以下更改: schema.config().option(‘graph.schema_mode’).set(‘Development’) schema.vertexLabel(‘test’).create() […]

如何从gremlin返回子图,它是一种易于使用的Java格式

当我尝试进行单次遍历并使用Gremlin立即从DSE Graph 5.0中获取大量内容时,我对非常简单的事情感到非常沮丧。 在我的简化案例中,我有: 1个具有特定uuid的实体 实体可以为零(参见可选)或更多类型 我需要能够返回entity和types 到目前为止,我的工作非常难看:( List list = gV().hasLabel(“Entity”).has(“uuid”,”6708ec6d-4518-4159-9005-9e9d642f157e”).as(“entity”) .optional(outE(“IsOfType”).as(“types”)) .select(“entity”, “types”).toList(); List 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); } 列表中的每一行都有实体和其中一种类型:/ 我正在做这一切,因为Vertex没有基于DSE 5.0 Fluent API中的遍历填充edges() 。 所以要么我被困在多个遍历或一个巨大的可怕遍历,这在Java对象中非常难以反序列化,或者我必须将gremlin查询作为String传递但不会返回Gremlin Vertex对象而是DSE而是:( 在我不那么简化的情况下,我想要返回上面的多个实体及其各自的类型,如何做到这一点? 最后,什么是一个好的方法,将导致可重用的代码自定义对象映射具有不同类型的对象的子图? 提前谢谢你的帮助!