简体   繁体   English

Faunus图不使用gremlin shell的副作用就无法打印节点

[英]Faunus graph not printing nodes without using side effect from gremlin shell

I'm trying to print a graph in Faunus (v0.4.0) where a node has any edges (incoming or outgoing). 我正在尝试在Faunus(v0.4.0)中打印一个节点有任何边(传入或传出)的图形。 From the gremlin shell, I tried: 我从gremlin壳中尝试了:

g = FaunusFactory.open('faunus.properties')
g.V.filter("{it.bothE.hasNext()}").sideEffect("{println it}")

When I do this, I get a printout of all the nodes as I expected 当我这样做时,我将按预期得到所有节点的打印输出

But without the println, I do not. 但是没有println,我就没有。

According to How do I write a for loop in gremlin? 根据我如何在gremlin中编写for循环? , the gremlin terminal should print this info out for me, but it does not seem to. ,则gremlin终端应为我打印此信息,但似乎没有。

Is there something specific I need to do to enable the printing from the console? 要从控制台进行打印,我需要做些特定的事情吗?

Faunus and Gremlin are close to each other in terms of purpose and functionality but not identical. Faunus和Gremlin在目的和功能上彼此接近,但并不完全相同。 The filter isn't producing a side-effect, which will be written to HDFS. filter不会产生副作用,该副作用会写入HDFS。 If you did: 如果您这样做:

g.V.filter("{it.bothE.hasNext()}").id

You could then view the list of ids matching that filter with something like: 然后,您可以查看与该过滤器匹配的ID列表,例如:

hdfs.head('output',100)

to see the first 100 lines of the output. 查看输出的前100行。 If you need more than just the element identifier you could do a transform to get some of the element properties in there as well. 如果您不仅需要元素标识符,还可以进行transform以在其中获得一些元素属性。 You might find these hdfs helper tips helpful. 您可能会发现这些hdfs帮助器提示很有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM