public interface Node extends Entity<Long>
| 限定符和类型 | 方法和说明 |
|---|---|
Relationship |
createRelationshipTo(Node otherNode,
RelationshipType type)
在该点和另一点间创建边,该边类型属于
type,
以该点为起始点,以otherNode为终止点。 |
void |
delete()
删除该点
注意如果该点没有与之关联的边,则删除该点。
|
int |
getDegree()
不考虑方向和类型,返回与该点连接的所有边数量。
|
int |
getDegree(Direction direction)
给定
direction,返回与该点相连并满足该方向的边数量。 |
int |
getDegree(RelationshipType type)
给定
type,返回该点上满足该类型的边数量。 |
int |
getDegree(RelationshipType type,
Direction direction)
给定
type和direction,返回与该点相连并满足该类型和方向的边数量。 |
Long |
getId()
返回该点的唯一 id,id 值类型为 Long 类型
|
String |
getNodeType()
返回该点的类型
|
String |
getPkName(String typeName)
获取点的主键名
|
String |
getPkValue()
返回该点的主键值
|
Iterable<Relationship> |
getRelationships()
返回该点上的所有边。
|
Iterable<Relationship> |
getRelationships(Direction dir)
|
Iterable<Relationship> |
getRelationships(Direction direction,
RelationshipType... types)
返回该点上
types中任何类型且边方向为direction的边。 |
Iterable<Relationship> |
getRelationships(RelationshipType... types)
返回该点上
types中类型的任意方向的边。 |
Iterable<Relationship> |
getRelationships(RelationshipType type,
Direction dir)
返回点上对应给定类型和方向的边,如果找不到匹配边,返回空迭代。
|
Iterable<RelationshipType> |
getRelationshipTypes()
如点含多于1条的边,返回这些边的类型;如该点不含与之关联的边,返回空迭代。
|
Relationship |
getSingleRelationship(RelationshipType type,
Direction dir)
返回该点上符合给定类型和方向的唯一边,或者返回
null。 |
boolean |
hasRelationship()
如果该点上有任何与之关联的边,返回
true,反之则返回false。 |
boolean |
hasRelationship(Direction dir)
|
boolean |
hasRelationship(Direction direction,
RelationshipType... types)
在确定方向的情况下,如果该点上含任一
types中的类型且方向为direction的边,
返回true,否则返回true。 |
boolean |
hasRelationship(RelationshipType... types)
不考虑方向,如果该点上含
types中任一类的边(不考虑方向),返回true,
否则返回false。 |
boolean |
hasRelationship(RelationshipType type,
Direction dir)
如果点上含任何对应给定类型和方向的边,返回
true,否则返回false。 |
boolean |
isType(NodeType type)
检查该点是否带有给定标签。
|
getAllProperties, getProperties, getProperty, getProperty, getPropertyKeys, hasProperty, removeProperty, setPropertyvoid delete()
delete(),将抛出异常。Iterable<Relationship> getRelationships()
boolean hasRelationship()
true,反之则返回false。Iterable<Relationship> getRelationships(RelationshipType... types)
types中类型的任意方向的边。如果该点上没有给定类型的边,返回空迭代。types - 边类型的数组Iterable<Relationship> getRelationships(Direction direction, RelationshipType... types)
types中任何类型且边方向为direction的边。
如果该点上没有符合条件的边,返回空迭代。types - 边类型的数组direction - 边的方向boolean hasRelationship(RelationshipType... types)
types中任一类的边(不考虑方向),返回true,
否则返回false。types - 边类型的数组boolean hasRelationship(Direction direction, RelationshipType... types)
types中的类型且方向为direction的边,
返回true,否则返回true。types - 边类型的数组direction - 边的方向Iterable<Relationship> getRelationships(Direction dir)
dir - 边的方向boolean hasRelationship(Direction dir)
dir - 边的方向Iterable<Relationship> getRelationships(RelationshipType type, Direction dir)
type - 边的类型dir - 边的方向boolean hasRelationship(RelationshipType type, Direction dir)
true,否则返回false。type - 边的额类型dir - 边的方向Relationship getSingleRelationship(RelationshipType type, Direction dir)
null。
通常情况下,一个点和另一个点之间含0或1条边类型和方向满足给定条件的边时,会使用上述便捷措施。
这种不变式通常由余下代码维护:如果任何时间点上存在1条以上边,该错误会导致未检查异常抛出。
该方法是对语义的反映,如果指定类型和方向的边数量为0或恰好为1时,返回null,在其他情况下,抛出异常。
该方法只在上述不变量情况下使用。那些情况并不需要进行“状态检查”(如hasSingleRelationship(...)),
因为这种方法“开箱即用”,并能正确运行。type - 边的类型dir - 边的方向Relationship createRelationshipTo(Node otherNode, RelationshipType type)
type,
以该点为起始点,以otherNode为终止点。
两个方向上的遍历是等效的,所以就遍历和性能而言,没有必要再创建相反方向的边。otherNode - 新边的终止点type - 新边的类型Iterable<RelationshipType> getRelationshipTypes()
int getDegree()
int getDegree(RelationshipType type)
type,返回该点上满足该类型的边数量。type - 边的类型int getDegree(Direction direction)
direction,返回与该点相连并满足该方向的边数量。direction - 边的方向int getDegree(RelationshipType type, Direction direction)
type和direction,返回与该点相连并满足该类型和方向的边数量。type - 边的类型direction - 边的方向boolean isType(NodeType type)
type - 点的类型true 点是该类型的点,否则 false.String getNodeType()
String getPkValue()