从gremlin服务器获取正确数据的问题

从gremlin服务器获取正确数据的问题,gremlin,tinkerpop,tinkerpop3,gremlin-server,graphson,Gremlin,Tinkerpop,Tinkerpop3,Gremlin Server,Graphson,我有一系列让我发疯的荒谬问题。我正努力完成以下几件事: 我试图将我的gremlin服务器设置为“加载”某个json文件,该文件采用graphson格式,并在那里遇到一些非常奇怪的问题,我将详细介绍这些问题 我试图运行一个简单的ajax调用来查询这些数据,但是——我不仅无法获得我想要的数据(这可能是有道理的,因为gremlin拒绝加载它),而且我似乎得到了一些我不知道从哪里来的数据 我正试图找出如何在我的终端上测试gremlin服务器,但我无法运行查询,因为/gremlin-server.sh s

我有一系列让我发疯的荒谬问题。我正努力完成以下几件事:

  • 我试图将我的gremlin服务器设置为“加载”某个
    json
    文件,该文件采用
    graphson
    格式,并在那里遇到一些非常奇怪的问题,我将详细介绍这些问题

  • 我试图运行一个简单的ajax调用来查询这些数据,但是——我不仅无法获得我想要的数据(这可能是有道理的,因为gremlin拒绝加载它),而且我似乎得到了一些我不知道从哪里来的数据

  • 我正试图找出如何在我的终端上测试gremlin服务器,但我无法运行查询,因为
    /gremlin-server.sh status
    返回
    服务器未运行
    ,即使它100%运行并且我的ajax调用可以看到这一点

  • 小精灵没有加载文件 首先,我运行的是Gremlin v.3.4.3,可以找到它。我用来运行gremlin的命令是

    bin/gremlin-server.sh data/gremlin-server rest-modern.yaml

    Te yaml文件随Gremlin服务器下载一起提供,其内容包括:

    #...license stuff...
    
    host: localhost
    port: 8182
    scriptEvaluationTimeout: 30000
    channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
    graphs: {
      graph: conf/tinkergraph-empty.properties}
    scriptEngines: {
      gremlin-groovy: {
        plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
                   org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
                   org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
                   org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/generate-modern.groovy]}}}}
    serializers:
      - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] }}         # application/json
    metrics: {
      slf4jReporter: {enabled: true, interval: 180000}}
    strictTransactionManagement: false
    maxInitialLineLength: 4096
    maxHeaderSize: 8192
    maxChunkSize: 8192
    maxContentLength: 65536
    maxAccumulationBufferComponents: 1024
    resultIterationBatchSize: 64
    
    gremlin.graph=org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
    gremlin.tinkergraph.vertexIdManager=LONG
    
    现在,据我所知,需要注意的重要一点是组件
    graph
    ,它会导致一个
    properties
    文件。我正在加载的属性文件是
    tinkergraph empty。属性
    ,其内容是:

    #...license stuff...
    
    host: localhost
    port: 8182
    scriptEvaluationTimeout: 30000
    channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
    graphs: {
      graph: conf/tinkergraph-empty.properties}
    scriptEngines: {
      gremlin-groovy: {
        plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
                   org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
                   org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
                   org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/generate-modern.groovy]}}}}
    serializers:
      - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] }}         # application/json
    metrics: {
      slf4jReporter: {enabled: true, interval: 180000}}
    strictTransactionManagement: false
    maxInitialLineLength: 4096
    maxHeaderSize: 8192
    maxChunkSize: 8192
    maxContentLength: 65536
    maxAccumulationBufferComponents: 1024
    resultIterationBatchSize: 64
    
    gremlin.graph=org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph
    gremlin.tinkergraph.vertexIdManager=LONG
    
    文件名为tinkergraph empty,暗示了一件重要的事情:gremlin服务器不会加载图形。酷-当我启动gremlin服务器时,它会正常加载,并产生预期的结果:

    [INFO] GremlinServer - Configuring Gremlin Server from ./conf/gremlin-server-rest-modern.yaml
    [INFO] MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
    [INFO] DefaultGraphManager - Graph [graph] was successfully configured via [conf/tinkergraph-empty.properties].
    [INFO] ServerGremlinExecutor - Initialized Gremlin thread pool.  Threads in pool named with pattern gremlin-*
    [INFO] ServerGremlinExecutor - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/Users/<user>/apache-tinkerpop-gremlin-server-3.4.3/lib/groovy-2.5.7-indy.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
    WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    [INFO] ServerGremlinExecutor - Initialized gremlin-groovy GremlinScriptEngine and registered metrics
    [INFO] ServerGremlinExecutor - A GraphTraversalSource is now bound to [g] with graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
    [INFO] OpLoader - Adding the standard OpProcessor.
    [INFO] OpLoader - Adding the session OpProcessor.
    [INFO] OpLoader - Adding the traversal OpProcessor.
    [INFO] TraversalOpProcessor - Initialized cache for TraversalOpProcessor with size 1000 and expiration time of 600000 ms
    [INFO] GremlinServer - Executing start up LifeCycleHook
    [INFO] Logger$info - Loading 'modern' graph data.
    [INFO] AbstractChannelizer - Configured application/vnd.gremlin-v3.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0
    [INFO] AbstractChannelizer - Configured application/json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0
    [INFO] GremlinServer$1 - Gremlin Server configured with worker thread pool of 1, gremlin pool of 8 and boss thread pool of 1.
    [INFO] GremlinServer$1 - Channel started at port 8182.
    
    我现在加载了一个名为
    tinkerpop crew.json
    的数据文件夹,并添加了一个
    graphFormat:graphson
    。这应该是正确的。可以找到json文件,属性文件的格式如下

    现在,当我运行这个时,我得到了一个非常不同的结果:

    [INFO] GremlinServer - Configuring Gremlin Server from ./conf/gremlin-server-rest-modern.yaml
    [INFO] MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
    [INFO] DefaultGraphManager - Graph [graph] was successfully configured via [conf/tinkergraph-empty.properties].
    [INFO] ServerGremlinExecutor - Initialized Gremlin thread pool.  Threads in pool named with pattern gremlin-*
    [INFO] ServerGremlinExecutor - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/Users/xbbn1xn/apache-tinkerpop-gremlin-server-3.4.3/lib/groovy-2.5.7-indy.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
    WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    [INFO] ServerGremlinExecutor - Initialized gremlin-groovy GremlinScriptEngine and registered metrics
    [INFO] ServerGremlinExecutor - A GraphTraversalSource is now bound to [g] with graphtraversalsource[tinkergraph[vertices:6 edges:14], standard]
    [INFO] OpLoader - Adding the standard OpProcessor.
    [INFO] OpLoader - Adding the session OpProcessor.
    [INFO] OpLoader - Adding the traversal OpProcessor.
    [INFO] TraversalOpProcessor - Initialized cache for TraversalOpProcessor with size 1000 and expiration time of 600000 ms
    [INFO] GremlinServer - Executing start up LifeCycleHook
    [INFO] Logger$info - Loading 'modern' graph data.
    [ERROR] GremlinServer - Gremlin Server Error
    java.lang.IllegalArgumentException: Vertex with id already exists: 1
        at org.apache.tinkerpop.gremlin.structure.Graph$Exceptions.vertexWithIdAlreadyExists(Graph.java:1196)
        at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.addVertex(TinkerGraph.java:167)
        at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory.generateModern(TinkerFactory.java:90)
        at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory$generateModern.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
        at Script1$_run_closure1.doCall(Script1.groovy:28)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
        at groovy.lang.Closure.call(Closure.java:405)
        at org.codehaus.groovy.runtime.ConvertedMap.invokeCustom(ConvertedMap.java:54)
        at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:122)
        at com.sun.proxy.$Proxy15.onStartUp(Unknown Source)
        at org.apache.tinkerpop.gremlin.server.GremlinServer.lambda$start$1(GremlinServer.java:154)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
        at org.apache.tinkerpop.gremlin.server.GremlinServer.start(GremlinServer.java:151)
        at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:346)
    [ERROR] GremlinServer - Gremlin Server was unable to start and will now begin shutdown: Vertex with id already exists: 1
    [INFO] GremlinServer - Shutting down OpProcessor[]
    [INFO] GremlinServer - Shutting down OpProcessor[session]
    [INFO] GremlinServer - Shutting down OpProcessor[traversal]
    [INFO] GremlinServer - Shutting down thread pools.
    [INFO] GremlinServer - Executing shutdown LifeCycleHook
    [INFO] GremlinServer - Closed Graph instance [graph]
    [INFO] GremlinServer - Gremlin Server - shutdown complete
    
    嗯?顶点已经存在?那是不可能的。我从来没有运行过这个文件,为什么会有它的内存呢?就gremlin而言,我甚至从未加载过图形。也许它启动了一个图形,却忘记了从内存中删除它,对吗

    好吧,让我们创建我们自己的文件,只初始化一个顶点和一些奇怪的素数,没有边。让我们称之为
    tinkerpop-crew2.json

    {“id”:{“@type”:“g:Int64”,“@value:47284629},“label”:“person”}

    可能不是最好的。无论什么好吧,太棒了,成功了

    [INFO] GremlinServer - Configuring Gremlin Server from ./conf/gremlin-server-rest-modern.yaml
    [INFO] MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
    [INFO] DefaultGraphManager - Graph [graph] was successfully configured via [conf/tinkergraph-empty.properties].
    [INFO] ServerGremlinExecutor - Initialized Gremlin thread pool.  Threads in pool named with pattern gremlin-*
    [INFO] ServerGremlinExecutor - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/Users/xbbn1xn/apache-tinkerpop-gremlin-server-3.4.3/lib/groovy-2.5.7-indy.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
    WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    [INFO] ServerGremlinExecutor - Initialized gremlin-groovy GremlinScriptEngine and registered metrics
    [INFO] ServerGremlinExecutor - A GraphTraversalSource is now bound to [g] with graphtraversalsource[tinkergraph[vertices:1 edges:0], standard]
    [INFO] OpLoader - Adding the standard OpProcessor.
    [INFO] OpLoader - Adding the session OpProcessor.
    [INFO] OpLoader - Adding the traversal OpProcessor.
    [INFO] TraversalOpProcessor - Initialized cache for TraversalOpProcessor with size 1000 and expiration time of 600000 ms
    [INFO] GremlinServer - Executing start up LifeCycleHook
    [INFO] Logger$info - Loading 'modern' graph data.
    [INFO] AbstractChannelizer - Configured application/vnd.gremlin-v3.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0
    [INFO] AbstractChannelizer - Configured application/json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0
    [INFO] GremlinServer$1 - Gremlin Server configured with worker thread pool of 1, gremlin pool of 8 and boss thread pool of 1.
    [INFO] GremlinServer$1 - Channel started at port 8182.
    
    请注意:
    [INFO]服务器gremlinexecutor-GraphTraversalSource现在已通过GraphTraversalSource[tinkergraph[Vertexs:1 Edge:0],standard]绑定到[g]
    。一轮

    当我们将服务器配置为再次使用此文件时会发生什么情况

    [INFO] GremlinServer - Configuring Gremlin Server from ./conf/gremlin-server-rest-modern.yaml
    [INFO] MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
    [INFO] DefaultGraphManager - Graph [graph] was successfully configured via [conf/tinkergraph-empty.properties].
    [INFO] ServerGremlinExecutor - Initialized Gremlin thread pool.  Threads in pool named with pattern gremlin-*
    [INFO] ServerGremlinExecutor - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/Users/xbbn1xn/apache-tinkerpop-gremlin-server-3.4.3/lib/groovy-2.5.7-indy.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
    WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    [INFO] ServerGremlinExecutor - Initialized gremlin-groovy GremlinScriptEngine and registered metrics
    [INFO] ServerGremlinExecutor - A GraphTraversalSource is now bound to [g] with graphtraversalsource[tinkergraph[vertices:7 edges:6], standard]
    [INFO] OpLoader - Adding the standard OpProcessor.
    [INFO] OpLoader - Adding the session OpProcessor.
    [INFO] OpLoader - Adding the traversal OpProcessor.
    [INFO] TraversalOpProcessor - Initialized cache for TraversalOpProcessor with size 1000 and expiration time of 600000 ms
    [INFO] GremlinServer - Executing start up LifeCycleHook
    [INFO] Logger$info - Loading 'modern' graph data.
    [ERROR] GremlinServer - Gremlin Server Error
    java.lang.IllegalArgumentException: Vertex with id already exists: 1
        at org.apache.tinkerpop.gremlin.structure.Graph$Exceptions.vertexWithIdAlreadyExists(Graph.java:1196)
        at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.addVertex(TinkerGraph.java:167)
        at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory.generateModern(TinkerFactory.java:90)
        at org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory$generateModern.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
        at Script1$_run_closure1.doCall(Script1.groovy:28)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
        at groovy.lang.Closure.call(Closure.java:405)
        at org.codehaus.groovy.runtime.ConvertedMap.invokeCustom(ConvertedMap.java:54)
        at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:122)
        at com.sun.proxy.$Proxy15.onStartUp(Unknown Source)
        at org.apache.tinkerpop.gremlin.server.GremlinServer.lambda$start$1(GremlinServer.java:154)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
        at org.apache.tinkerpop.gremlin.server.GremlinServer.start(GremlinServer.java:151)
        at org.apache.tinkerpop.gremlin.server.GremlinServer.main(GremlinServer.java:346)
    [ERROR] GremlinServer - Gremlin Server was unable to start and will now begin shutdown: Vertex with id already exists: 1
    [INFO] GremlinServer - Shutting down OpProcessor[]
    [INFO] GremlinServer - Shutting down OpProcessor[session]
    [INFO] GremlinServer - Shutting down OpProcessor[traversal]
    [INFO] GremlinServer - Shutting down thread pools.
    [INFO] GremlinServer - Executing shutdown LifeCycleHook
    [INFO] GremlinServer - Closed Graph instance [graph]
    [INFO] GremlinServer - Gremlin Server - shutdown complete
    
    和以前一样的错误。这到底是怎么回事?还有两件事引起了我的注意:

  • ERROR]Gremlin服务器-Gremlin服务器错误
    java.lang.IllegalArgumentException:id为的顶点已存在:1
    。是说只有一个顶点存在,还是ID为“1”的顶点存在?因为没有一个顶点的ID为1。也就是说,直到

  • 您注意到这甚至没有加载我的文件<代码>[INFO]服务器gremlinexecutor-GraphTraversalSource现在已通过GraphTraversalSource[tinkergraph[顶点:7边:6],标准]绑定到[g]。我的文件没有7个顶点和6条边。它有1个顶点和0条边。这实际上看起来很可疑,它正在加载原始的
    tinkerpop crew.json
    文件或类似文件,即使我们最初加载它时,信息消息说:
    [INFO]ServerGremlinExecutor-GraphTraversSource现在通过GraphTraversSource[tinkergraph[vertices:6 Edge:14],standard]绑定到[g]

  • 好吧,我不知道这里发生了什么

    运行ajax查询以查看发生了什么 我有一个非常非常简单的查询,我使用AJAX调用运行并发布:

    $.ajax({
                type: "POST",
                accept: "application/json",
                url: url // http://localhost:8182,
                timeout: timeout // I have it set to 3500,
                data: JSON.stringify({"gremlin" : q}),
                success: function(data, textStatus, jqXHR){
                                var retrvData = data.result.data;
                                console.log(retrvData)
    }
    
    好吧,有几件重要的事。
    q
    变量是我发送到Gremlin服务器以返回一些数据的查询,它如下所示:

    q='nodes=g.V().limit(15.toList();边=g.V(节点)。聚合('node').outE().as('edge').inV().where(在('node'))内。选择('edge').toList();[节点、边]”

    此查询本质上应该返回节点和边的列表。现在,我想回顾三个案例:

    tinkerpop-empty.properties(实际为空): 第一种情况是使用未更改的tinkerpop-empty.properties文件。记住,当我加载它时,我得到的输出是:

    [INFO]服务器gremlinexecutor-GraphTraversalSource现在通过GraphTraversalSource[tinkergraph[顶点:0边:0],标准]绑定到[g]

    这意味着tinkergraph中不应该有任何信息。我应该会收到一张空名单。但是,当我运行我的呼叫时,我得到以下信息:

    value: Array(2)
    0: Array(7)
    0: {id: 1, label: "person", type: "vertex"}
    1: {id: 2, label: "person", type: "vertex"}
    2: {id: 3, label: "software", type: "vertex"}
    3: {id: 47284629, label: "person", type: "vertex"}
    4: {id: 4, label: "person", type: "vertex"}
    5: {id: 5, label: "software", type: "vertex"}
    6: {id: 6, label: "person", type: "vertex"}
    length: 7
    __proto__: Array(0)
    1: Array(6)
    0: {id: 9, label: "created", inVLabel: "software", outVLabel: "person", inV: 3, …}
    1: {id: 7, label: "knows", inVLabel: "person", outVLabel: "person", inV: 2, …}
    2: {id: 8, label: "knows", inVLabel: "person", outVLabel: "person", inV: 4, …}
    3: {id: 10, label: "created", inVLabel: "software", outVLabel: "person", inV: 5, …}
    4: {id: 11, label: "created", inVLabel: "software", outVLabel: "person", inV: 3, …}
    5: {id: 12, label: "created", inVLabel: "software", outVLabel: "person", inV: 3, …}
    length: 6
    
    这是开发人员控制台中的输出(来自console.log(retrvData))。有各种各样的数据。看,节点的长度是7,边是6。听起来熟悉吗?为什么gremlin要加载这些数据?为什么要将其发送到我的ajax查询

    tinkergraph-empty.properties(修改为使用tinkerpop crew.json) 好吧,随便吧。让我们运行下一个
    properties
    文件。记住,我们现在使用的是
    tinkerpop crew.json
    ,graphFormat设置为graphson

    当然,我得到了与之前相同的错误,即
    java.lang.IllegalArgumentException:id为的顶点已经存在:1
    。我的服务器也会关闭:

    [ERROR] GremlinServer - Gremlin Server was unable to start and will now begin shutdown: Vertex with id already exists: 1
    [INFO] GremlinServer - Shutting down OpProcessor[]
    [INFO] GremlinServer - Shutting down OpProcessor[session]
    [INFO] GremlinServer - Shutting down OpProcessor[traversal]
    [INFO] GremlinServer - Shutting down thread pools.
    [INFO] GremlinServer - Executing shutdown LifeCycleHook
    [INFO] GremlinServer - Closed Graph instance [graph]
    [INFO] GremlinServer - Gremlin Server - shutdown complete
    
    让我们转到我的AJAX查询,看看我们得到了什么

    当然没什么。我的小精灵服务器崩溃了。它似乎加载了正确的文件,因为信息日志显示,
    GraphTraversalSource现在通过GraphTraversalSource[tinkergraph[vertices:6 Edge:14],standard]
    绑定到[g]。我没有
    value: Array(2)
    0: Array(7)
    0: {id: 1, label: "person", type: "vertex"}
    1: {id: 2, label: "person", type: "vertex"}
    2: {id: 3, label: "software", type: "vertex"}
    3: {id: 47284629, label: "person", type: "vertex"}
    4: {id: 4, label: "person", type: "vertex"}
    5: {id: 5, label: "software", type: "vertex"}
    6: {id: 6, label: "person", type: "vertex"}
    length: 7
    __proto__: Array(0)
    1: Array(6)
    0: {id: 9, label: "created", inVLabel: "software", outVLabel: "person", inV: 3, …}
    1: {id: 7, label: "knows", inVLabel: "person", outVLabel: "person", inV: 2, …}
    2: {id: 8, label: "knows", inVLabel: "person", outVLabel: "person", inV: 4, …}
    3: {id: 10, label: "created", inVLabel: "software", outVLabel: "person", inV: 5, …}
    4: {id: 11, label: "created", inVLabel: "software", outVLabel: "person", inV: 3, …}
    5: {id: 12, label: "created", inVLabel: "software", outVLabel: "person", inV: 3, …}
    length: 6
    
    globals << [hook : [
      onStartUp: { ctx ->
        ctx.logger.info("Loading 'modern' graph data.")
          org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory.generateModern(graph)
      }
    ] as LifeCycleHook]