标签: tinkerpop

为什么不能将 Gremlin GraphTraversal 捕获为 Groovy 变量?

我正在试验TinkerPop3 文档中的遍历示例。在Gremlin shell 中使用,加载了经典图形g = TinkerFactory.createClassic()

gremlin> marko = g.v(1)
==>v[1]
gremlin> marko
==>v[1]
Run Code Online (Sandbox Code Playgroud)

然而:

gremlin> marko = g.V().has('name', 'marko')
==>v[1]
gremlin> marko
gremlin>
Run Code Online (Sandbox Code Playgroud)

为什么第二种形式没有捕获v[1]


鉴于第二种形式,尝试使用该变量会导致错误:

gremlin> marko.out('knows')
The traversal strategies are complete and the traversal can no longer have steps added to it
Display stack trace? [yN] 
Run Code Online (Sandbox Code Playgroud)

groovy gremlin tinkerpop tinkerpop3

1
推荐指数
1
解决办法
2054
查看次数

Tinkerpop:创建顶点后设置标签

有没有办法T.label在创建顶点后设置.我尝试过以下方法:

Vertex v = graph.addVertex();
v.property(T.label.name(), "test");
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试以下遍历时:

graph.traversal().V().hasLabel("test").next
Run Code Online (Sandbox Code Playgroud)

我明白了

org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException
Run Code Online (Sandbox Code Playgroud)

有没有什么特别的东西T.label限制它在构造顶点的步骤中被设置?

java tinkerpop tinkerpop3

1
推荐指数
1
解决办法
861
查看次数

如何使用谓词文本在Titan 1.0/TP3 3.01中的顶点索引之间进行逻辑OR

在我从TP2 0.54 - > TP3 titan 1.0/Tinkerpop 3.01迁移期间

我正在尝试构建gremlin查询,该查询使用谓词文本在不同顶点索引的属性之间进行"逻辑或运算"

就像是:

-------------------预先定义的ES指数:------------------

tg = TitanFactory.open('../conf/titan-cassandra-es.properties')
tm = tg.openManagement();
g=tg.traversal();

      PropertyKey pNodeType = createPropertyKey(tm, "nodeType", String.class, Cardinality.SINGLE);
      PropertyKey userContent = createPropertyKey(tm, "storyContent", String.class, Cardinality.SINGLE);
      PropertyKey storyContent = createPropertyKey(tm, "userContent", String.class, Cardinality.SINGLE);

            //"storyContent" : is elasticsearch backend index - mixed
            tm.buildIndex(indexName, Vertex.class).addKey(storyContent, Mapping.TEXTSTRING.asParameter()).ib.addKey(pNodeType, Mapping.TEXTSTRING.asParameter()).buildMixedIndex("search");

            //"userContent" : is elasticsearch backend index - mixed
            tm.buildIndex(indexName, Vertex.class).addKey(userContent, Mapping.TEXTSTRING.asParameter()).ib.addKey(pNodeType, Mapping.TEXTSTRING.asParameter()).buildMixedIndex("search");


            v1= g.addVertex()
            v1.property("nodeType","USER")
            v1.property("userContent" , "dccsdsadas")

            v2= g.addVertex()
            v2.property("nodeType","STORY")
            v2.property("storyContent" , "abdsds")

            v3= g.addVertex()
            v3.property("nodeType","STORY")
            v3.property("storyContent" , …
Run Code Online (Sandbox Code Playgroud)

gremlin titan tinkerpop tinkerpop3

1
推荐指数
1
解决办法
368
查看次数

使用顶点 ID 在单个 gremlin 查询中添加多条边

我在应用程序中使用 gremlin REST 服务器,并且想在单个查询中创建到顶点的多条边。我有一个顶点 ID 列表,从那里创建边到单个顶点。

例如 - gV(12,13,14,15).addEdge('uses', gV(100))

我尝试了很多遍历步骤,但无法使其工作。

groovy gremlin tinkerpop tinkerpop3 gremlin-server

1
推荐指数
1
解决办法
1826
查看次数

如何使用TinkerPop打印出图像?

例如,给定此图:

gremlin> graph = TinkerFactory.createModern() (1)
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal(standard())        (2)
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V().has('name','marko').out('knows').values('name') (3)
Run Code Online (Sandbox Code Playgroud)

我想从控制台打印出该图形的PNG文件.文档没有说明如何做到这一点.提前致谢.

neo4j tinkerpop tinkerpop3

1
推荐指数
1
解决办法
425
查看次数

从遍历中获取顶点或路径时,Tinkerpop 非常慢

我的 Java 应用程序中有一个图形遍历,在遍历完成后需要 300 毫秒以上才能填充路径对象。这很奇怪,因为它只发生在某些特定的遍历上,而其他遍历会立即填充它们的路径。这是 Java 代码示例,使用 Tinkerpop 3.3.1

我有一种情况,两个顶点由一条边直接连接。每次执行这个短遍历时,我都会得到很高的处理时间。如果我不执行 fill() 操作,遍历会立即完成。我还有其他需要遍历 10 多个边的遍历,并且它们在 < 1 毫秒内处理和填充路径。

在下面的代码中,我试图找到从“origs”中的顶点到“dests”中的顶点的最短路径,而不经过集合“avoids”中的任何顶点。遍历本身在 1 毫秒内完成,它的 fill() 方法消耗了时钟。

    Date startTime = new Date ();
    if (! dests.isEmpty ()){
        g.V (origs).where (is (P.without (avoids))).    
        repeat (
                out ().
                simplePath ().
                where (is (P.without (avoids)))
                ).
                until (is (P.within (dests))).
                limit (1).
                path ().
                fill (paths);  // This 'fill' is the line that can take > 300ms.
                               // When fill is removed from the code,
                               // this all …
Run Code Online (Sandbox Code Playgroud)

java graph-theory gremlin tinkerpop tinkerpop3

1
推荐指数
1
解决办法
366
查看次数

为什么Janus Graph在Apache TInkerPop中不被称为框架?

这可能是一个天真的问题,但我是这个领域的新手?

为什么Janus Graph不被称为框架(根据第一个文档页面上的定义),而Apache TinkerPop是?

database frameworks tinkerpop janusgraph

1
推荐指数
1
解决办法
157
查看次数

Gremlin 按最新日期订购

我添加了顶点createDate作为属性。我想使用createDate属性检索最新创建的顶点。

我怎样才能找回这个。请在这件事上给予我帮助。

gremlin tinkerpop

1
推荐指数
1
解决办法
5621
查看次数

JanusGraph/tinkerpop 中的连接泄漏

我通过远程连接到 janusGraph

cluster = Cluster.build()
                .addContactPoints(uri.split("\\|"))
                .port(port)
                .serializer(new GryoMessageSerializerV1d0(GryoMapper.build().addRegistry(JanusGraphIoRegistry.getInstance())))
                .maxConnectionPoolSize(poolSize)
                .maxContentLength(10000000)
                .create();
        gts = AnonymousTraversalSource
                .traversal()
                .withRemote(DriverRemoteConnection.using(cluster));
Run Code Online (Sandbox Code Playgroud)

由于 gts 是线程安全的,我将 gts 保持在静态上下文中。每个线程使用相同的对象,并且没有一个线程通过调用 gts.close() 关闭 gts 每个线程运行查询,例如: result = gts.V().has("foo","bar").valueMap().toList() 我不关闭 gts(graphTraversalSource) 不是由创建的 graphTraversal 对象gts.V()

  • 我应该关闭从 gts(graphTraversalSource) 创建的每个 graphTraversal 对象吗?
  • 我应该什么时候关闭这些对象?

gremlin tinkerpop tinkerpop3 gremlin-server janusgraph

1
推荐指数
1
解决办法
122
查看次数

什么是二元图?

我在浏览 Apache TinkerPop文档时遇到了这个术语

在计算机中对图进行建模并将其应用于现代数据集和实践时,通用的面向数学的二进制图被扩展为支持标签和键/值属性

谷歌搜索“二进制图”返回“二叉树”的定义,它似乎不适合这里的上下文。

graph tinkerpop

1
推荐指数
1
解决办法
699
查看次数