我正在试验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) 有没有办法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限制它在构造顶点的步骤中被设置?
在我从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 REST 服务器,并且想在单个查询中创建到顶点的多条边。我有一个顶点 ID 列表,从那里创建边到单个顶点。
例如 - gV(12,13,14,15).addEdge('uses', gV(100))
我尝试了很多遍历步骤,但无法使其工作。
例如,给定此图:
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文件.文档没有说明如何做到这一点.提前致谢.
我的 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) 这可能是一个天真的问题,但我是这个领域的新手?
为什么Janus Graph不被称为框架(根据第一个文档页面上的定义),而Apache TinkerPop是?
我添加了顶点createDate作为属性。我想使用createDate属性检索最新创建的顶点。
我怎样才能找回这个。请在这件事上给予我帮助。
我通过远程连接到 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()
我在浏览 Apache TinkerPop文档时遇到了这个术语
在计算机中对图进行建模并将其应用于现代数据集和实践时,通用的面向数学的二进制图被扩展为支持标签和键/值属性
谷歌搜索“二进制图”返回“二叉树”的定义,它似乎不适合这里的上下文。
tinkerpop ×10
tinkerpop3 ×7
gremlin ×6
groovy ×2
janusgraph ×2
java ×2
database ×1
frameworks ×1
graph ×1
graph-theory ×1
neo4j ×1
titan ×1