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 GraphTransaction
beginTransaction()
开始一个新的事务。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)
通过bfs查询,获取满足resultTypeSet的邻居点的 id 集合。void
clearGraph()
删除图数据。保留图schema,删除数据。void
close()
关闭graph中使用的driver连接。graph对象中仅有driver需要close。若driver是复用的,可以等待driver真正结束时调用driver.close关闭。void
deleteEdge(String edgeId)
删除边。通过边id删除边。void
deleteEdgeByVertexId(long fromId, long toId, int edgeLimit)
删除边。通过起始点id和终止点id,删除两点之间的边。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删除点。如果不存在或删除失败,则会返回异常结果集。 结果按传入顺序构成集合,集合中包含成功信息和错误信息。com.graphdbapi.driver.v1.StatementResult
executeCypher(String cypher, Map<String,com.graphdbapi.driver.v1.Value> parameters)
执行cypher查询。long
executeCypherTaskAsyncForStatementResult(String cypher)
异步执行cypher查询。long
executeCypherTaskAsyncForStatementResult(String cypher, Map<String,com.graphdbapi.driver.v1.Value> parameters)
异步执行cypher查询。com.graphdbapi.driver.v1.StatementResult
executeQuery(String cypher)
执行cypher查询。默认超时时间7200秒(包括查询结果迭代时间),如果查询需要长时间执行或结果集过大,建议使用包含timeout的重载方法指定合适的超时时间。com.graphdbapi.driver.v1.StatementResult
executeQuery(String cypher, int defLimit)
执行cypher查询。com.graphdbapi.driver.v1.StatementResult
executeQuery(String cypher, long timeout)
执行cypher查询。com.graphdbapi.driver.v1.StatementResult
executeQuery(String cypher, long timeout, int defLimit)
执行cypher查询。long
getAllEdgeCount()
查询边个数。查询图中边总数。long
getAllVertexCount()
查询点个数。查询图中点总数。Map<Long,CypherQuery>
getCypherMetrics()
获取正在执行的cypher语句的执行信息。CypherTaskStatus
getCypherTaskAsyncForStatementResultStatus(long cypherTaskId)
获取可视化专用 cypher 异步查询任务的执行状态。com.graphdbapi.driver.v1.StatementResult
getCypherTaskStatementResult(long cypherTaskId)
获取cypher异步查询的结果迭代器。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 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查询。Iterator<Edge>
retrieveEdgeByVertexId(long srcId, long dstId, Set<String> edgeTypeFilter, Direction direction, VisitCondition edgeCondition, boolean getLoop)
查询邻居。通过起始点id和终止点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 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 toFrom, 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<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<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来修改边。 如果起始点到终止点不存在边报错。(集合属性会自动追加)Iterator<Edge>
updateEdgeByVertexId(long fromId, long toId, String type, 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修改边。(集合属性会自动追加) 找不到起始点和终止点时报错。 如果起始点到终止点不存在边报错。Iterator<Edge>
updateEdgeByVertexPk(String fromPk, String fromType, String toPk, String toType, String type, 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()
方法判断操作是否失败。
-
-
-
Method Detail
-
beginTransaction
GraphTransaction beginTransaction()
开始一个新的事务。角色:
RoleType.READER
try(GraphTransaction tx = graph.beginTransaction()) { tx.insertVertexByPk("id_0001", "person"); tx.success(); }
- Returns:
- GraphTransaction 事务信息。
-
schema
GraphSchema schema()
获取图schema相关的操作类。- Returns:
- 图schema操作类。
-
getCypherMetrics
Map<Long,CypherQuery> getCypherMetrics()
获取正在执行的cypher语句的执行信息。角色:
RoleType.READER
- Returns:
Map
cypher语句执行信息。
-
stopCypher
void stopCypher(long taskId)
停止集群中指定taskId的cypher语句。taskId可以通过getCypherMetrics()
获取。 也可以用于停止executeCypherTaskAsyncForStatementResult(String cypher)
提交的任务。角色:
RoleType.READER
- Parameters:
taskId
- cypher taskId,必须大于0。- Throws:
ParamException
- 参数格式不正确,当taskId小于等于0时将抛出异常。com.graphdbapi.driver.v1.exceptions.TaskNotExist
- 任务不存在时抛出异常
-
close
void close() throws Exception
关闭graph中使用的driver连接。graph对象中仅有driver需要close。若driver是复用的,可以等待driver真正结束时调用driver.close关闭。- Specified by:
close
in interfaceAutoCloseable
- Throws:
DatabaseException
- 数据库内部异常,在关闭数据库连接失败时将抛出异常。Exception
-
index
int index()
获取图index。- Returns:
String
图index。
-
executeQuery
com.graphdbapi.driver.v1.StatementResult executeQuery(String cypher)
执行cypher查询。默认超时时间7200秒(包括查询结果迭代时间),如果查询需要长时间执行或结果集过大,建议使用包含timeout的重载方法指定合适的超时时间。角色:
RoleType.READER
- Parameters:
cypher
- 查询语句,不能为空。- Returns:
StatementResult
cypher执行结果迭代器。- Throws:
ParamException
- 参数格式不正确,当cypher为空时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。- See Also:
- StatementResult
-
executeQuery
com.graphdbapi.driver.v1.StatementResult executeQuery(String cypher, long timeout)
执行cypher查询。角色:
RoleType.READER
- Parameters:
cypher
- 查询语句,不能为空。timeout
- 超时时间,单为秒。必须大于0。- Returns:
StatementResult
cypher执行结果迭代器。- Throws:
ParamException
- 参数格式不正确,当cypher为空、timeout小于等于0时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。- See Also:
- StatementResult
-
executeQuery
com.graphdbapi.driver.v1.StatementResult executeQuery(String cypher, int defLimit)
执行cypher查询。角色:
RoleType.READER
- Parameters:
cypher
- 查询语句,不能为空。defLimit
- 返回结果数限制,小于0表示不进行限制。- Returns:
StatementResult
cypher执行结果迭代器。- Throws:
ParamException
- 参数格式不正确,当cypher为空时将抛出异常。DatabaseException
- 数据库内部异常,当cypher语法错误时将抛出异常。- See Also:
- StatementResult
-
executeQuery
com.graphdbapi.driver.v1.StatementResult executeQuery(String cypher, long timeout, int defLimit)
执行cypher查询。角色:
RoleType.READER
- Parameters:
cypher
- 查询语句,不能为空。timeout
- 超时时间,必须大于0。defLimit
- 返回结果数限制,小于0表示不进行限制。- Returns:
StatementResult
cypher执行结果迭代器。- Throws:
ParamException
- 参数格式不正确,当cypher为空、timeout小于等于0时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。- See Also:
- StatementResult
-
executeCypher
com.graphdbapi.driver.v1.StatementResult executeCypher(String cypher, Map<String,com.graphdbapi.driver.v1.Value> parameters)
执行cypher查询。角色:
RoleType.READER
- 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集合。角色:
RoleType.READER
- Parameters:
pk
- pk,不能为空。- Returns:
Set
点id集合。- Throws:
ParamException
- 参数格式不正确,当pk为空时将抛出异常。PkNotFoundException
- Pk在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
getVertexIdByPk
Long getVertexIdByPk(String pk, String type)
查询点id。通过点pk和type获取点id。在一个点类型下,点pk和点id是一一对应的。角色:
RoleType.READER
- Parameters:
pk
- pk,不能为空。type
- 点类型,不能为空。- Returns:
Long
点id。- Throws:
ParamException
- 参数格式不正确,当pk或type为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PkNotFoundException
- Pk在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveVertex
Vertex retrieveVertex(long id)
查询点。通过点id查询点信息。不存在返回null角色:
RoleType.READER
- Parameters:
id
- 点id,不能小于0。- Returns:
Vertex
查询的点信息。- Throws:
ParamException
- 参数格式不正确,当点id小于0时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveVertexByPk
Vertex retrieveVertexByPk(String pk, String type)
查询点。通过点pk和type查询点。在一个确定的点类型下,通过pk仅能查询到一个点。不存在返回null角色:
RoleType.READER
- 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查询或新增点。若点已经存在,仅查询并返回点信息,属性值不做修改。若点不存在,新增并返回点信息。角色:
RoleType.EDITOR
- Parameters:
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性。填null或EmptyMap时,表示新增的点没有属性值。- Returns:
Vertex
查询或新增后的点信息。- Throws:
ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveOrInsertVertexesByPk
List<ResponseItem<Vertex>> retrieveOrInsertVertexesByPk(List<VertexInfoByPk> list)
批量查询或新增点。通过点pk和type查询或新增点。若点已经存在,仅查询并返回点信息,属性值不做修改。若点不存在,新增并返回点信息。 结果按传入顺序构成集合,集合中包含查询或新增后的点信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.EDITOR
- 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和边类型查询或新增边。若两点之间此边类型的边存在,则查询并返回两点之间此类型所有边的迭代器。 若不存在点,抛出异常;若存在点不存在边,则新增一条边并返回。角色:
RoleType.EDITOR
- Parameters:
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。property
- 边属性。填null或EmptyMap时,新增的边没有属性值。- Returns:
Iterator
查询或新增后的边信息迭代器。- Throws:
ParamException
- 参数格式不正确,当type为空、起始点id或终止点id小于0时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveOrInsertEdgeByVertexPk
Iterator<Edge> retrieveOrInsertEdgeByVertexPk(String fromPk, String fromType, boolean createFrom, String toPk, String toType, boolean toFrom, String type, Map<String,Object> property)
查询或新增边。通过起始点pk和终止点pk查询或新增边。若两点之间此边类型的边存在,则查询并返回两点之间此类型所有边的迭代器。 若不存在点,抛出异常;若存在点不存在边,则新增一条边并返回。角色:
RoleType.EDITOR
- Parameters:
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。createFrom
- 填true时,如果点不存在,则新增没有属性的起始点。填false,如果点不存在,则抛异常toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。toFrom
- 填true时,如果点不存在,则新增没有属性的终止点。填false,如果点不存在,则抛异常type
- 边类型,不能为空。property
- 边属性。填null或EmptyMap时,新增的边没有属性值。- Returns:
Iterator
查询或新增后的边信息迭代器。- Throws:
ParamException
- 参数格式不正确,当type为空、起始点或终止点类型为空、property输入的属性类型不支持时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveOrInsertEdgesByVertexId
List<ResponseItem<List<Edge>>> retrieveOrInsertEdgesByVertexId(List<EdgeInfoByVertexId> list)
批量查询或新增边。通过起始点id和终止点id查询或新增边。若存在,仅查询并返回所有边信息,属性值不做修改。若不存在,则新增一条边并返回边信息。 结果按传入顺序构成集合,集合中包含查询或新增后的边信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.EDITOR
- 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()
方法判断操作是否失败。角色:
RoleType.EDITOR
- Parameters:
list
- 参数集合,不能为空。- Returns:
List
批量操作结果集。包含查询或新增后的边信息和错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、type为空、起始点或终止点类型为空、起始点pk和终止点pk为空、property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。
-
insertVertexByPk
default Vertex insertVertexByPk(String pk, String type)
新增点。通过点pk和type新增一个的无属性点。角色:
RoleType.EDITOR
- 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新增一个点,属性为可选项。角色:
RoleType.EDITOR
- Parameters:
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性。填null或EmptyMap时,新增的点没有属性值。- Returns:
Vertex
新增后的点信息。- Throws:
ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持时将抛出异常。VertexFoundException
- 点已经存在时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
updateVertex
default Vertex updateVertex(long id, Map<String,Object> property)
更新点。通过点id更新点属性。(集合属性会自动追加)角色:
RoleType.EDITOR
- Parameters:
id
- 点id,不能小于0。property
- 点属性。- Returns:
Vertex
更新后的点信息。- Throws:
ParamException
- 参数格式不正确,当点id小于0、property输入的属性类型不支持时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
updateVertex
Vertex updateVertex(long id, Map<String,Object> property, boolean isMerge)
更新点。通过点id更新点属性。角色:
RoleType.EDITOR
- Parameters:
id
- 点id,不能小于0。property
- 点属性,isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。- Returns:
Vertex
更新后的点信息。- Throws:
ParamException
- 参数格式不正确,当点id小于0、property输入的属性类型不支持时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
updateVertexes
List<ResponseItem<Vertex>> updateVertexes(List<VertexInfoById> list)
批量更新点。通过点id更新点。如果已存在,则会比较属性值。 结果按传入顺序构成集合,集合中包含更新后的点信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.EDITOR
- Parameters:
list
- 参数集合,不能为空。- Returns:
List
批量操作结果集。包含更新后的点信息和错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、id值为空、property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。
-
insertVertexesByPk
List<ResponseItem<Vertex>> insertVertexesByPk(List<VertexInfoByPk> list)
批量新增点。通过点pk和type新增点,属性为可选项。 结果按传入顺序构成集合,集合中包含新增后的点信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.EDITOR
- Parameters:
list
- 参数集合,不能为空。- Returns:
List
批量操作结果集。包含新增后的点信息和错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk或type值为空、property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。
-
upsertVertexByPk
default Vertex upsertVertexByPk(String pk, String type, Map<String,Object> property)
新增或更新点。通过点pk和type新增或更新点。如果已存在,则会比较属性值。(集合属性会自动追加)角色:
RoleType.EDITOR
- Parameters:
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性。- Returns:
Vertex
新增或更新后的点信息。- Throws:
ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
upsertVertexByPk
Vertex upsertVertexByPk(String pk, String type, Map<String,Object> property, boolean isMerge)
新增或更新点。通过点pk和type新增或更新点。如果已存在,则会比较属性值。角色:
RoleType.EDITOR
- Parameters:
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性,isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。- Returns:
Vertex
新增或更新后的点信息。- Throws:
ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
updateVertexByPk
default Vertex updateVertexByPk(String pk, String type, Map<String,Object> property)
更新点。通过点pk和type更新点。如果已存在,则会比较属性值。(集合属性会自动追加)角色:
RoleType.EDITOR
- Parameters:
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性。- Returns:
Vertex
更新后的点信息。- Throws:
ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PkNotFoundException
- 点pk不存在的时候抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
updateVertexByPk
Vertex updateVertexByPk(String pk, String type, Map<String,Object> property, boolean isMerge)
更新点。通过点pk和type更新点。如果已存在,则会比较属性值。角色:
RoleType.EDITOR
- Parameters:
pk
- pk,不能为空。type
- 点类型,不能为空。property
- 点属性,isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。- Returns:
Vertex
更新后的点信息。- Throws:
ParamException
- 参数格式不正确,当pk或type为空、property输入的属性类型不支持时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。PkNotFoundException
- 点pk不存在的时候抛出异常。PropertyNotFoundException
- 属性名在点类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
upsertVertexesByPk
List<ResponseItem<Vertex>> upsertVertexesByPk(List<VertexInfoByPk> list)
批量新增或更新点。通过点pk和type新增或更新点。如果已存在,则会比较属性值。 结果按传入顺序构成集合,集合中包含新增或更新后的点信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.EDITOR
- Parameters:
list
- 参数集合,不能为空。- Returns:
List
批量操作结果集。包含新增或更新后的点信息和错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk或type值为空或property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。
-
updateVertexesByPk
List<ResponseItem<Vertex>> updateVertexesByPk(List<VertexInfoByPk> list)
批量更新点。通过点pk和type更新点。如果已存在,则会比较属性值。 结果按传入顺序构成集合,集合中包含更新后的点信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.EDITOR
- Parameters:
list
- 参数集合,不能为空。- Returns:
List
批量操作结果集。包含更新后的点信息和错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk或type值为空或property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。PkNotFoundException
- 点pk不存在的时候抛出异常。
-
deleteVertex
void deleteVertex(long id)
删除点。通过点id删除点。角色:
RoleType.EDITOR
- Parameters:
id
- 点id,不能小于0。- Throws:
ParamException
- 参数格式不正确,当点id小于0时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
deleteVertexByPk
void deleteVertexByPk(String pk, String type)
删除点。通过点pk和type删除点。角色:
RoleType.EDITOR
- Parameters:
pk
- pk,不能为空。type
- 点类型,不能为空。- Throws:
ParamException
- 参数格式不正确,当pk或type为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveVertexesByType
Iterator<Vertex> retrieveVertexesByType(String type)
查询点类型下的所有点。迭代获取某个点类型的所有点信息。角色:
RoleType.READER
- Parameters:
type
- 点类型,不能为空。- Returns:
Iterator
点信息迭代器。- Throws:
ParamException
- 参数格式不正确,当type为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveAllVertexes
Iterator<Vertex> retrieveAllVertexes()
查询所有点。迭代获取数据库中的所有点信息。角色:
RoleType.READER
- Returns:
Iterator
点信息迭代器。- Throws:
DatabaseException
- 数据库内部异常。
-
retrieveEdge
Edge retrieveEdge(String edgeId)
查询边。通过边id查询边。不存在返回null角色:
RoleType.READER
- Parameters:
edgeId
- 边id,不能为空。- Returns:
Edge
查询的边信息。- Throws:
ParamException
- 参数格式不正确,当边id为空或格式不正确时将抛出异常。DatabaseException
- 数据库内部异常。
-
insertEdgeByVertexId
default Edge insertEdgeByVertexId(long fromId, long toId, String type)
新增边。通过起始点id和终止点id新增一条无属性边。角色:
RoleType.EDITOR
- 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新增一条边,属性为可选项。角色:
RoleType.EDITOR
- Parameters:
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。property
- 边属性。填null或EmptyMap时,表示新增的边没有属性值。- Returns:
Edge
新增后的边信息。- Throws:
ParamException
- 参数格式不正确,当起始点id、终止点id小于0、type为空或property输入的属性类型不支持时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
insertEdgesByVertexId
List<ResponseItem<Edge>> insertEdgesByVertexId(List<EdgeInfoByVertexId> list)
批量新增边。通过起始点id和终止点id新增边。 该方法与insertEdgesByVertexPk(List)
不同的是,该方法list中每项是通过点id进行新增。 如果想通过pk新增边,请调用insertEdgesByVertexPk(List)
结果按传入顺序构成集合,集合中包含新增后的边信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.EDITOR
- 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决定是否新增无属性的起始点和终止点。角色:
RoleType.EDITOR
- 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
- 属性名在边类型中没有定义时抛出异常。ValueFormatException
- 属性值类型错误时抛出异常。DatabaseException
- 数据库内部异常。
-
insertEdgeByVertexPk
default Edge insertEdgeByVertexPk(String fromPk, String fromType, String toPk, String toType, String type)
新增边。通过起始点pk和终止点pk新增边。角色:
RoleType.EDITOR
- Parameters:
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。type
- 边类型,不能为空。- Returns:
Edge
新增后的边信息。- Throws:
ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
insertEdgeByVertexPk
default Edge insertEdgeByVertexPk(String fromPk, String fromType, String toPk, String toType, String type, Map<String,Object> property)
新增边。通过起始点pk和终止点pk新增边。角色:
RoleType.EDITOR
- 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
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
updateEdge
default Edge updateEdge(String edgeId, Map<String,Object> property)
更新边。通过边id更新边。(集合属性会自动追加)角色:
RoleType.EDITOR
- Parameters:
edgeId
- 边id,不能为空。property
- 边属性。- Returns:
Edge
更新后的边信息。- Throws:
ParamException
- 参数格式不正确,当边id为空或格式不正确、property输入的属性类型不支持时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
updateEdge
Edge updateEdge(String edgeId, Map<String,Object> property, boolean isMerge)
更新边。通过边id更新边。角色:
RoleType.EDITOR
- Parameters:
edgeId
- 边id,不能为空。property
- 边属性,isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。- Returns:
Edge
更新后的边信息。- Throws:
ParamException
- 参数格式不正确,当边id为空或格式不正确、property输入的属性类型不支持时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
updateEdges
List<ResponseItem<Edge>> updateEdges(List<EdgeInfo> list)
批量更新边。通过边id更新边。 结果按传入顺序构成集合,集合中包含更新后的边信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.EDITOR
- 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()
方法判断操作是否失败。角色:
RoleType.EDITOR
- Parameters:
list
- 参数集合,不能为空。- Returns:
List
批量操作结果集。包含新增后的边信息和错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null,fromPk、fromType、toPk、toType或type值为空,property输入的属性类型不支持时将抛出异常。DatabaseException
- 数据库内部异常。
-
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来决定是否新增无属性的起始点和终止点。 如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。(集合属性会自动追加)角色:
RoleType.EDITOR
- 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
- 属性名在边类型中没有定义时抛出异常。ValueFormatException
- 属性值类型错误时抛出异常。DatabaseException
- 数据库内部异常。
-
updateEdgeByVertexPk
default Iterator<Edge> updateEdgeByVertexPk(String fromPk, String fromType, String toPk, String toType, String type, Map<String,Object> property)
更新边。通过起始点pk和终止点pk修改边。(集合属性会自动追加) 找不到起始点和终止点时报错。 如果起始点到终止点不存在边报错。角色:
RoleType.EDITOR
- Parameters:
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。type
- 边类型,不能为空。property
- 边属性。- Returns:
Edge
更新后的边信息迭代器- Throws:
ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空、property输入的属性类型不支持时将抛出异常。TypeNotFoundException
- 边类型不存在时抛出异常。DatabaseException
- 数据库内部异常。EdgeNotFoundException
- 当没有查询到边时抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时抛出异常。ValueFormatException
- 属性值类型错误时抛出异常。
-
updateEdgeByVertexPk
Iterator<Edge> updateEdgeByVertexPk(String fromPk, String fromType, String toPk, String toType, String type, Map<String,Object> property, boolean isMerge)
更新边。通过起始点pk和终止点pk修改边。 找不到起始点和终止点时报错。 如果起始点到终止点不存在边报错。角色:
RoleType.EDITOR
- Parameters:
fromPk
- 起始点pk,不能为空。fromType
- 起始点类型,不能为空。toPk
- 终止点pk,不能为空。toType
- 终止点类型,不能为空。type
- 边类型,不能为空。property
- 边属性。isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。- Returns:
Edge
更新后的边信息迭代器- Throws:
ParamException
- 参数格式不正确,当fromPk、fromType、toPk、toType或type值为空、property输入的属性类型不支持时将抛出异常。TypeNotFoundException
- 边类型不存在时抛出异常。DatabaseException
- 数据库内部异常。EdgeNotFoundException
- 当没有查询到边时抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时抛出异常。ValueFormatException
- 属性值类型错误时抛出异常。
-
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来决定是否新增无属性的起始点和终止点。 如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。角色:
RoleType.EDITOR
- 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
- 属性名在边类型中没有定义时抛出异常。ValueFormatException
- 属性值类型错误时抛出异常。DatabaseException
- 数据库内部异常。
-
upsertEdgesByVertexPk
List<ResponseItem<List<Edge>>> upsertEdgesByVertexPk(List<EdgeInfoByVertexPk> list)
批量新增或更新边。通过起始点pk和终止点pk新增或修改边。 找不到起始点和终止点时会通过createFrom和createTo决定是否新增无属性的起始点和终止点。 如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。 结果按传入顺序构成集合,集合中包含新增或更新后的边信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.EDITOR
- 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()
方法判断操作是否失败。角色:
RoleType.EDITOR
- 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来新增或修改边。 如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。(集合属性会自动追加)角色:
RoleType.EDITOR
- Parameters:
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。property
- 边属性。- Returns:
Iterator
新增或更新后的边信息。- Throws:
ParamException
- 参数格式不正确,当fromId、toId小于0或type值为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型、property输入的属性类型不支持时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
upsertEdgeByVertexId
Iterator<Edge> upsertEdgeByVertexId(long fromId, long toId, String type, Map<String,Object> property, boolean isMerge)
新增或更新边。通过起始点id和终止点id来新增或修改边。 如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。角色:
RoleType.EDITOR
- 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
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。
-
updateEdgeByVertexId
default Iterator<Edge> updateEdgeByVertexId(long fromId, long toId, String type, Map<String,Object> property)
更新边。通过起始点id和终止点id来修改边。 如果起始点到终止点不存在边报错。(集合属性会自动追加)角色:
RoleType.EDITOR
- Parameters:
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。type
- 边类型,不能为空。property
- 边属性。- Returns:
Iterator
更新后的边信息。- Throws:
ParamException
- 参数格式不正确,当fromId、toId小于0或type值为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- 起始点和终止点的类型不是作为边类型的起始类型和终止类型、property输入的属性类型不支持时将抛出异常。VertexNotFoundException
- 起始点或终止点在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。
-
updateEdgeByVertexId
Iterator<Edge> updateEdgeByVertexId(long fromId, long toId, String type, Map<String,Object> property, boolean isMerge)
更新边。通过起始点id和终止点id来修改边。 如果起始点到终止点不存在边报错。角色:
RoleType.EDITOR
- 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
- 属性名在边类型中没有定义时将抛出异常。ValueFormatException
- 属性值类型错误时将抛出异常。DatabaseException
- 数据库内部异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。
-
upsertEdgesByVertexId
List<ResponseItem<List<Edge>>> upsertEdgesByVertexId(List<EdgeInfoByVertexId> list)
批量新增或更新边。通过起始点id和终止点id新增或修改边。 如果起始点到终止点不存在边,则新增一条边。如果存在一条或多条边,则都会比较属性值。 结果按传入顺序构成集合,集合中包含新增或更新后的边信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.EDITOR
- 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()
方法判断操作是否失败。角色:
RoleType.EDITOR
- Parameters:
list
- 参数集合,不能为空。- Returns:
List
批量操作结果集。包含更新后的边信息和错误信息。- Throws:
ParamException
- 参数格式不正确,当fromId、toId小于0或type值为空、property输入的属性类型不支持时时将抛出异常。DatabaseException
- 数据库内部异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。
-
deleteEdge
void deleteEdge(String edgeId)
删除边。通过边id删除边。角色:
RoleType.EDITOR
- Parameters:
edgeId
- 边id,不能为空。- Throws:
ParamException
- 参数格式不正确,当边id格式不正确时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveEdgesByType
Iterator<Edge> retrieveEdgesByType(String type)
查询边类型下所有边。迭代获取某个类型的所有边信息。角色:
RoleType.READER
- Parameters:
type
- 边类型,不能为空。- Returns:
Iterator
边信息迭代器。- Throws:
ParamException
- 参数格式不正确,当类型为空时将抛出异常。TypeNotFoundException
- 边类型不存在时抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveAllEdges
Iterator<Edge> retrieveAllEdges()
查询所有边。迭代获取所有类型的所有边。角色:
RoleType.READER
- Returns:
Iterator
边信息迭代器。- Throws:
DatabaseException
- 数据库内部异常。
-
putPropertyValue
default void putPropertyValue(boolean isVertex, Object id, String propertyName, Object value)
更新属性。更新某个点或边的某属性值。(集合属性会自动追加)角色:
RoleType.EDITOR
- Parameters:
isVertex
- 点类型填true,边类型填false,isVertex需要跟id对应。id
- 点/边的id,不能为空。propertyName
- 属性名,不能为空。value
- 属性值,不能为空。- Throws:
ParamException
- 参数格式不正确,当点或边的id格式不正确、属性名为空或属性值为空时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在对应类型中不存在时将抛出异常。ValueFormatException
- value类型转换失败时将抛出异常。DatabaseException
- 数据库内部异常。
-
putPropertyValue
void putPropertyValue(boolean isVertex, Object id, String propertyName, Object value, boolean isMerge)
更新属性。更新某个点或边的某属性值。角色:
RoleType.EDITOR
- Parameters:
isVertex
- 点类型填true,边类型填false,isVertex需要跟id对应。id
- 点/边的id,不能为空。propertyName
- 属性名,不能为空。value
- 属性值,不能为空。isMerge
- 集合属性追加(true)或覆盖(false)。不能为空。- Throws:
ParamException
- 参数格式不正确,当点或边的id格式不正确、属性名为空或属性值为空时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在对应类型中不存在时将抛出异常。ValueFormatException
- value类型转换失败时将抛出异常。DatabaseException
- 数据库内部异常。
-
removePropertyValue
void removePropertyValue(boolean isVertex, Object id, String propertyName)
删除属性。角色:
RoleType.EDITOR
- Parameters:
isVertex
- 点/边类型填true,边类型填false,isVertex需要跟id对应。id
- 点/边id,不能为空。propertyName
- 属性名,不能为空。- Throws:
ParamException
- 参数格式不正确,当点/边id格式不正确、属性名为空时将抛出异常。VertexNotFoundException
- 点在图中不存在时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在对应点/边中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
getVertexCount
long getVertexCount(String type)
查询点个数。查询当前类型点总数。角色:
RoleType.READER
- Parameters:
type
- 点类型,不能为空。- Returns:
- long 点个数
- Throws:
ParamException
- 参数格式不正确,当类型为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
getAllVertexCount
long getAllVertexCount()
查询点个数。查询图中点总数。角色:
RoleType.READER
- Returns:
- long 点个数
- Throws:
DatabaseException
- 数据库内部异常。
-
getEdgeCount
long getEdgeCount(String type)
查询边个数。查询当前类型边总数。角色:
RoleType.READER
- Parameters:
type
- 边类型,不能为空。- Returns:
- long 边个数
- Throws:
ParamException
- 参数格式不正确,当类型为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
getAllEdgeCount
long getAllEdgeCount()
查询边个数。查询图中边总数。角色:
RoleType.READER
- 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)
查询最短路径。返回一条最短路径的所有边。角色:
RoleType.READER
- 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)
查询最短路径。返回一条最短路径的所有边。角色:
RoleType.READER
- 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查询。角色:
RoleType.READER
- 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查询。角色:
RoleType.READER
- 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查询。角色:
RoleType.READER
- 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查询。角色:
RoleType.READER
- 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查询。角色:
RoleType.READER
- 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查询。角色:
RoleType.READER
- 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
- 数据库内部异常。
-
retrieveEdgeByVertexId
Iterator<Edge> retrieveEdgeByVertexId(long srcId, long dstId, Set<String> edgeTypeFilter, Direction direction, VisitCondition edgeCondition, boolean getLoop)
查询邻居。通过起始点id和终止点id查询。角色:
RoleType.READER
- Parameters:
srcId
- 起始点id,不能小于0。dstId
- 终止点id,不能小于0。edgeTypeFilter
- 边类型的过滤条件。只会返回满足参数中边类型的边。填null不参与计算。direction
- 方向,不能为null。edgeCondition
- 边条件,填null不参与计算。getLoop
- true计算自环,false不计算自环。- Returns:
Iterator
边信息迭代器。- Throws:
ParamException
- 参数格式不正确,当起始点或终止点id小于0、查询方向为null时将抛出异常。DatabaseException
- 数据库内部异常。
-
getDegree
default EdgeDegreeInfo getDegree(long id)
查询点的degree信息。角色:
RoleType.READER
- 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信息。角色:
RoleType.READER
- 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查询。角色:
RoleType.READER
- 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
- 数据库内部异常。
-
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查询角色:
RoleType.READER
- 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
- 数据库内部异常。
-
bfsWithResultType
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)
通过bfs查询,获取满足resultTypeSet的邻居点的 id 集合。角色:
RoleType.READER
- Parameters:
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
- 最后的结果集中符合条件的点类型- Returns:
- 经过 resultTypeSet 过滤的 邻居点的 id 集合。
-
deleteVertexes
List<String> deleteVertexes(List<Long> list)
批量删除点。通过点id删除点。如果点不存在或删除失败,则会返回异常结果集。 结果按传入顺序构成集合,集合中包含成功信息和错误信息。角色:
RoleType.EDITOR
- Parameters:
list
- 点id集合,不能为空。- Returns:
List
批量操作结果集。点删除成功时返回null,点删除失败时返回错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、id格式不正确时将抛出异常。DatabaseException
- 数据库内部异常。
-
deleteVertexesByPk
List<String> deleteVertexesByPk(List<VertexInfoByPk> list)
批量删除点。通过点pk和type删除点。如果不存在或删除失败,则会返回异常结果集。 结果按传入顺序构成集合,集合中包含成功信息和错误信息。角色:
RoleType.EDITOR
- Parameters:
list
- 参数集合,不能为空。- Returns:
List
批量操作结果集。点删除成功时返回null,点删除失败时返回错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk和type不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
deleteEdges
List<String> deleteEdges(List<String> list)
批量删除边。通过边id删除边。如果不存在或删除失败,则会返回异常结果集。 结果按传入顺序构成集合,集合中包含成功信息和错误信息。角色:
RoleType.EDITOR
- Parameters:
list
- 边id集合,不能为空。- Returns:
List
批量操作结果集。边删除成功时返回null,边删除失败时返回错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、边id格式不正确时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveVertexes
List<ResponseItem<Vertex>> retrieveVertexes(List<Long> list)
批量查询点。通过点id查询点信息。不存在返回空集合 结果按传入顺序构成集合,集合中包含查询的点信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.READER
- Parameters:
list
- 点id列表,不能为空。- Returns:
List
批量操作结果集。包含查询的点信息和错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、点id格式不正确时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveVertexesByPk
List<ResponseItem<Vertex>> retrieveVertexesByPk(List<VertexInfoByPk> list)
批量查询点。通过点pk和type查询点信息。不存在返回空集合 结果按传入顺序构成集合,集合中包含查询的点信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.READER
- Parameters:
list
- 点id集合,不能为空。- Returns:
List
批量操作结果集。包含查询的点信息和错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、pk和type为空时将抛出异常。DatabaseException
- 数据库内部异常。
-
retrieveEdges
List<ResponseItem<Edge>> retrieveEdges(List<String> list)
批量查询边。通过边id查询边。不存在返回空集合 结果按传入顺序构成集合,集合中包含查询的边信息和错误信息。通过ResponseItem.isError()
方法判断操作是否失败。角色:
RoleType.READER
- Parameters:
list
- 边id集合,不能为空。- Returns:
List
批量操作结果集。包含查询的边信息和错误信息。- Throws:
ParamException
- 参数格式不正确。当参数集合为空,以及集合中存在null、边id格式不正确时将抛出异常。DatabaseException
- 数据库内部异常。
-
deleteEdgeByVertexId
void deleteEdgeByVertexId(long fromId, long toId, int edgeLimit)
删除边。通过起始点id和终止点id,删除两点之间的边。角色:
RoleType.EDITOR
- Parameters:
fromId
- 起始点id,不能小于0。toId
- 终止点id,不能小于0。edgeLimit
- 删除边数,<=0代表全量,>0则删指定个数。- Throws:
ParamException
- 参数格式不正确,当起始点id和终止点id小于0时将抛出异常。DatabaseException
- 数据库内部异常。
-
isEnable
boolean isEnable() throws Exception
验证驱动对象实例是否存活且可用。- Returns:
- true可用,false异常
- Throws:
Exception
-
executeCypherTaskAsyncForStatementResult
long executeCypherTaskAsyncForStatementResult(String cypher, Map<String,com.graphdbapi.driver.v1.Value> parameters) throws Exception
异步执行cypher查询。角色:
RoleType.READER
- Parameters:
cypher
- 查询语句,不能为空。parameters
- 查询可用的参数- Returns:
String
异步cypher任务id- Throws:
ParamException
- 参数格式不正确,当cypher为空时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。Exception
-
executeCypherTaskAsyncForStatementResult
long executeCypherTaskAsyncForStatementResult(String cypher) throws Exception
异步执行cypher查询。角色:
RoleType.READER
- Parameters:
cypher
- 查询语句,不能为空。- Returns:
String
异步cypher任务id- Throws:
ParamException
- 参数格式不正确,当cypher为空时将抛出异常。DatabaseException
- 数据库内部异常,在cypher语法错误时将抛出异常。Exception
-
getCypherTaskAsyncForStatementResultStatus
CypherTaskStatus getCypherTaskAsyncForStatementResultStatus(long cypherTaskId) throws Exception
获取可视化专用 cypher 异步查询任务的执行状态。- Parameters:
cypherTaskId
- 异步cypher任务id,不能为空。- Returns:
CypherTaskStatus
任务状态。- Throws:
Exception
-
getCypherTaskStatementResult
com.graphdbapi.driver.v1.StatementResult getCypherTaskStatementResult(long cypherTaskId) throws Exception
获取cypher异步查询的结果迭代器。- Parameters:
cypherTaskId
- 异步cypher任务id,不能为空。- Returns:
StatementResult
cypher执行结果迭代器。- Throws:
com.graphdbapi.driver.v1.exceptions.AsynTaskNotExist
- 任务不存在时抛出。com.graphdbapi.driver.v1.exceptions.AsynTaskNotCompleted
- 任务未完成时抛出。Exception
-
searchVertexesByIndex
Iterator<Long> searchVertexesByIndex(String typeName, String propName, Object data, int skip, int limit)
通过索引,查找点数据,返回点Id角色:
RoleType.READER
- Parameters:
typeName
- 类型名propName
- 属性名data
- 查找值skip
- 跳过limit
- 限制返回数量- Returns:
- 点id迭代器
-
-