Package com.graphdbapi.driver
Interface GraphSchema
-
public interface GraphSchema
图schema操作类,不支持事务。
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
createCombinedEdgeType(String type, String fromType, String toType)
为指定边类型创建从from到to的CombinedEdgeType集合。default void
createEdgeType(String type, String fromType, String toType, boolean direct, boolean allowRepeat, String combineKey, Map<String,PropertyType> classMap)
添加边类型。为图中新增一个边类型,并创建从from到to的CombinedEdgeType。default void
createEdgeType(String type, String fromType, String toType, boolean direct, String combineKey, Map<String,PropertyType> classMap)
添加边类型。为图中新增一个基于 combineKey 进行去重的边类型,为空表示基于边类型进行去重,并创建从from到to的CombinedEdgeType。void
createEdgeType(String type, List<CombinedEdgeType> combinedEdgeTypes, boolean direct, boolean allowRepeat, String combineKey, Map<String,PropertyType> classMap)
添加边类型。为图中新增一个边类型,并创建从from到to的CombinedEdgeType集合。default void
createEdgeType(String type, List<CombinedEdgeType> combinedEdgeTypes, boolean direct, String combineKey, Map<String,PropertyType> classMap)
添加边类型。为图中新增一个基于 combineKey 进行去重的边类型,为空表示基于边类型进行去重,并创建从from到to的CombinedEdgeType。void
createProperty(String type, boolean isVertex, String propertyName, boolean isIndex, PropertyType propertyType)
为某个类型增加属性列。void
createPropIndex(String type, boolean isVertex, String property)
为某个类型的某个属性添加简单索引。void
createVertexType(String type, String pkName, Map<String,PropertyType> classMap)
添加点类型。为图新增一个点类型。void
dropCombinedEdgeType(String type, String fromType, String toType)
删除边类型中的一对起止点类型。void
dropEdgeType(String type)
删除边类型。删除图中已存在的一个边类型。void
dropProperty(String type, boolean isVertex, String propertyName)
删除某个类型的某个属性。void
dropPropIndex(String type, boolean isVertex, String property)
删除某个类型的某个属性索引。void
dropVertexType(String type)
删除点类型。删除图中已存在的一个点类型。void
editDirect(String type, boolean direct)
更新某个边类型的方向。无向or有向。void
editGraphDesc(String desc)
修改图描述void
editPropertyDesc(String type, boolean isVertex, String propName, String desc)
修改属性描述void
editTypeDesc(String type, boolean isVertex, String desc)
修改类型描述List<CombinedEdgeType>
getCombinedEdgeType(String type)
根据边类型获取起始点和终止点类型名。boolean
getEdgeDirect(String type)
获取某个边类型的方向。Collection<String>
getEdgeTypes()
获取所有的边类型名。String
getGraphDesc()
获取图描述String
getPropertyDesc(String type, boolean isVertex, String propName)
获取属性描述Map<String,PropertyType>
getPropertyKeys(String type, boolean isVertex)
获取某个点/边类型下的属性名和属性类型。String
getPropertyPk(String type)
获取某个点类型下的外部唯一标识。String
getTypeDesc(String type, boolean isVertex)
获取类型描述Collection<String>
getVertexTypes()
获取所有的点类型名。void
renamePropertyName(String type, boolean isVertex, String oldPropName, String newPropName)
更新某个类型的某个属性名。void
renameTypeName(String type, boolean isVertex, String newType)
更新某个类型名。
-
-
-
Method Detail
-
createVertexType
void createVertexType(String type, String pkName, Map<String,PropertyType> classMap)
添加点类型。为图新增一个点类型。- Parameters:
type
- 点类型,不能为空。pkName
- 外部唯一标识属性名,不能为空。classMap
- 属性类型的映射,其中key是属性名,value是属性类型,允许为空。- Throws:
ParamException
- 参数格式不正确,当类型为空、外部唯一标识属性名为空、属性名为空时将抛出异常。TypeFoundException
- 边类型在图中已存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
dropVertexType
void dropVertexType(String type)
删除点类型。删除图中已存在的一个点类型。- Parameters:
type
- 点类型,不能为空。- Throws:
ParamException
- 参数格式不正确,当类型为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
getVertexTypes
Collection<String> getVertexTypes()
获取所有的点类型名。- Returns:
- 所有点的类型名集合
- Throws:
DatabaseException
- 数据库内部异常。
-
createEdgeType
default void createEdgeType(String type, String fromType, String toType, boolean direct, boolean allowRepeat, String combineKey, Map<String,PropertyType> classMap)
添加边类型。为图中新增一个边类型,并创建从from到to的CombinedEdgeType。- Parameters:
type
- 边类型,不能为空。fromType
- 起始点类型名,不能为空。toType
- 终止点类型名,不能为空。direct
- 边的方向allowRepeat
- 是否允许边重复。true允许重复,即不开启边去重。false不允许重复,即开启边去重。边去重会影响导入性能,慎重开启。combineKey
- 基于属性进行去重,为空表示基于边类型进行去重,只有在 allowRepeat 为 false 时有效。 当allowRepeat 为 true 时,填nullclassMap
- 属性类型的映射,其中key是属性名,value是属性类型,属性类型不能为空。- Throws:
ParamException
- 参数格式不正确,当边类型名为空、起始点类型名为空、终止点类型名为空或属性类型为空时将抛出异常, combineKey在classMap中不存在时将抛出异常。TypeFoundException
- 边类型在图中已存在时将抛出异常。TypeNotFoundException
- 起始点类型或终止点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
createEdgeType
default void createEdgeType(String type, String fromType, String toType, boolean direct, String combineKey, Map<String,PropertyType> classMap)
添加边类型。为图中新增一个基于 combineKey 进行去重的边类型,为空表示基于边类型进行去重,并创建从from到to的CombinedEdgeType。- Parameters:
type
- 边类型,不能为空。fromType
- 起始点类型名,不能为空。toType
- 终止点类型名,不能为空。direct
- 边的方向combineKey
- 基于属性进行去重,为空表示基于边类型进行去重。classMap
- 属性类型的映射,其中key是属性名,value是属性类型,属性类型不能为空。- Throws:
ParamException
- 参数格式不正确,当边类型名为空、起始点类型名为空、终止点类型名为空、属性类型为空、 combineKey在classMap中不存在时将抛出异常。TypeFoundException
- 边类型在图中已存在时将抛出异常。TypeNotFoundException
- 起始点类型或终止点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
createEdgeType
default void createEdgeType(String type, List<CombinedEdgeType> combinedEdgeTypes, boolean direct, String combineKey, Map<String,PropertyType> classMap)
添加边类型。为图中新增一个基于 combineKey 进行去重的边类型,为空表示基于边类型进行去重,并创建从from到to的CombinedEdgeType。- Parameters:
type
- 边类型,不能为空。combinedEdgeTypes
- 起始点类型和终止点类型组合集合,不能为空。direct
- 边的方向combineKey
- 基于属性进行去重,为空表示基于边类型进行去重。classMap
- 属性类型的映射,其中key是属性名,value是属性类型,属性类型不能为空。- Throws:
ParamException
- 参数格式不正确,当边类型名为空、起始点类型名为空、终止点类型名为空、属性类型为空、 combineKey在classMap中不存在时将抛出异常。TypeFoundException
- 边类型在图中已存在时将抛出异常。TypeNotFoundException
- 起始点类型或终止点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
createEdgeType
void createEdgeType(String type, List<CombinedEdgeType> combinedEdgeTypes, boolean direct, boolean allowRepeat, String combineKey, Map<String,PropertyType> classMap)
添加边类型。为图中新增一个边类型,并创建从from到to的CombinedEdgeType集合。- Parameters:
type
- 边类型,不能为空。combinedEdgeTypes
- 起始点类型和终止点类型组合集合,不能为空。direct
- 边的方向allowRepeat
- 是否允许边重复。true允许重复,即不开启边去重。false不允许重复,即开启边去重。边去重会影响导入性能,慎重开启。 。combineKey
- 基于属性进行重复,为空表示基于边类型进行重复,只有在 allowRepeat 为 false 时有效。 当allowRepeat 为 true 时,填nullclassMap
- 属性类型的映射,其中key是属性名,value是属性类型,属性类型不能为空。- Throws:
ParamException
- 参数格式不正确,当边类型名为空、起始点类型名为空、终止点类型名为空、属性类型为空、 allowRepeat为true时combineKey不为null或combineKey在classMap中不存在时将抛出异常。TypeFoundException
- 边类型在图中已存在时将抛出异常。TypeNotFoundException
- 起始点类型或终止点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
dropEdgeType
void dropEdgeType(String type)
删除边类型。删除图中已存在的一个边类型。- Parameters:
type
- 边类型,不能为空。- Throws:
ParamException
- 参数格式不正确,当边类型为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
dropCombinedEdgeType
void dropCombinedEdgeType(String type, String fromType, String toType)
删除边类型中的一对起止点类型。例:存在以下关系 人--关注-->公司 人--关注-->人 若:type为关注,fromType为人,toType为公司 则:人--关注-->公司(人到公司的关注关系被删除)
- Parameters:
type
- 边类型,不能为空。fromType
- 起始点类型,不能为空。toType
- 终止点类型,不能为空。- Throws:
ParamException
- 参数格式不正确,当边类型为空、起始点类型为空或终止点类型为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。TypeErrorException
- from到to的映射不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
getEdgeTypes
Collection<String> getEdgeTypes()
获取所有的边类型名。- Returns:
- 所有边的类型名集合
- Throws:
DatabaseException
- 数据库内部异常。
-
createProperty
void createProperty(String type, boolean isVertex, String propertyName, boolean isIndex, PropertyType propertyType)
为某个类型增加属性列。- Parameters:
type
- 点/边类型,不能为空。isVertex
- 点类型填true,边类型填false,isVertex需要跟type对应。propertyName
- 属性名,不能为空。isIndex
- 是否要加索引。true添加索引,false不添加索引propertyType
-PropertyType
属性类型,不能为空。- Throws:
ParamException
- 参数格式不正确,当类型为空、属性名为空、属性类型为空时将抛出异常。TypeNotFoundException
- 点/边类型在图中不存在时将抛出异常。PropertyFoundException
- 属性名在对应类型中已存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
dropProperty
void dropProperty(String type, boolean isVertex, String propertyName)
删除某个类型的某个属性。- Parameters:
type
- 点/边类型,不能为空。isVertex
- 点类型填true,边类型填false,isVertex需要跟type对应。propertyName
- 属性名,不能为空。- Throws:
ParamException
- 参数格式不正确,当类型为空、属性名为空、属性类型为空时将抛出异常。TypeNotFoundException
- 点/边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在对应类型中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
getPropertyKeys
Map<String,PropertyType> getPropertyKeys(String type, boolean isVertex)
获取某个点/边类型下的属性名和属性类型。- Parameters:
type
- 点/边类型,不能为空。isVertex
- 点类型为true,边类型为false,isVertex需要跟type对应。- Returns:
- 该类型所有属性的映射,其中key是属性名,value是属性类型
- Throws:
ParamException
- 参数格式不正确,当类型为空时将抛出异常。TypeNotFoundException
- 点/边类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
getPropertyPk
String getPropertyPk(String type)
获取某个点类型下的外部唯一标识。- Parameters:
type
- 点类型,不能为空。- Returns:
String
点类型下的外部唯一标识- Throws:
ParamException
- 参数格式不正确,当类型为空时将抛出异常。TypeNotFoundException
- 点类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
editDirect
void editDirect(String type, boolean direct)
更新某个边类型的方向。无向or有向。- Parameters:
type
- 边类型,不能为空。direct
- 方向- Throws:
ParamException
- 参数格式不正确,当边类型为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
getEdgeDirect
boolean getEdgeDirect(String type)
获取某个边类型的方向。- Parameters:
type
- 边类型,不能为空。- Returns:
- true有向边, false无向边
- Throws:
ParamException
- 参数格式不正确,当类型为空时将抛出异常。TypeNotFoundException
- 边类型在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
createCombinedEdgeType
void createCombinedEdgeType(String type, String fromType, String toType)
为指定边类型创建从from到to的CombinedEdgeType集合。- Parameters:
type
- 边类型,不能为空。fromType
- 起始点类型名,不能为空。toType
- 终止点类型名,不能为空。- Throws:
ParamException
- 参数格式不正确,当边类型名为空、起始点类型名为空、终止点类型名为空时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。TypeNotFoundException
- 起始点类型或终止点类型在图中不存在时将抛出异常。TypeErrorException
- from到to的映射已存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
getCombinedEdgeType
List<CombinedEdgeType> getCombinedEdgeType(String type)
根据边类型获取起始点和终止点类型名。- Parameters:
type
- 边类型,不能为空。- Returns:
- 起始点和终止点类型名组合列表
- Throws:
ParamException
- 参数格式不正确,当边类型为空时将抛出异常。EdgeNotFoundException
- 边在图中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
renameTypeName
void renameTypeName(String type, boolean isVertex, String newType)
更新某个类型名。- Parameters:
type
- 点/边类型,不能为空。isVertex
- 点类型填true,边类型填false,isVertex需要跟type对应。newType
- 新类型名,不能为空。- Throws:
ParamException
- 参数格式不正确,当类型为空、新类型名为空时将抛出异常。TypeNotFoundException
- 点/边类型在图中不存在时将抛出异常。TypeFoundException
- 新类型名在图中已存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
renamePropertyName
void renamePropertyName(String type, boolean isVertex, String oldPropName, String newPropName)
更新某个类型的某个属性名。- Parameters:
type
- 点/边类型,不能为空。isVertex
- 点类型填true,边类型填false,isVertex需要跟type对应。oldPropName
- 原属性名,不能为空。newPropName
- 新属性名,不能为空。- Throws:
ParamException
- 参数格式不正确,当点/边类型为空、原属性名为空、新属性名为空时将抛出异常。TypeNotFoundException
- 点/边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 原属性名在对应类型中不存在时将抛出异常。PropertyFoundException
- 新属性名在对应类型中已存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
createPropIndex
void createPropIndex(String type, boolean isVertex, String property)
为某个类型的某个属性添加简单索引。- Parameters:
type
- 点/边类型,不能为空。isVertex
- 点类型填true,边类型填falseproperty
- 属性名,不能为空。- Throws:
ParamException
- 参数格式不正确,当类型为空、属性名为空TypeNotFoundException
- 点/边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在对应类型中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
dropPropIndex
void dropPropIndex(String type, boolean isVertex, String property)
删除某个类型的某个属性索引。- Parameters:
type
- 点/边类型,不能为空。isVertex
- 点类型填true,边类型填false,isVertex需要跟type对应。property
- 属性名- Throws:
ParamException
- 参数格式不正确,当类型为空、属性名为空时将抛出异常。TypeNotFoundException
- 点/边类型在图中不存在时将抛出异常。PropertyNotFoundException
- 属性名在对应类型中不存在时将抛出异常。DatabaseException
- 数据库内部异常。
-
editPropertyDesc
void editPropertyDesc(String type, boolean isVertex, String propName, String desc)
修改属性描述- Parameters:
type
- 点边类型isVertex
- 是否为点propName
- 属性名desc
- 描述信息
-
getPropertyDesc
String getPropertyDesc(String type, boolean isVertex, String propName)
获取属性描述- Parameters:
type
- 点边类型isVertex
- 是否为点propName
- 属性名- Returns:
String
属性描述
-
editTypeDesc
void editTypeDesc(String type, boolean isVertex, String desc)
修改类型描述- Parameters:
type
- 点边类型isVertex
- 是否为点desc
- 描述信息
-
getTypeDesc
String getTypeDesc(String type, boolean isVertex)
获取类型描述- Parameters:
type
- 点边类型isVertex
- 是否为点- Returns:
String
属性描述
-
editGraphDesc
void editGraphDesc(String desc)
修改图描述- Parameters:
desc
- 描述信息
-
-