public interface Graph extends AutoCloseable
Modifier and Type | Method and Description |
---|---|
default GraphTransaction |
beginTransaction()
开始一个新的事务。
|
GraphTransaction |
beginTransaction(com.graphdbapi.driver.Isolation isolation)
开始一个新的事务(可指定隔离级别)。
|
default QueryResult |
bfsMaster(BfsParam bfsParam)
多度查询邻居。通过起始点id查询。
|
QueryResult |
bfsMaster(long startId,
int depth,
int limitNeighbor,
int limitEdge,
List<Direction> dirList,
List<VisitCondition> vertexConditionList,
List<VisitCondition> edgeConditionList,
List<Set<String>> edgeTypeFilterList,
boolean hop,
boolean onlyCount,
boolean returnVertex,
boolean returnEdge)
多度查询邻居。通过起始点id查询。
|
QueryResult |
bfsMasterByPk(String pk,
String type,
int depth,
int limitNeighbor,
int limitEdge,
List<Direction> dirList,
List<VisitCondition> vertexConditionList,
List<VisitCondition> edgeConditionList,
List<Set<String>> edgeTypeFilterList,
boolean hop,
boolean onlyCount,
boolean returnVertex,
boolean returnEdge)
多度查询邻居。通过起始点pk查询
|
Set<Long> |
bfsWithResultType(long startId,
int depth,
int limitNeighbor,
int limitEdge,
List<Direction> dirList,
List<VisitCondition> vertexConditionList,
List<VisitCondition> edgeConditionList,
List<Set<String>> edgeTypeFilterList,
Set<String> resultTypeSet)
Deprecated.
|
void |
clearGraph()
删除图数据。保留图schema,删除数据。
|
void |
close()
Deprecated.
|
void |
deleteEdge(String edgeId)
删除边。通过边id删除边。
|
void |
deleteEdgeByVertexId(long fromId,
long toId,
int edgeLimit)
Deprecated.
|
default void |
deleteEdgeByVertexId(long fromId,
long toId,
Set<String> edgeTypes)
删除边。通过起始点id和终止点id,删除两点之间的边。
|
void |
deleteEdgeByVertexIdCondition(long fromId,
long toId,
Set<String> edgeTypes,
VisitCondition edgeCondition)
删除边。通过起始点id和终止点id,条件删除两点之间的边。
|
default void |
deleteEdgeByVertexPk(String fromPk,
String fromType,
String toPk,
String toType,
Set<String> edgeTypes)
删除边。通过起始点pk和终止点pk,删除两点之间的边。
|
void |
deleteEdgeByVertexPkCondition(String fromPk,
String fromType,
String toPk,
String toType,
Set<String> edgeTypes,
VisitCondition edgeCondition)
删除边。通过起始点pk和终止点pk,条件删除两点之间的边。
|
List<String> |
deleteEdges(List<String> list)
批量删除边。通过边id删除边。如果不存在或删除失败,则会返回异常结果集。
结果按传入顺序构成集合,集合中包含成功信息和错误信息。
|
void |
deleteGraph()
删除图。删除图的schema和所有数据。
|
void |
deleteVertex(long id)
删除点。通过点id删除点。
|
void |
deleteVertexByPk(String pk,
String type)
删除点。通过点pk和type删除点。
|
List<String> |
deleteVertexes(List<Long> list)
批量删除点。通过点id删除点。如果点不存在或删除失败,则会返回异常结果集。
结果按传入顺序构成集合,集合中包含成功信息和错误信息。
|
List<String> |
deleteVertexesByPk(List<VertexInfoByPk> list)
批量删除点。通过点pk和type删除点。如果不存在或删除失败,则会返回异常结果集。
结果按传入顺序构成集合,集合中包含成功信息和错误信息。
|
void |
editGraphName(String newGraphName)
修改图的名称。会关闭当前链接。其他客户端的连接会在下一次请求数据的时候提示图不存在。
|
StatementResult |
executeCypher(String cypher,
Map<String,com.graphdbapi.driver.v1.Value> parameters)
执行cypher查询。
|
long |
executeCypherTaskAsyncForStatementResult(String cypher)
Deprecated.
|
long |
executeCypherTaskAsyncForStatementResult(String cypher,
Map<String,com.graphdbapi.driver.v1.Value> parameters)
Deprecated.
|
StatementResult |
executeProcedure(String procedureName,
Object... inputParams)
通过bolt执行procedure方法
|
StatementResult |
executeQuery(String cypher)
执行cypher查询。默认超时时间7200秒(包括查询结果迭代时间),如果查询需要长时间执行或结果集过大,建议使用包含timeout的重载方法指定合适的超时时间。
|
StatementResult |
executeQuery(String cypher,
int defLimit)
执行cypher查询。
|
StatementResult |
executeQuery(String cypher,
long timeout)
执行cypher查询。
|
StatementResult |
executeQuery(String cypher,
long timeout,
int defLimit)
执行cypher查询。
|
long |
getAllEdgeCount()
查询边个数。查询图中边总数。
|
long |
getAllVertexCount()
查询点个数。查询图中点总数。
|
Map<Long,CypherQuery> |
getCypherMetrics()
获取正在执行的cypher语句的执行信息。
|
CypherTaskStatus |
getCypherTaskAsyncForStatementResultStatus(long cypherTaskId)
Deprecated.
|
long |
getCypherTaskId()
获取一个 cypher 任务 id
|
StatementResult |
getCypherTaskStatementResult(long cypherTaskId)
Deprecated.
|
default EdgeDegreeInfo |
getDegree(long id)
查询点的degree信息。
|
EdgeDegreeInfo |
getDegree(long id,
Set<String> edgeTypeFilter,
Direction direction,
VisitCondition vertexCondition,
VisitCondition edgeCondition,
boolean includeLoop)
查询点的degree信息。
|
long |
getEdgeCount(String type)
查询边个数。查询当前类型边总数。
|
long |
getVertexCount(String type)
查询点个数。查询当前类型点总数。
|
Set<Long> |
getVertexIdByPk(String pk)
查询点id。通过点pk查询点id。该方法不限定点类型,将从所有点类型中查询是否有pk存在,并返回点id集合。
|
Long |
getVertexIdByPk(String pk,
String type)
查询点id。通过点pk和type获取点id。在一个点类型下,点pk和点id是一一对应的。
|
int |
index()
获取图index。
|
default void |
insertBatchEdgeByVertexPk(List<EdgeInfoByVertexPk> list)
批量新增边。通过起止点类型和pk、边类型来新增边,属性可选。
|
void |
insertBatchEdgeByVertexPk(List<EdgeInfoByVertexPk> list,
boolean createVertexIfAbsent)
批量新增边,点不存在创建点。通过起止点类型和pk、边类型来新增边,属性可选。
|
void |
insertBatchEdgeByVertexPk(String typeName,
String fromType,
String toType,
List<String> propertyList,
List<List<Object>> propertyValues,
boolean createVertexIfAbsent)
批量新增边,点不存在创建点。通过起止点类型和pk、边类型来新增边,属性可选。
|
Iterator<Edge> |
insertBatchEdgeByVertexPkWithResult(List<EdgeInfoByVertexPk> list,
boolean createVertexIfAbsent)
批量新增边,点不存在创建点。并获取返回值。通过起止点类型和pk、边类型来新增边,属性可选。
由于无法重载
insertBatchEdgeByVertexPk(java.util.List<com.graphdbapi.driver.v1.graph.EdgeInfoByVertexPk>) 方法的返回值,只能额外新建一个方法提供支持 |
default Edge |
insertEdgeByVertexId(long fromId,
long toId,
String type)
新增边。通过起始点id和终止点id新增一条无属性边。
|
Edge |
insertEdgeByVertexId(long fromId,
long toId,
String type,
Map<String,Object> property)
新增边。通过起始点id和终止点id新增一条边,属性为可选项。
|
Edge |
insertEdgeByVertexPk(String fromPk,
String fromType,
boolean createFrom,
String toPk,
String toType,
boolean createTo,
String type,
Map<String,Object> property)
新增边。通过起始点pk和终止点pk新增边。
找不到起始点和终止点时会通过createFrom和createTo决定是否新增无属性的起始点和终止点。
|
default Edge |
insertEdgeByVertexPk(String fromPk,
String fromType,
String toPk,
String toType,
String type)
新增边。通过起始点pk和终止点pk新增边。
|
default Edge |
insertEdgeByVertexPk(String fromPk,
String fromType,
String toPk,
String toType,
String type,
Map<String,Object> property)
新增边。通过起始点pk和终止点pk新增边。
|
List<ResponseItem<Edge>> |
insertEdgesByVertexId(List<EdgeInfoByVertexId> list)
批量新增边。通过起始点id和终止点id新增边。
该方法与
insertEdgesByVertexPk(List) 不同的是,该方法list中每项是通过点id进行新增。
如果想通过pk新增边,请调用insertEdgesByVertexPk(List)
结果按传入顺序构成集合,集合中包含新增后的边信息和错误信息。通过ResponseItem.isError() 方法判断操作是否失败。 |
List<ResponseItem<Edge>> |
insertEdgesByVertexPk(List<EdgeInfoByVertexPk> list)
批量新增边。通过起始点pk和终止点pk来新增边。
找不到起始点和终止点时会通过createFrom和createTo来决定是否新增无属性的起始点和终止点。
该方法与
insertEdgesByVertexId(List) (List)} 不同的是,该方法list中每项是通过pk进行新增。
如果想通过点id新增边,请调用insertEdgesByVertexId(List)
结果按传入顺序构成集合,集合中包含新增后的边信息和错误信息。通过ResponseItem.isError() 方法判断操作是否失败。 |
default Vertex |
insertVertexByPk(String pk,
String type)
新增点。通过点pk和type新增一个的无属性点。
|
Vertex |
insertVertexByPk(String pk,
String type,
Map<String,Object> property)
新增点。通过点pk和type新增一个点,属性为可选项。
|
List<ResponseItem<Vertex>> |
insertVertexesByPk(List<VertexInfoByPk> list)
批量新增点。通过点pk和type新增点,属性为可选项。
结果按传入顺序构成集合,集合中包含新增后的点信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
boolean |
isEnable()
验证驱动对象实例是否存活且可用。
|
String |
name()
获取图名称。
|
default void |
putPropertyValue(boolean isVertex,
Object id,
String propertyName,
Object value)
更新属性。更新某个点或边的某属性值。(集合属性会自动追加)
|
void |
putPropertyValue(boolean isVertex,
Object id,
String propertyName,
Object value,
boolean isMerge)
更新属性。更新某个点或边的某属性值。
|
void |
removePropertyValue(boolean isVertex,
Object id,
String propertyName)
删除属性。
|
Iterator<Edge> |
retrieveAllEdges()
查询所有边。迭代获取所有类型的所有边。
|
Iterator<Vertex> |
retrieveAllVertexes()
查询所有点。迭代获取数据库中的所有点信息。
|
Edge |
retrieveEdge(String edgeId)
查询边。通过边id查询边。不存在返回null
|
default Iterator<Edge> |
retrieveEdgeByVertexId(long id)
查询邻居。通过起始点id查询。
|
default Iterator<Edge> |
retrieveEdgeByVertexId(long vertexId,
long anotherId,
Set<String> edgeTypeFilter,
Direction direction,
VisitCondition edgeCondition)
查询边。通过指定的两点id和方向查询。
|
Iterator<Edge> |
retrieveEdgeByVertexId(long vertexId,
long anotherId,
Set<String> edgeTypeFilter,
Direction direction,
VisitCondition edgeCondition,
boolean getLoop)
Deprecated.
|
Iterator<Edge> |
retrieveEdgeByVertexId(long id,
Set<String> edgeTypeFilter,
Direction direction,
int limitEdge,
VisitCondition vertexCondition,
VisitCondition edgeCondition,
boolean getLoop)
查询邻居。通过起始点id查询。
|
default Iterator<Edge> |
retrieveEdgeByVertexId(long id,
Set<String> edgeTypeFilter,
Direction direction,
VisitCondition vertexCondition,
VisitCondition edgeCondition,
boolean getLoop)
查询邻居。通过起始点id查询。
|
default Iterator<Edge> |
retrieveEdgeByVertexPk(String pk,
String type)
查询邻居。通过起始点pk和type查询。
|
Iterator<Edge> |
retrieveEdgeByVertexPk(String pk,
String type,
Set<String> edgeTypeFilter,
Direction direction,
int limitEdge,
VisitCondition vertexCondition,
VisitCondition edgeCondition,
boolean getLoop)
查询邻居。通过点pk和type查询。
|
default Iterator<Edge> |
retrieveEdgeByVertexPk(String pk,
String type,
Set<String> edgeTypeFilter,
Direction direction,
VisitCondition vertexCondition,
VisitCondition edgeCondition,
boolean getLoop)
查询邻居。通过起始点pk和type查询。
|
Iterator<Edge> |
retrieveEdgeByVertexPk(String vertexPk,
String vertexType,
String anotherPk,
String anotherType,
Set<String> edgeTypeFilter,
Direction direction,
int limitEdge,
VisitCondition edgeCondition)
查询边。通过两点pk和方向、类型等查询。
|
List<ResponseItem<Edge>> |
retrieveEdges(List<String> list)
批量查询边。通过边id查询边。不存在返回空集合
结果按传入顺序构成集合,集合中包含查询的边信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
Iterator<Edge> |
retrieveEdgesByType(String type)
查询边类型下所有边。迭代获取某个类型的所有边信息。
|
Iterator<Edge> |
retrieveOrInsertEdgeByVertexId(long fromId,
long toId,
String type,
Map<String,Object> property)
查询或新增边。通过起始点、终止点id和边类型查询或新增边。若两点之间此边类型的边存在,则查询并返回两点之间此类型所有边的迭代器。
若不存在点,抛出异常;若存在点不存在边,则新增一条边并返回。
|
Iterator<Edge> |
retrieveOrInsertEdgeByVertexPk(String fromPk,
String fromType,
boolean createFrom,
String toPk,
String toType,
boolean createTo,
String type,
Map<String,Object> property)
查询或新增边。通过起始点pk和终止点pk查询或新增边。若两点之间此边类型的边存在,则查询并返回两点之间此类型所有边的迭代器。
若不存在点,抛出异常;若存在点不存在边,则新增一条边并返回。
|
List<ResponseItem<List<Edge>>> |
retrieveOrInsertEdgesByVertexId(List<EdgeInfoByVertexId> list)
批量查询或新增边。通过起始点id和终止点id查询或新增边。若存在,仅查询并返回所有边信息,属性值不做修改。若不存在,则新增一条边并返回边信息。
结果按传入顺序构成集合,集合中包含查询或新增后的边信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
List<ResponseItem<List<Edge>>> |
retrieveOrInsertEdgesByVertexPk(List<EdgeInfoByVertexPk> list)
批量查询或新增边。通过起始点pk和终止点pk查询或新增边。若存在,仅查询并返回所有边信息,属性值不做修改。若不存在,则新增一条边并返回边信息。
结果按传入顺序构成集合,集合中包含查询或新增后的边信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
Vertex |
retrieveOrInsertVertexByPk(String pk,
String type,
Map<String,Object> property)
查询或新增点。通过点pk和type查询或新增点。若点已经存在,仅查询并返回点信息,属性值不做修改。若点不存在,新增并返回点信息。
|
List<ResponseItem<Vertex>> |
retrieveOrInsertVertexesByPk(List<VertexInfoByPk> list)
批量查询或新增点。通过点pk和type查询或新增点。若点已经存在,仅查询并返回点信息,属性值不做修改。若点不存在,新增并返回点信息。
结果按传入顺序构成集合,集合中包含查询或新增后的点信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
Vertex |
retrieveVertex(long id)
查询点。通过点id查询点信息。不存在返回null
|
Vertex |
retrieveVertexByPk(String pk,
String type)
查询点。通过点pk和type查询点。在一个确定的点类型下,通过pk仅能查询到一个点。不存在返回null
|
List<ResponseItem<Vertex>> |
retrieveVertexes(List<Long> list)
批量查询点。通过点id查询点信息。不存在返回空集合
结果按传入顺序构成集合,集合中包含查询的点信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
List<ResponseItem<Vertex>> |
retrieveVertexesByPk(List<VertexInfoByPk> list)
批量查询点。通过点pk和type查询点信息。不存在返回空集合
结果按传入顺序构成集合,集合中包含查询的点信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
Iterator<Vertex> |
retrieveVertexesByType(String type)
查询点类型下的所有点。迭代获取某个点类型的所有点信息。
|
GraphSchema |
schema()
获取图schema相关的操作类。
|
Iterator<Edge> |
searchEdgeProperty(String type,
List<SearchPredicate> predicates,
List<SearchOrder> orders,
int skip,
int limit)
通过类型、属性查询边
|
Iterator<String> |
searchEdgesByIndex(String typeName,
String propName,
Object data,
int skip,
int limit)
通过索引,查找边数据,返回边Id
|
Iterator<Long> |
searchVertexesByIndex(String typeName,
String propName,
Object data,
int skip,
int limit)
通过索引,查找点数据,返回点Id
|
Iterator<Vertex> |
searchVertexProperty(String type,
List<SearchPredicate> predicates,
List<SearchOrder> orders,
int skip,
int limit)
通过类型、属性查询点
|
Iterator<Edge> |
shortestPath(long startId,
long endId,
Set<String> pathEdgeType)
查询最短路径。返回一条最短路径的所有边。
|
Iterator<Edge> |
shortestPath(long startId,
long endId,
Set<String> pathEdgeType,
int limit)
查询最短路径。返回一条最短路径的所有边。
|
void |
stopCypher(long taskId)
停止集群中指定taskId的cypher语句。taskId可以通过
getCypherMetrics() 获取。
也可以用于停止 executeCypherTaskAsyncForStatementResult(String cypher) 提交的任务。 |
default Edge |
updateEdge(String edgeId,
Map<String,Object> property)
更新边。通过边id更新边。(集合属性会自动追加)
|
Edge |
updateEdge(String edgeId,
Map<String,Object> property,
boolean isMerge)
更新边。通过边id更新边。
|
default Iterator<Edge> |
updateEdgeByVertexId(long fromId,
long toId,
String type,
Map<String,Object> property)
更新边。通过起始点id和终止点id来修改边。
如果起始点到终止点不存在边报错。(集合属性会自动追加)
|
default Iterator<Edge> |
updateEdgeByVertexId(long fromId,
long toId,
String type,
Map<String,Object> property,
boolean isMerge)
更新边。通过起始点id和终止点id来修改边。
|
Iterator<Edge> |
updateEdgeByVertexIdCondition(long fromId,
long toId,
String type,
VisitCondition edgeCondition,
Map<String,Object> property,
boolean isMerge)
更新边。通过起始点id和终止点id来修改边。
|
default Iterator<Edge> |
updateEdgeByVertexPk(String fromPk,
String fromType,
String toPk,
String toType,
String type,
Map<String,Object> property)
更新边。通过起始点pk和终止点pk修改边。(集合属性会自动追加)
找不到起始点和终止点时报错。
如果起始点到终止点不存在边报错。
|
default Iterator<Edge> |
updateEdgeByVertexPk(String fromPk,
String fromType,
String toPk,
String toType,
String type,
Map<String,Object> property,
boolean isMerge)
更新边。通过起始点pk和终止点pk修改边。
找不到起始点和终止点时报错。
|
Iterator<Edge> |
updateEdgeByVertexPkCondition(String fromPk,
String fromType,
String toPk,
String toType,
String type,
VisitCondition edgeCondition,
Map<String,Object> property,
boolean isMerge)
更新边。通过起始点pk和终止点pk修改边。
找不到起始点和终止点时报错。
|
List<ResponseItem<Edge>> |
updateEdges(List<EdgeInfo> list)
批量更新边。通过边id更新边。
结果按传入顺序构成集合,集合中包含更新后的边信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
List<ResponseItem<List<Edge>>> |
updateEdgesByVertexId(List<EdgeInfoByVertexId> list)
批量更新边。通过起始点id和终止点id修改边。
如果起始点到终止点不存在边报错。
结果按传入顺序构成集合,集合中包含更新后的边信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
List<ResponseItem<List<Edge>>> |
updateEdgesByVertexPk(List<EdgeInfoByVertexPk> list)
批量更新边。通过起始点pk和终止点pk修改边。
找不到起始点和终止点时报错。
如果起始点到终止点不存在边报错。
结果按传入顺序构成集合,集合中包含更新后的边信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
default Vertex |
updateVertex(long id,
Map<String,Object> property)
更新点。通过点id更新点属性。(集合属性会自动追加)
|
Vertex |
updateVertex(long id,
Map<String,Object> property,
boolean isMerge)
更新点。通过点id更新点属性。
|
default Vertex |
updateVertexByPk(String pk,
String type,
Map<String,Object> property)
更新点。通过点pk和type更新点。如果已存在,则会比较属性值。(集合属性会自动追加)
|
Vertex |
updateVertexByPk(String pk,
String type,
Map<String,Object> property,
boolean isMerge)
更新点。通过点pk和type更新点。如果已存在,则会比较属性值。
|
List<ResponseItem<Vertex>> |
updateVertexes(List<VertexInfoById> list)
批量更新点。通过点id更新点。如果已存在,则会比较属性值。
结果按传入顺序构成集合,集合中包含更新后的点信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
List<ResponseItem<Vertex>> |
updateVertexesByPk(List<VertexInfoByPk> list)
批量更新点。通过点pk和type更新点。如果已存在,则会比较属性值。
结果按传入顺序构成集合,集合中包含更新后的点信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
void |
upsertBatchVertexByPk(List<VertexInfoByPk> list)
批量新增和更新点。通过点pk和type新增点,属性为可选项。
|
void |
upsertBatchVertexByPk(String typeName,
List<String> propertyList,
List<List<Object>> propertyValues)
批量新增和更新点。通过点pk和type新增点,属性为可选项。
|
Iterator<Vertex> |
upsertBatchVertexByPkWithResult(List<VertexInfoByPk> list)
批量新增和更新点并获取返回值。通过点pk和type新增点,属性为可选项。
由于无法重载
upsertBatchVertexByPk(java.util.List<com.graphdbapi.driver.v1.graph.VertexInfoByPk>) 方法的返回值,只能额外新建一个方法提供支持 |
default Iterator<Edge> |
upsertEdgeByVertexId(long fromId,
long toId,
String type,
Map<String,Object> property)
新增或更新边。通过起始点id和终止点id来新增或修改边。
如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。(集合属性会自动追加)
|
Iterator<Edge> |
upsertEdgeByVertexId(long fromId,
long toId,
String type,
Map<String,Object> property,
boolean isMerge)
新增或更新边。通过起始点id和终止点id来新增或修改边。
如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。
|
default Iterator<Edge> |
upsertEdgeByVertexPk(String fromPk,
String fromType,
boolean createFrom,
String toPk,
String toType,
boolean createTo,
String type,
Map<String,Object> property)
新增或更新边。通过起始点pk和终止点pk来新增或修改边。
找不到起始点和终止点时会通过createFrom和createTo来决定是否新增无属性的起始点和终止点。
如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。(集合属性会自动追加)
|
Iterator<Edge> |
upsertEdgeByVertexPk(String fromPk,
String fromType,
boolean createFrom,
String toPk,
String toType,
boolean createTo,
String type,
Map<String,Object> property,
boolean isMerge)
新增或更新边。通过起始点pk和终止点pk来新增或修改边。
找不到起始点和终止点时会通过createFrom和createTo来决定是否新增无属性的起始点和终止点。
如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。
|
List<ResponseItem<List<Edge>>> |
upsertEdgesByVertexId(List<EdgeInfoByVertexId> list)
批量新增或更新边。通过起始点id和终止点id新增或修改边。
如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。
结果按传入顺序构成集合,集合中包含新增或更新后的边信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
List<ResponseItem<List<Edge>>> |
upsertEdgesByVertexPk(List<EdgeInfoByVertexPk> list)
批量新增或更新边。通过起始点pk和终止点pk新增或修改边。
找不到起始点和终止点时会通过createFrom和createTo决定是否新增无属性的起始点和终止点。
如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。
结果按传入顺序构成集合,集合中包含新增或更新后的边信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
default Vertex |
upsertVertexByPk(String pk,
String type,
Map<String,Object> property)
新增或更新点。通过点pk和type新增或更新点。如果已存在,则会比较属性值。(集合属性会自动追加)
|
Vertex |
upsertVertexByPk(String pk,
String type,
Map<String,Object> property,
boolean isMerge)
新增或更新点。通过点pk和type新增或更新点。如果已存在,则会比较属性值。
|
List<ResponseItem<Vertex>> |
upsertVertexesByPk(List<VertexInfoByPk> list)
批量新增或更新点。通过点pk和type新增或更新点。如果已存在,则会比较属性值。
结果按传入顺序构成集合,集合中包含新增或更新后的点信息和错误信息。通过
ResponseItem.isError() 方法判断操作是否失败。 |
default GraphTransaction beginTransaction()
try(GraphTransaction tx = graph.beginTransaction()) {
tx.insertVertexByPk("id_0001", "person");
tx.success();
}
GraphTransaction beginTransaction(com.graphdbapi.driver.Isolation isolation)
角色: RoleType.READER
isolation
- 隔离级别GraphTransaction
default QueryResult bfsMaster(BfsParam bfsParam)
bfsParam
- bfsMaster参数对象QueryResult
bfs查询结果。QueryResult bfsMaster(long startId, int depth, int limitNeighbor, int limitEdge, List<Direction> dirList, List<VisitCondition> vertexConditionList, List<VisitCondition> edgeConditionList, List<Set<String>> edgeTypeFilterList, boolean hop, boolean onlyCount, boolean returnVertex, boolean returnEdge)
startId
- 起始点id,不能小于0。depth
- 深度,范围必须为(0-10)。limitNeighbor
- 邻居点上限,填小于0 不参与计算。limitEdge
- 邻居边上限,填小于0 不参与计算。dirList
- 方向集合,需要size = 1 或者 size = depth,不可为null;vertexConditionList
- 点查询条件集合,需要size = 1 或者 size = depth;填null不参与计算;edgeConditionList
- 边查询条件集合,需要size = 1 或者 size = depth;填null不参与计算;edgeTypeFilterList
- 边类型过滤集合,需要size = 1 或者 size = depth;填null不参与计算 以上三个 List 都是和 depth 对应的,如果 size =
1,那么这个过滤条件会被复制,每一度都是这个过滤条件, 如果你只想给某一度添加过滤条件,那么应该在 list 的其他位置 add(null)。hop
- 是否 启用hop模式。(只返回最外层的点。)onlyCount
- 是否只返回 count。true表示返回count。returnVertex
- 是否返回结果点集。只有onlyCount为false时生效。returnEdge
- 是否返回结果边集。只有onlyCount为false时生效。QueryResult
bfs查询结果。ParamException
- 参数格式不正确,当点id小于0、深度不符合要求,方向集合、点/边条件集合或边类型过滤集合长度不符合要求时将抛出异常。VertexNotFoundException
- 起始点在图中不存在时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 点/边条件过滤对应的属性类型在指定点/边类型中不存在时将抛出异常。DatabaseException
- 数据库内部异常。QueryResult bfsMasterByPk(String pk, String type, int depth, int limitNeighbor, int limitEdge, List<Direction> dirList, List<VisitCondition> vertexConditionList, List<VisitCondition> edgeConditionList, List<Set<String>> edgeTypeFilterList, boolean hop, boolean onlyCount, boolean returnVertex, boolean returnEdge)
pk
- 起始点pk,不能为空。type
- 点类型,不能为空。depth
- 深度,范围必须为(0-10)。limitNeighbor
- 邻居点上限,填小于0 不参与计算。limitEdge
- 邻居边上限,填小于0 不参与计算。dirList
- 方向集合,需要size = 1 或者 size = depth,不可为null;vertexConditionList
- 点查询条件集合,需要size = 1 或者 size = depth;填null不参与计算;edgeConditionList
- 边查询条件集合,需要size = 1 或者 size = depth;填null不参与计算;edgeTypeFilterList
- 边类型过滤集合,需要size = 1 或者 size = depth;填null不参与计算 以上三个 List 都是和 depth 对应的,如果 size =
1,那么这个过滤条件会被复制,每一度都是这个过滤条件, 如果你只想给某一度添加过滤条件,那么应该在 list 的其他位置 add(null)。hop
- 是否 启用hop模式。(只返回最外层的点。)onlyCount
- 是否只返回 count。true表示返回count。returnVertex
- 是否返回结果点集。只有onlyCount为false时生效。returnEdge
- 是否返回结果边集。只有onlyCount为false时生效。QueryResult
bfs查询结果。ParamException
- 参数格式不正确,当点pk和type空、深度不符合要求,方向集合、点/边条件集合或边类型过滤集合长度不符合要求时将抛出异常。VertexNotFoundException
- 起始点在图中不存在时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 点/边条件过滤对应的属性类型在指定点/边类型中不存在时将抛出异常。DatabaseException
- 数据库内部异常。@Deprecated Set<Long> bfsWithResultType(long startId, int depth, int limitNeighbor, int limitEdge, List<Direction> dirList, List<VisitCondition> vertexConditionList, List<VisitCondition> edgeConditionList, List<Set<String>> edgeTypeFilterList, Set<String> resultTypeSet)
startId
- 起始点depth
- 深度limitNeighbor
- 邻居点上限, 填小于0 不参与计算limitEdge
- 邻居边上限,填小于0 不参与计算dirList
- 方向集合,需要size = 1 或者 size = depth,不可为nullvertexConditionList
- 点查询条件集合,需要size = 1 或者 size = depth;填null不参与计算edgeConditionList
- 边查询条件集合,需要size = 1 或者 size = depth;填null不参与计算edgeTypeFilterList
- 边类型过滤集合,需要size = 1 或者 size = depth;填null不参与计算 以上三个 List 都是和 depth 对应的,如果 size =
1,那么这个过滤条件会被复制,每一度都是这个过滤条件, 如果你只想给某一度添加过滤条件,那么应该在 list 的其他位置 add(null);resultTypeSet
- 最后的结果集中符合条件的点类型void clearGraph()
DatabaseException
- 数据库内部异常。@Deprecated void close() throws Exception
close
in interface AutoCloseable
DatabaseException
- 数据库内部异常,在关闭数据库连接失败时将抛出异常。Exception
void deleteEdge(String edgeId)
edgeId
- 边id,不能为空。ParamException
- 参数格式不正确,当边id格式不正确时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。@Deprecated void deleteEdgeByVertexId(long fromId, long toId, int edgeLimit)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。edgeLimit
- 删除边数,<=0代表全量,>0则删指定个数。ParamException
- 参数格式不正确,当起始点id和终止点id小于0时将抛出异常。DatabaseException
- 数据库内部异常。default void deleteEdgeByVertexId(long fromId, long toId, Set<String> edgeTypes)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。edgeTypes
- 需要删除的边类型,为null或空集合时所有类型全删。ParamException
- 参数格式不正确,当起始点id和终止点id小于0时将抛出异常。DatabaseException
- 数据库内部异常。TypeNotFoundException
- 边类型不存在VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。void deleteEdgeByVertexIdCondition(long fromId, long toId, Set<String> edgeTypes, VisitCondition edgeCondition)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。edgeTypes
- 需要删除的边类型,为null或空集合时所有类型全删。edgeCondition
- 边条件过滤,为null不参与计算。ParamException
- 参数格式不正确,当起始点id和终止点id小于0时将抛出异常。DatabaseException
- 数据库内部异常。TypeNotFoundException
- 边类型不存在VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。default void deleteEdgeByVertexPk(String fromPk, String fromType, String toPk, String toType, Set<String> edgeTypes)
fromPk
- 起始点pk,不能为null。fromType
- 起始点类型,不能为null。toPk
- 终止点pk,不能为null。toType
- 终止点类型,不能为null。edgeTypes
- 需要删除的边类型,为null或空集合时所有类型全删。ParamException
- 参数格式不正确,当点pk和type为null时将抛出异常。DatabaseException
- 数据库内部异常。TypeNotFoundException
- 边类型不存在时抛出异常。PkNotFoundException
- 当pk不存在时抛出异常。void deleteEdgeByVertexPkCondition(String fromPk, String fromType, String toPk, String toType, Set<String> edgeTypes, VisitCondition edgeCondition)
fromPk
- 起始点pk,不能为null。fromType
- 起始点类型,不能为null。toPk
- 终止点pk,不能为null。toType
- 终止点类型,不能为null。edgeTypes
- 需要删除的边类型,为null或空集合时所有类型全删。edgeCondition
- 边条件过滤,为null不参与计算。ParamException
- 参数格式不正确,当点pk和type为null时将抛出异常。DatabaseException
- 数据库内部异常。TypeNotFoundException
- 边类型不存在时抛出异常。PkNotFoundException
- 当pk不存在时抛出异常。List<String> deleteEdges(List<String> list)
list
- 边id集合,不能为空。List
批量操作结果集。边删除成功时返回null,边删除失败时返回错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、边id格式不正确时将抛出异常。DatabaseException
- 数据库内部异常。void deleteGraph()
DatabaseException
- 数据库内部异常。void deleteVertex(long id)
id
- 点id,不能小于0。ParamException
- 参数格式不正确,当点id小于0时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。void deleteVertexByPk(String pk, String type)
pk
- pk,不能为空。type
- 点类型,不能为空。ParamException
- 参数格式不正确,当pk或type为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。List<String> deleteVertexes(List<Long> list)
list
- 点id集合,不能为空。List
批量操作结果集。点删除成功时返回null,点删除失败时返回错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、id格式不正确时将抛出异常。DatabaseException
- 数据库内部异常。List<String> deleteVertexesByPk(List<VertexInfoByPk> list)
list
- 参数集合,不能为空。List
批量操作结果集。点删除成功时返回null,点删除失败时返回错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk和type不存在时将抛出异常。DatabaseException
- 数据库内部异常。void editGraphName(String newGraphName)
newGraphName
- 新的图名称ParamException
- 参数格式不正确,当图名称为空时将抛出异常。DatabaseException
- 数据库内部异常。StatementResult executeCypher(String cypher, Map<String,com.graphdbapi.driver.v1.Value> parameters)
cypher
- 查询语句,不能为空。parameters
- 查询可用的参数StatementResult
cypher执行结果迭代器。ParamException
- 参数格式不正确,当cypher为空时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。@Deprecated long executeCypherTaskAsyncForStatementResult(String cypher) throws Exception
cypher
- 查询语句,不能为空。String
异步cypher任务idParamException
- 参数格式不正确,当cypher为空时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。Exception
@Deprecated long executeCypherTaskAsyncForStatementResult(String cypher, Map<String,com.graphdbapi.driver.v1.Value> parameters) throws Exception
cypher
- 查询语句,不能为空。parameters
- 查询可用的参数String
异步cypher任务idParamException
- 参数格式不正确,当cypher为空时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。Exception
StatementResult executeProcedure(String procedureName, Object... inputParams)
procedureName
- procedure方法名。inputParams
- 入参(需按照procedure方法的参数顺序)。StatementResult
执行结果迭代器。StatementResult executeQuery(String cypher)
cypher
- 查询语句,不能为空。StatementResult
cypher执行结果迭代器。ParamException
- 参数格式不正确,当cypher为空时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。StatementResult executeQuery(String cypher, int defLimit)
cypher
- 查询语句,不能为空。defLimit
- 返回结果数限制,小于0表示不进行限制。StatementResult
cypher执行结果迭代器。ParamException
- 参数格式不正确,当cypher为空时将抛出异常。DatabaseException
- 数据库内部异常,当cypher语法错误时将抛出异常。StatementResult executeQuery(String cypher, long timeout)
cypher
- 查询语句,不能为空。timeout
- 超时时间,单位为秒。必须大于0。StatementResult
cypher执行结果迭代器。ParamException
- 参数格式不正确,当cypher为空、timeout小于等于0时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。StatementResult executeQuery(String cypher, long timeout, int defLimit)
cypher
- 查询语句,不能为空。timeout
- 超时时间,单位为秒,必须大于0。defLimit
- 返回结果数限制,小于0表示不进行限制。StatementResult
cypher执行结果迭代器。ParamException
- 参数格式不正确,当cypher为空、timeout小于等于0时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。long getAllEdgeCount()
DatabaseException
- 数据库内部异常。long getAllVertexCount()
DatabaseException
- 数据库内部异常。Map<Long,CypherQuery> getCypherMetrics()
Map
cypher语句执行信息。@Deprecated CypherTaskStatus getCypherTaskAsyncForStatementResultStatus(long cypherTaskId) throws Exception
cypherTaskId
- 异步cypher任务id,不能为空。CypherTaskStatus
任务状态。Exception
long getCypherTaskId()
@Deprecated StatementResult getCypherTaskStatementResult(long cypherTaskId) throws Exception
cypherTaskId
- 异步cypher任务id,不能为空。StatementResult
cypher执行结果迭代器。com.graphdbapi.driver.v1.exceptions.AsynTaskNotExist
- 任务不存在时抛出。com.graphdbapi.driver.v1.exceptions.AsynTaskNotCompleted
- 任务未完成时抛出。Exception
default EdgeDegreeInfo getDegree(long id)
id
- 点id,不能小于0。EdgeDegreeInfo
点的degree信息。ParamException
- 参数格式不正确,当点id小于0时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。EdgeDegreeInfo getDegree(long id, Set<String> edgeTypeFilter, Direction direction, VisitCondition vertexCondition, VisitCondition edgeCondition, boolean includeLoop)
id
- 点id,不能小于0。edgeTypeFilter
- 边类型的过滤条件。只会返回满足参数中边类型的边。填null不参与计算。建议类型过滤使用这个字段,而不是edgeConditiondirection
- 边方向,不能为null。vertexCondition
- 点条件,填null不参与计算edgeCondition
- 边条件,填null不参与计算includeLoop
- true计算自环,false不计算自环EdgeDegreeInfo
点的degree信息ParamException
- 参数格式不正确,当点id小于0、查询方向为null时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 点/边条件过滤对应的属性类型在指定点/边类型中不存在时将抛出异常。DatabaseException
- 数据库内部异常。long getEdgeCount(String type)
type
- 边类型,不能为空。ParamException
- 参数格式不正确,当类型为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。long getVertexCount(String type)
type
- 点类型,不能为空。ParamException
- 参数格式不正确,当类型为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。Set<Long> getVertexIdByPk(String pk)
pk
- pk,不能为空。Set
点id集合。ParamException
- 参数格式不正确,当pk为空时将抛出异常。DatabaseException
- 数据库内部异常。Long getVertexIdByPk(String pk, String type)
pk
- pk,不能为空。type
- 点类型,不能为空。Long
点id。ParamException
- 参数格式不正确,当pk或type为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。int index()
String
图index。default void insertBatchEdgeByVertexPk(List<EdgeInfoByVertexPk> list)
list
- 参数集合,需要起止点类型、pk,边类型,属性void insertBatchEdgeByVertexPk(List<EdgeInfoByVertexPk> list, boolean createVertexIfAbsent)
list
- 参数集合,需要起止点类型、pk,边类型,属性createVertexIfAbsent
- 如果起止点不存在是否创建{true 创建 | false 不创建}void insertBatchEdgeByVertexPk(String typeName, String fromType, String toType, List<String> propertyList, List<List<Object>> propertyValues, boolean createVertexIfAbsent)
// 定义属性顺序。将按照属性名a,属性名b顺序。
List<String> propertyList = new ArrayList<>();
propertyList.add("属性名a");
propertyList.add("属性名b");
// 构建属性值列表。对照定义的属性顺序。将fromPk、toPk、属性名a、属性名b填充对应的值和类型。
List<List<Object>> propertyValueList = new ArrayList<>();
for (int i = 0; i < 1000; i++) {
List<Object> propertyValue = new ArrayList<>();
// 属性顺序中不用定义fromPk和toPk,默认按照前两项是fromPk和toPk的值。
propertyValue.add("fromPk");
propertyValue.add("toPk");
propertyValue.add("属性名a的值");
propertyValue.add("属性名b的值");
propertyValueList.add(propertyValue);
}
// 进行插入
graph.insertBatchEdgeByVertexPk(edgeType, fromType, toType, propertyList, propertyValueList, false);
typeName
- 边类型名fromType
- 起始点类型toType
- 终止点类型propertyList
- 属性名列表。定义的属性顺序。propertyValues
- 数值型值列表。列表中每一项需要先添加fromPk和toPk后,再按照定义的属性顺序填充。null对象表示对应属性值为null。createVertexIfAbsent
- 如果起止点不存在是否创建{true 创建 | false 不创建}Iterator<Edge> insertBatchEdgeByVertexPkWithResult(List<EdgeInfoByVertexPk> list, boolean createVertexIfAbsent)
insertBatchEdgeByVertexPk(java.util.List<com.graphdbapi.driver.v1.graph.EdgeInfoByVertexPk>)
方法的返回值,只能额外新建一个方法提供支持list
- 参数集合,需要起止点类型、pk,边类型,属性createVertexIfAbsent
- 如果起止点不存在是否创建{true 创建 | false 不创建}default Edge insertEdgeByVertexId(long fromId, long toId, String type)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。Edge
新增后的边信息。ParamException
- 参数格式不正确,当起始点id、终止点id为空或type为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。Edge insertEdgeByVertexId(long fromId, long toId, String type, Map<String,Object> property)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。property
- 边属性。填null或EmptyMap时,表示新增的边没有属性值。Edge
新增后的边信息。ParamException
- 参数格式不正确,当起始点id、终止点id小于0、type为空或property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。Edge insertEdgeByVertexPk(String fromPk, String fromType, boolean createFrom, String toPk, String toType, boolean createTo, String type, Map<String,Object> property)
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。createFrom
- 填true时,如果点不存在,则新增没有属性的起始点,填false,如果点不存在,则抛异常toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。createTo
- 填true时,如果点不存在,则新增没有属性的终止点。填false,如果点不存在,则抛异常type
- 边类型,不能为空。property
- 边属性。填null或EmptyMap时,表示新增的边没有属性值。Edge
新增后的边信息。ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空、property输入的属性类型不支持时或者转换失败将抛出异常。TypeNotFoundException
- 边类型不存在时抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时抛出异常。VertexNotFoundException
- 当createFrom或createTo为false时起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时抛出异常。DatabaseException
- 数据库内部异常。default Edge insertEdgeByVertexPk(String fromPk, String fromType, String toPk, String toType, String type)
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。type
- 边类型,不能为空。Edge
新增后的边信息。ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。default Edge insertEdgeByVertexPk(String fromPk, String fromType, String toPk, String toType, String type, Map<String,Object> property)
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。type
- 边类型,不能为空。property
- 边属性。填null或EmptyMap时,表示新增的边没有属性值。Edge
新增后的边信息。ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空、property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<Edge>> insertEdgesByVertexId(List<EdgeInfoByVertexId> list)
insertEdgesByVertexPk(List)
不同的是,该方法list中每项是通过点id进行新增。
如果想通过pk新增边,请调用insertEdgesByVertexPk(List)
结果按传入顺序构成集合,集合中包含新增后的边信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含新增后的边信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、EdgeInfoById中起始点id或终止点id小于0、
type为空或property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<Edge>> insertEdgesByVertexPk(List<EdgeInfoByVertexPk> list)
insertEdgesByVertexId(List)
(List)} 不同的是,该方法list中每项是通过pk进行新增。
如果想通过点id新增边,请调用insertEdgesByVertexId(List)
结果按传入顺序构成集合,集合中包含新增后的边信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含新增后的边信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null,fromPk、fromType、toPk、toType或type值为空,property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。default Vertex insertVertexByPk(String pk, String type)
pk
- pk,不能为空。type
- 点类型,不能为空。Vertex
新增后的点信息。ParamException
- 参数格式不正确,当pk或type为空时将抛出异常。VertexFoundException
- 点已经存在时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。Vertex insertVertexByPk(String pk, String type, Map<String,Object> property)
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性。填null或EmptyMap时,新增的点没有属性值。Vertex
新增后的点信息。ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持或者转换失败时将抛出异常。VertexFoundException
- 点已经存在时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<Vertex>> insertVertexesByPk(List<VertexInfoByPk> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含新增后的点信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk或type值为空、property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。boolean isEnable() throws Exception
Exception
default void putPropertyValue(boolean isVertex, Object id, String propertyName, Object value)
isVertex
- 点类型填true,边类型填false,isVertex需要跟id对应。id
- 点/边的id,不能为空。propertyName
- 属性名,不能为空。value
- 属性值,不能为空。ParamException
- 参数格式不正确,当点或边的id格式不正确、属性名为空或属性值为空或者类型转换失败时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在对应类型中不存在时将抛出异常。DatabaseException
- 数据库内部异常。void putPropertyValue(boolean isVertex, Object id, String propertyName, Object value, boolean isMerge)
isVertex
- 点类型填true,边类型填false,isVertex需要跟id对应。id
- 点/边的id,不能为空。propertyName
- 属性名,不能为空。value
- 属性值,不能为空。isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。ParamException
- 参数格式不正确,当点或边的id格式不正确、属性名为空或属性值为空或者类型转换失败时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在对应类型中不存在时将抛出异常。DatabaseException
- 数据库内部异常。void removePropertyValue(boolean isVertex, Object id, String propertyName)
isVertex
- 点/边类型填true,边类型填false,isVertex需要跟id对应。id
- 点/边id,不能为空。propertyName
- 属性名,不能为空。ParamException
- 参数格式不正确,当点/边id格式不正确、属性名为空时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在对应点/边中不存在时将抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> retrieveAllEdges()
Iterator
边信息迭代器。DatabaseException
- 数据库内部异常。Iterator<Vertex> retrieveAllVertexes()
Iterator
点信息迭代器。DatabaseException
- 数据库内部异常。Edge retrieveEdge(String edgeId)
edgeId
- 边id,不能为空。Edge
查询的边信息。ParamException
- 参数格式不正确,当边id为空或格式不正确时将抛出异常。DatabaseException
- 数据库内部异常。default Iterator<Edge> retrieveEdgeByVertexId(long id)
id
- 点id,不能小于0。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当点id小于0时将抛出异常。DatabaseException
- 数据库内部异常。default Iterator<Edge> retrieveEdgeByVertexId(long vertexId, long anotherId, Set<String> edgeTypeFilter, Direction direction, VisitCondition edgeCondition)
vertexId
- 点id,不能小于0。anotherId
- 另一点id,不能小于0。edgeTypeFilter
- 边类型的过滤条件。只会返回满足参数中边类型的边。填null不参与计算。direction
- 方向,不能为null。edgeCondition
- 边条件,填null不参与计算。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当两点id小于0、查询方向为null时将抛出异常。DatabaseException
- 数据库内部异常。@Deprecated Iterator<Edge> retrieveEdgeByVertexId(long vertexId, long anotherId, Set<String> edgeTypeFilter, Direction direction, VisitCondition edgeCondition, boolean getLoop)
vertexId
- 点id,不能小于0。anotherId
- 另一点id,不能小于0。edgeTypeFilter
- 边类型的过滤条件。只会返回满足参数中边类型的边。填null不参与计算。direction
- 方向,不能为null。edgeCondition
- 边条件,填null不参与计算。getLoop
- true计算自环,false不计算自环。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当两点id小于0、查询方向为null时将抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> retrieveEdgeByVertexId(long id, Set<String> edgeTypeFilter, Direction direction, int limitEdge, VisitCondition vertexCondition, VisitCondition edgeCondition, boolean getLoop)
id
- 点id,不能小于0。edgeTypeFilter
- 边类型的过滤条件。只会返回满足参数中边类型的边。填null不参与计算。建议类型过滤使用这个字段,而不是edgeCondition。direction
- 查询方向,不能为null。limitEdge
- 边个数限制,小于0表示不进行限制。vertexCondition
- 点条件,填null不参与计算。edgeCondition
- 边条件,填null不参与计算。getLoop
- true计算自环,false不计算自环。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当点id小于0、查询方向为null时将抛出异常。DatabaseException
- 数据库内部异常。default Iterator<Edge> retrieveEdgeByVertexId(long id, Set<String> edgeTypeFilter, Direction direction, VisitCondition vertexCondition, VisitCondition edgeCondition, boolean getLoop)
id
- 点id,不能小于0。edgeTypeFilter
- 边类型的过滤条件。只会返回满足参数中边类型的边。填null不参与计算。建议类型过滤使用这个字段,而不是edgeCondition。direction
- 查询方向,不能为null。vertexCondition
- 点条件,填null不参与计算。edgeCondition
- 边条件,填null不参与计算。getLoop
- true计算自环,false不计算自环。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当点id小于0、查询方向为null时将抛出异常。DatabaseException
- 数据库内部异常。default Iterator<Edge> retrieveEdgeByVertexPk(String pk, String type)
pk
- 起始点pk,不能为空。type
- 点类型,不能为空。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当点pk或type为空时将抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> retrieveEdgeByVertexPk(String pk, String type, Set<String> edgeTypeFilter, Direction direction, int limitEdge, VisitCondition vertexCondition, VisitCondition edgeCondition, boolean getLoop)
pk
- 点pk,不能为空。type
- 点类型,不能为空。edgeTypeFilter
- 边类型的过滤条件。只会返回满足参数中边类型的边。填null不参与计算。建议类型过滤使用这个字段,而不是edgeCondition。direction
- 查询方向,不能为null。limitEdge
- 边个数限制,小于0表示不进行限制。vertexCondition
- 点条件,填null不参与计算。edgeCondition
- 边条件,填null不参与计算。getLoop
- true计算自环,false不计算自环。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当点pk和type为空、查询方向为null时将抛出异常。DatabaseException
- 数据库内部异常。default Iterator<Edge> retrieveEdgeByVertexPk(String pk, String type, Set<String> edgeTypeFilter, Direction direction, VisitCondition vertexCondition, VisitCondition edgeCondition, boolean getLoop)
pk
- 起始点pk,不能为空。type
- 点类型,不能为空。edgeTypeFilter
- 边类型的过滤条件。只会返回满足参数中边类型的边。填null不参与计算。建议类型过滤使用这个字段,而不是edgeCondition。direction
- 查询方向,不能为null。vertexCondition
- 点条件,填null不参与计算。edgeCondition
- 边条件,填null不参与计算。getLoop
- true计算自环,false不计算自环。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当点点pk和type为空、查询方向为null时将抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> retrieveEdgeByVertexPk(String vertexPk, String vertexType, String anotherPk, String anotherType, Set<String> edgeTypeFilter, Direction direction, int limitEdge, VisitCondition edgeCondition)
vertexPk
- 点pk,不能为空。vertexType
- 点类型,不能为空。anotherPk
- 另一点pk,不能为空。anotherType
- 另一点类型,不能为空。edgeTypeFilter
- 边类型的过滤条件。只会返回满足参数中边类型的边。填null不参与计算。建议类型过滤使用这个字段,而不是edgeCondition。direction
- 查询方向,不能为null。limitEdge
- 边个数限制,小于0表示不进行限制。edgeCondition
- 边条件,填null不参与计算。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当点pk和type为空、查询方向为null时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<Edge>> retrieveEdges(List<String> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 边id集合,不能为空。List
批量操作结果集。包含查询的边信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、边id格式不正确时将抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> retrieveEdgesByType(String type)
type
- 边类型,不能为空。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当类型为空时将抛出异常。TypeNotFoundException
- 边类型不存在时抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> retrieveOrInsertEdgeByVertexId(long fromId, long toId, String type, Map<String,Object> property)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。property
- 边属性。填null或EmptyMap时,新增的边没有属性值。Iterator
查询或新增后的边信息迭代器。ParamException
- 参数格式不正确,当type为空、起始点id或终止点id小于0、property输入的属性类型不支持或转换错误时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> retrieveOrInsertEdgeByVertexPk(String fromPk, String fromType, boolean createFrom, String toPk, String toType, boolean createTo, String type, Map<String,Object> property)
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。createFrom
- 填true时,如果点不存在,则新增没有属性的起始点。填false,如果点不存在,则抛异常toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。createTo
- 填true时,如果点不存在,则新增没有属性的终止点。填false,如果点不存在,则抛异常type
- 边类型,不能为空。property
- 边属性。填null或EmptyMap时,新增的边没有属性值。Iterator
查询或新增后的边信息迭代器。ParamException
- 参数格式不正确,当type为空、起始点或终止点类型为空、property输入的属性类型不支持或转换失败时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<List<Edge>>> retrieveOrInsertEdgesByVertexId(List<EdgeInfoByVertexId> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含查询或新增后的边信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空、以及集合中存在null、type为空、起始点id或终止点id小于0、property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<List<Edge>>> retrieveOrInsertEdgesByVertexPk(List<EdgeInfoByVertexPk> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含查询或新增后的边信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、type为空、起始点或终止点类型为空、起始点pk和终止点pk为空、property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。Vertex retrieveOrInsertVertexByPk(String pk, String type, Map<String,Object> property)
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性。填null或EmptyMap时,表示新增的点没有属性值。Vertex
查询或新增后的点信息。ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持或转换错误时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<Vertex>> retrieveOrInsertVertexesByPk(List<VertexInfoByPk> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含查询或新增后的点信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk或type为空、property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。Vertex retrieveVertex(long id)
id
- 点id,不能小于0。Vertex
查询的点信息。ParamException
- 参数格式不正确,当点id小于0时将抛出异常。DatabaseException
- 数据库内部异常。Vertex retrieveVertexByPk(String pk, String type)
pk
- pk,不能为空。type
- 点类型,不能为空。Vertex
查询的点信息。ParamException
- 参数格式不正确,当pk或type为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<Vertex>> retrieveVertexes(List<Long> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 点id列表,不能为空。List
批量操作结果集。包含查询的点信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、点id格式不正确时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<Vertex>> retrieveVertexesByPk(List<VertexInfoByPk> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 点id集合,不能为空。List
批量操作结果集。包含查询的点信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk和type为空时将抛出异常。DatabaseException
- 数据库内部异常。Iterator<Vertex> retrieveVertexesByType(String type)
type
- 点类型,不能为空。Iterator
点信息迭代器。ParamException
- 参数格式不正确,当type为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。GraphSchema schema()
Iterator<Edge> searchEdgeProperty(String type, List<SearchPredicate> predicates, List<SearchOrder> orders, int skip, int limit)
type
- 边类型名predicates
- 查询谓词,每个谓词包括:属性名、查询值orders
- 属性排序skip
- 跳过limit
- 限制返回数量Iterator<String> searchEdgesByIndex(String typeName, String propName, Object data, int skip, int limit)
typeName
- 类型名propName
- 属性名data
- 查找值skip
- 跳过limit
- 限制返回数量Iterator<Long> searchVertexesByIndex(String typeName, String propName, Object data, int skip, int limit)
typeName
- 类型名propName
- 属性名data
- 查找值skip
- 跳过limit
- 限制返回数量Iterator<Vertex> searchVertexProperty(String type, List<SearchPredicate> predicates, List<SearchOrder> orders, int skip, int limit)
type
- 点类型名predicates
- 查询谓词,每个谓词包括:属性名、查询值orders
- 属性排序skip
- 跳过limit
- 限制返回数量Iterator<Edge> shortestPath(long startId, long endId, Set<String> pathEdgeType)
startId
- 起始点id,不能小于0。endId
- 终止点id,不能小于0。pathEdgeType
- 路径包含的边类型,填null不进行过滤。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当起始点id和终止点id小于0时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> shortestPath(long startId, long endId, Set<String> pathEdgeType, int limit)
startId
- 起始点id,不能为空。endId
- 终止点id,不能为空。pathEdgeType
- 过滤的边类型,填null不参与计算。limit
- 长度限制,最多限制10跳。Iterator
边信息迭代器。ParamException
- 参数格式不正确,当起始点id和终止点id小于0时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。void stopCypher(long taskId)
getCypherMetrics()
获取。
也可以用于停止 executeCypherTaskAsyncForStatementResult(String cypher)
提交的任务。taskId
- cypher taskId,必须大于0。ParamException
- 参数格式不正确,当taskId小于等于0时将抛出异常。com.graphdbapi.driver.v1.exceptions.TaskNotExist
- 任务不存在时抛出异常default Edge updateEdge(String edgeId, Map<String,Object> property)
edgeId
- 边id,不能为空。property
- 边属性。Edge
更新后的边信息。ParamException
- 参数格式不正确,当边id为空或格式不正确、property输入的属性类型不支持或者转换失败时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。Edge updateEdge(String edgeId, Map<String,Object> property, boolean isMerge)
edgeId
- 边id,不能为空。property
- 边属性,isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。Edge
更新后的边信息。ParamException
- 参数格式不正确,当边id为空或格式不正确、property输入的属性类型不支持或者转换失败时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。default Iterator<Edge> updateEdgeByVertexId(long fromId, long toId, String type, Map<String,Object> property)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。property
- 边属性。Iterator
更新后的边信息。ParamException
- 参数格式不正确,当fromId、toId小于0或type值为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型、property输入的属性类型不支持或者转换失败时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。default Iterator<Edge> updateEdgeByVertexId(long fromId, long toId, String type, Map<String,Object> property, boolean isMerge)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。property
- 边属性。isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。Iterator
更新后的边信息。ParamException
- 参数格式不正确,当fromId、toId小于0或type值为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型、property输入的属性类型不支持或者转换失败时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> updateEdgeByVertexIdCondition(long fromId, long toId, String type, VisitCondition edgeCondition, Map<String,Object> property, boolean isMerge)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。edgeCondition
- 边条件过滤,为null不参与计算。property
- 边属性。isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。Iterator
更新后的边信息。ParamException
- 参数格式不正确,当fromId、toId小于0或type值为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型、property输入的属性类型不支持或者转换失败时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。default Iterator<Edge> updateEdgeByVertexPk(String fromPk, String fromType, String toPk, String toType, String type, Map<String,Object> property)
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。type
- 边类型,不能为空。property
- 边属性。Edge
更新后的边信息迭代器ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空、property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 边类型不存在时抛出异常。DatabaseException
- 数据库内部异常。EdgeNotFoundException
- 当没有查询到边时抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时抛出异常。default Iterator<Edge> updateEdgeByVertexPk(String fromPk, String fromType, String toPk, String toType, String type, Map<String,Object> property, boolean isMerge)
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。type
- 边类型,不能为空。property
- 边属性。isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。Edge
更新后的边信息迭代器ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空、property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 边类型不存在时抛出异常。DatabaseException
- 数据库内部异常。PkNotFoundException
- 当pk不存在时抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时抛出异常。Iterator<Edge> updateEdgeByVertexPkCondition(String fromPk, String fromType, String toPk, String toType, String type, VisitCondition edgeCondition, Map<String,Object> property, boolean isMerge)
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。type
- 边类型,不能为空。edgeCondition
- 边条件过滤,为null不参与计算。property
- 边属性。isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。Edge
更新后的边信息迭代器ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空、property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 边类型不存在时抛出异常。DatabaseException
- 数据库内部异常。PkNotFoundException
- 当pk不存在时抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时抛出异常。List<ResponseItem<Edge>> updateEdges(List<EdgeInfo> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数列表,不能为空。List
批量操作结果集。包含更新后的边信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、边id格式不正确、property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<List<Edge>>> updateEdgesByVertexId(List<EdgeInfoByVertexId> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含更新后的边信息和错误信息。ParamException
- 参数格式不正确,当fromId、toId小于0或type值为空、property输入的属性类型不支持时时将抛出异常。DatabaseException
- 数据库内部异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。List<ResponseItem<List<Edge>>> updateEdgesByVertexPk(List<EdgeInfoByVertexPk> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含更新后的边信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null,fromPk、fromType、toPk、toType或type值为空,property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。default Vertex updateVertex(long id, Map<String,Object> property)
id
- 点id,不能小于0。property
- 点属性。Vertex
更新后的点信息。ParamException
- 参数格式不正确,当点id小于0、property输入的属性类型不支持或者转换失败时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。Vertex updateVertex(long id, Map<String,Object> property, boolean isMerge)
id
- 点id,不能小于0。property
- 点属性,isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。Vertex
更新后的点信息。ParamException
- 参数格式不正确,当点id小于0、property输入的属性类型不支持或者转换失败时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。default Vertex updateVertexByPk(String pk, String type, Map<String,Object> property)
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性。Vertex
更新后的点信息。ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PkNotFoundException
- 点pk不存在的时候抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。Vertex updateVertexByPk(String pk, String type, Map<String,Object> property, boolean isMerge)
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性,isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。Vertex
更新后的点信息。ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PkNotFoundException
- 点pk不存在的时候抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<Vertex>> updateVertexes(List<VertexInfoById> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含更新后的点信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、id值为空、property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<Vertex>> updateVertexesByPk(List<VertexInfoByPk> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含更新后的点信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk或type值为空或property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。PkNotFoundException
- 点pk不存在的时候抛出异常。void upsertBatchVertexByPk(List<VertexInfoByPk> list)
list
- 参数集合,需要点类型、pk和属性void upsertBatchVertexByPk(String typeName, List<String> propertyList, List<List<Object>> propertyValues)
// 定义属性顺序。将按照id(外部唯一标识)、属性名a、属性名b的顺序
List<String> propertyList = new ArrayList<>();
propertyList.add("id");
propertyList.add("属性名a");
propertyList.add("属性名b");
// 构建属性值列表。对照定义的属性顺序。将id、属性名a、属性名b填充对应的值和类型。
List<List<Object>> propertyValueList = new ArrayList<>();
for (int i = 0; i < 1000; i++) {
List<Object> propertyValue = new ArrayList<>();
propertyValue.add("id");
propertyValue.add("属性名a的值");
propertyValue.add("属性名b的值");
propertyValueList.add(propertyValue);
}
// 进行插入
graph.upsertBatchVertexByPk(vertexType, propertyList, propertyValueList);
typeName
- 点类型名propertyList
- 属性名列表。定义的属性顺序。必须包含外部唯一标识的属性名。propertyValues
- 数值型值列表。列表中每一项要按照定义的属性顺序填充。null对象表示对应属性值为null。Iterator<Vertex> upsertBatchVertexByPkWithResult(List<VertexInfoByPk> list)
upsertBatchVertexByPk(java.util.List<com.graphdbapi.driver.v1.graph.VertexInfoByPk>)
方法的返回值,只能额外新建一个方法提供支持list
- 参数集合,需要点类型、pk和属性default Iterator<Edge> upsertEdgeByVertexId(long fromId, long toId, String type, Map<String,Object> property)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。property
- 边属性。Iterator
新增或更新后的边信息。ParamException
- 参数格式不正确,当fromId、toId小于0或type值为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型、property输入的属性类型不支持或者转换失败时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> upsertEdgeByVertexId(long fromId, long toId, String type, Map<String,Object> property, boolean isMerge)
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。property
- 边属性。isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。Iterator
新增或更新后的边信息。ParamException
- 参数格式不正确,当fromId、toId小于0或type值为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型、property输入的属性类型不支持或者转换失败时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。default Iterator<Edge> upsertEdgeByVertexPk(String fromPk, String fromType, boolean createFrom, String toPk, String toType, boolean createTo, String type, Map<String,Object> property)
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。createFrom
- 填true时,如果点不存在,则新增没有属性的起始点,填false,如果点不存在,则抛异常toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。createTo
- 填true时,如果点不存在,则新增没有属性的终止点。填false,如果点不存在,则抛异常type
- 边类型,不能为空。property
- 边属性。Edge
新增或更新后的边信息迭代器。ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空、property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 边类型不存在时抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时抛出异常。VertexNotFoundException
- 当createFrom或createTo为false时起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时抛出异常。DatabaseException
- 数据库内部异常。Iterator<Edge> upsertEdgeByVertexPk(String fromPk, String fromType, boolean createFrom, String toPk, String toType, boolean createTo, String type, Map<String,Object> property, boolean isMerge)
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。createFrom
- 填true时,如果点不存在,则新增没有属性的起始点,填false,如果点不存在,则抛异常toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。createTo
- 填true时,如果点不存在,则新增没有属性的终止点。填false,如果点不存在,则抛异常type
- 边类型,不能为空。property
- 边属性,isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。Edge
新增或更新后的边信息迭代器。ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空、property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 边类型不存在时抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时抛出异常。VertexNotFoundException
- 当createFrom或createTo为false时起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<List<Edge>>> upsertEdgesByVertexId(List<EdgeInfoByVertexId> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含新增或更新后的边信息和错误信息。ParamException
- 参数格式不正确,当fromId、toId小于0或type值为空、property输入的属性类型不支持时时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<List<Edge>>> upsertEdgesByVertexPk(List<EdgeInfoByVertexPk> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含新增或更新后的边信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null,fromPk、fromType、toPk、toType或type值为空,property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。default Vertex upsertVertexByPk(String pk, String type, Map<String,Object> property)
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性。Vertex
新增或更新后的点信息。ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。Vertex upsertVertexByPk(String pk, String type, Map<String,Object> property, boolean isMerge)
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性,isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。Vertex
新增或更新后的点信息。ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持或者转换失败时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。DatabaseException
- 数据库内部异常。List<ResponseItem<Vertex>> upsertVertexesByPk(List<VertexInfoByPk> list)
ResponseItem.isError()
方法判断操作是否失败。list
- 参数集合,不能为空。List
批量操作结果集。包含新增或更新后的点信息和错误信息。ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk或type值为空或property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。Copyright © 2024. All rights reserved.