showProperty()
方法及相关类:
def showProperty(self,
requestConfig: ULTIPA_REQUEST.RequestConfig = ULTIPA_REQUEST.RequestConfig()
) -> ULTIPA_RESPONSE.ResponseListProperty
示例:获取 test 图集的所有属性信息
from ultipa import Connection, UltipaConfig, RequestConfig
# 创建名为 conn 的连接并使用 default 图集,此部分代码省略
req = conn.showProperty(requestConfig = RequestConfig("test"))
print(req.toJSON())
getProperty()
方法及相关类:
def getProperty(self,
request: ULTIPA_REQUEST.GetProperty,
requestConfig: ULTIPA_REQUEST.RequestConfig = ULTIPA_REQUEST.RequestConfig()
) -> ULTIPA_RESPONSE.ResponseGetProperty
class GetProperty:
def __init__(self, type: ULTIPA.DBType, schema: str = None)
示例:获取 test 图集的所有边属性的信息
from ultipa import Connection, UltipaConfig, RequestConfig
from ultipa import ULTIPA_REQUEST, ULTIPA
# 创建名为 conn 的连接并使用 default 图集,此部分代码省略
req = conn.getProperty(
ULTIPA_REQUEST.GetProperty(ULTIPA.DBType.DBEDGE),
RequestConfig("test"))
req.Print()
示例:获取 test 图集的点 schema 'customer' 的属性信息
from ultipa import Connection, UltipaConfig, RequestConfig
from ultipa import ULTIPA_REQUEST, ULTIPA
# 创建名为 conn 的连接并使用 default 图集,此部分代码省略
req = conn.getProperty(
ULTIPA_REQUEST.GetProperty(ULTIPA.DBType.DBNODE, "customer"),
RequestConfig("test"))
req.Print()
createProperty()
方法及相关类:
def createProperty(self,
request: ULTIPA_REQUEST.CreateProperty,
requestConfig: ULTIPA_REQUEST.RequestConfig = ULTIPA_REQUEST.RequestConfig()
) -> ULTIPA_RESPONSE.UltipaResponse
class CreateProperty:
def __init__(self,
type: ULTIPA.DBType,
commonSchema: CommonSchema,
propertyType: ULTIPA.CreatePropertyType = ULTIPA.CreatePropertyType.PROPERTY_STRING,
description: str = ''
)
class CommonSchema:
def __init__(self, schema: str, property: str)
示例:为图集 test 创建边属性 @transfer.amount,类型为浮点型,设置描述为 transaction amount
from ultipa import Connection, UltipaConfig, RequestConfig
from ultipa import ULTIPA_REQUEST, ULTIPA
# 创建名为 conn 的连接并使用 default 图集,此部分代码省略
req = conn.createProperty(
ULTIPA_REQUEST.CreateProperty(
ULTIPA.DBType.DBEDGE,
ULTIPA_REQUEST.CommonSchema("transfer", "amount"),
ULTIPA.CreatePropertyType.PROPERTY_FLOAT,
"transaction amount"
),
RequestConfig("test"))
req.Print()
alterProperty()
方法及相关类:
def alterProperty(self,
request: ULTIPA_REQUEST.AlterProperty,
requestConfig: ULTIPA_REQUEST.RequestConfig = ULTIPA_REQUEST.RequestConfig()
) -> ULTIPA_RESPONSE.UltipaResponse
class AlterProperty:
def __init__(self,
type: ULTIPA.DBType,
commonSchema: CommonSchema,
newName: str,
newDescription: str = ''
)
class CommonSchema:
def __init__(self, schema: str, property: str)
示例:将图集 test 的边属性 @transfer.type 改名为 TYPE,描述改为 transfer type
from ultipa import Connection, UltipaConfig, RequestConfig
from ultipa import ULTIPA_REQUEST, ULTIPA
# 创建名为 conn 的连接并使用 default 图集,此部分代码省略
req = conn.alterProperty(
ULTIPA_REQUEST.AlterProperty(
ULTIPA.DBType.DBEDGE,
ULTIPA_REQUEST.CommonSchema("transfer", "type"),
"TYPE",
"transfer type"
),
RequestConfig("test"))
req.Print()
dropProperty()
方法及相关类:
def dropProperty(self,
request: ULTIPA_REQUEST.DropProperty,
requestConfig: ULTIPA_REQUEST.RequestConfig = ULTIPA_REQUEST.RequestConfig()
) -> ULTIPA_RESPONSE.UltipaResponse
class DropProperty:
def __init__(self, type: ULTIPA.DBType, commonSchema: CommonSchema)
class CommonSchema:
def __init__(self, schema: str, property: str)
示例:删除图集 test 的点属性 @card.level
from ultipa import Connection, UltipaConfig, RequestConfig
from ultipa import ULTIPA_REQUEST, ULTIPA
# 创建名为 conn 的连接并使用 default 图集,此部分代码省略
req = conn.dropProperty(
ULTIPA_REQUEST.DropProperty(
ULTIPA.DBType.DBNODE,
ULTIPA_REQUEST.CommonSchema("card", "level")
),
RequestConfig("test"))
req.Print()