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