apache / incubator-hugegraph

A graph database that supports more than 100+ billion data, high performance and scalability (Include OLTP Engine & REST-API & Backends)
https://hugegraph.apache.org
Apache License 2.0
2.62k stars 517 forks source link

java版client的问题 #1267

Closed big1white closed 3 years ago

big1white commented 3 years ago

Expected behavior 期望表现

{type something here...} java版本的client操作图都是使用写好的代码,比如: GraphManager graph = hugeClient.graph(); Vertex marko = graph.addVertex(T.label, "person", "name", "marko", "age", 29, "city", "Beijing"); Vertex vadas = graph.addVertex(T.label, "person", "name", "vadas", "age", 27, "city", "Hongkong"); 如果想自定义一个前端,就像HugeGraph Studio一样,通过接收字符串类型的Gremlin语句来操作图,目前有这样的方法吗?

Actual behavior 实际表现

{type something here...}

Steps to reproduce the problem 复现步骤

  1. {step 1}
  2. {step 2}
  3. {step 3}

Status of loaded data 数据状态

Vertex/Edge summary 数据量

Vertex/Edge example 数据示例

{type something here...}

Schema(VertexLabel, EdgeLabel, IndexLabel) 元数据结构

{type something here...}

Specifications of environment 环境信息

Linary commented 3 years ago

@big1white client可以拿到一个GremlinManager,用它就可以执行gremlin语句了。示例如下:

        GremlinManager gremlin = hugeClient.gremlin();
        ResultSet resultSet = gremlin.gremlin("g.V().outE().path()").execute();
        Iterator<Result> results = resultSet.iterator();
        results.forEachRemaining(result -> {
            System.out.println(result.getObject().getClass());
            Object object = result.getObject();
            if (object instanceof Vertex) {
                System.out.println(((Vertex) object).id());
            } else if (object instanceof Edge) {
                System.out.println(((Edge) object).id());
            } else if (object instanceof Path) {
                List<Object> elements = ((Path) object).objects();
                elements.forEach(element -> {
                    System.out.println(element.getClass());
                    System.out.println(element);
                });
            } else {
                System.out.println(object);
            }
        });