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的相關信息。