mgmt = graph.openManagement()
mgmt.makePropertyKey('name').dataType(String.class).cardinality(Cardinality.LIST).make()
mgmt.commit()
v = graph.addVertex()
p1 = v.property('name', 'Dan LaRocque')
p1.property('source', 'web')
p2 = v.property('name', 'dalaro')
p2.property('source', 'github')
graph.tx().commit()
v.properties('name')
==> Iterable over all name properties
单向边
占用少的存储空间
只可以从out-going方向遍历单向边,注意不是out-vertex。
使用位置:正常的边都是用在2个顶点上,但是单向边out是被用在边和属性上,in被用在顶点上。
当单向边的in-vertexs被删除时,单向边并不会被删除,
Note, that unidirected edges do not get automatically deleted when their in-vertices are deleted. The user must ensure that such inconsistencies do not arise or resolve them at query time by explicitly checking vertex existence in a transaction. See the discussion in Section 29.2.2, “Ghost Vertices” for more information.
mgmt = graph.openManagement()
mgmt.makeEdgeLabel('author').unidirected().make()
mgmt.commit()
user = graph.addVertex()
book = graph.addVertex()
author = graph.addVertex()
user.addE('knows', book).property('author', author)
在user到book的knows边上加了一个单向边author指向author节点,从而可以存储user的相关信息。