【发布时间】:2018-05-16 19:12:58
【问题描述】:
我正在尝试通过 HBase 将数据批量加载到 janusgraph 0.2 中。我正在使用 python 的 gremlinpython 库。对于批量加载,我将storage.batch-loading 设置为true,现在必须为图形定义架构。
我找到了为图表设置架构的文档 (https://docs.janusgraph.org/0.2.0/schema.html & https://docs.janusgraph.org/0.2.0/advanced-schema.html)。
它建议了一些基本的架构代码:
mgmt = graph.openManagement()
follow = mgmt.makeEdgeLabel('follow').multiplicity(MULTI).make()
mother = mgmt.makeEdgeLabel('mother').multiplicity(MANY2ONE).make()
mgmt.commit()
我使用 python 的 gremlinpython 库连接到图形。这就是我正在做的:
from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
from gremlin_python.process.traversal import T
from gremlin_python.process.traversal import Order
from gremlin_python.process.traversal import Cardinality
from gremlin_python.process.traversal import Column
from gremlin_python.process.traversal import Direction
from gremlin_python.process.traversal import Operator
from gremlin_python.process.traversal import P
from gremlin_python.process.traversal import Pop
from gremlin_python.process.traversal import Scope
from gremlin_python.process.traversal import Barrier
from config import graph_url, graph_name
graph = Graph()
drc = DriverRemoteConnection(graph_url, graph_name)
g = graph.traversal().withRemote(drc)
# I successfully get g here, I check it by :
# g.V().count().next()
现在我的问题是,我应该在哪里设置架构。我尝试在注释掉的行之后执行mgmt = graph.openManagement(),但它不起作用。
更新
它在 gremlin 控制台上工作为:
gremlin> :remote connect tinkerpop.server conf/remote.yaml
==>Configured localhost/127.0.0.1:8182
gremlin>
gremlin> :> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@625dfab4
但是任何进一步的命令在这里都不起作用:
:> follow = mgmt.makeEdgeLabel('follow').multiplicity(MULTI).make()
No such property: mgmt for class: Script10
【问题讨论】:
标签: python gremlin bulk-load janusgraph gremlin-server