有时我们有必要把控制台的一部分或者全部的内容保存到文件中。您可以通过使用:record命令开启或者关闭录制到文件功能。
Sometimes it is useful to save part or all of a console session to a file. You can turn recording to a
file on and off using the :record command.
在下面的例子中,我们将使用:record start mylog.txt 命令开启录制功能,它会强制把所有输入控制台的命令和它们的运行输出结果保存到一个名为mylog.txt的文件中,直到您输入了:record stop命令。命令g.V().count().next()只是统计图中有多少个顶点。我们会在下一节中一起详细学习精灵图遍历和查询语言。
In the following example, we turn recording on using :record start mylog.txt which will force all
commands entered and their output to be written to the file mylog.txt until the command :record
stop is entered. The command g.V().count().next() just counts how many vertices (nodes) are in the
graph. We will explain the Gremlin graph traversal and query language in detail starting in the
next section.
我们来看一个mylog.txt文件的内容,目前为止它包含的内容如下:

在本书的后序章节中,各个例子的输出结果里笔者将不再显示gremlin>提示符或者==>输出提示,只是为了少一点混乱。您可以假定每条命令都已在小精灵控制台中输入并测试过。
For the remainder of this book I am not going to show the gremlin> prompt or the =⇒ output
identifier as part of each example, just to reduce clutter a bit. You can assume that each command
was entered and tested using the Gremlin console however.
如果您想了解控制台本身更多的内容,您可以参阅TinkerPop官方的文档,或者操作一下控制台,查看一下它内置的帮助。
If you want to learn more about the console itself you can refer to the official
TinkerPop documentation and, even better, have a play with the console and the
built in help.
浙公网安备 33010602011771号