连接到OrientDB与小鬼的JavaScript司机

问题描述 投票:1回答:3

我苦苦寻找使用当前小鬼JavaScript的驱动程序OrientDB一个例子。我无法得到它连接到OrientDB(已使用TinkerPop有关功能的版本)。

我的示例代码如下所示:

const gremlin = require("gremlin")
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection

const graph = new gremlin.structure.Graph()
const g = graph.traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/demodb'))

g.V().toList().then(function(data) {
   console.log(data)
}).catch(function(err) {
   console.log(err)
})

是否有人有使用这些共同的经验吗?谢谢

orientdb gremlin tinkerpop tinkerpop3
3个回答
1
投票

如果你想连接OrientDB槽小鬼试试这个:

Local -> gremlin> g = new OrientGraph("plocal:db_path/nomeDB")

In-Memory -> gremlin> g = new OrientGraph("memory:nomeDB")

Remote -> gremlin> g = new OrientGraph("remote:localhost/nomeDB")

希望能帮助到你

问候


0
投票

我挖一点点。小鬼的Javascript驱动程序不支持GraphSON3

https://github.com/jbmusso/gremlin-javascript/issues/109

添加到您的server.yaml串行配置,以增加对V2支持

- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.orientdb.io.OrientIoRegistry] }}  

那么它应该工作


0
投票

尝试这个:

import * as gremlin from 'gremlin';
const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;

const authenticator = new gremlin.driver.auth.PlainTextSaslAuthenticator(<db username>, <db password>);
const traversal = gremlin.process.AnonymousTraversalSource.traversal;

const g = traversal().withRemote(new DriverRemoteConnection('ws://localhost:8182/gremlin', {
      authenticator: authenticator
    }));

请注意在URL中/gremlin,不/demodb。指向demodb或其他数据库修改从OrientDB的demodb.properties文件夹中的文件config

如果你愿意,你可以创建另一个属性文件,只记得指向它在gremlin-server.yaml文件。

© www.soinside.com 2019 - 2024. All rights reserved.