showAllProperty()
方法及相关接口:
showAllProperty(req?: RequestType.ListAllProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<ResponseType.AllProperty>>
interface ListAllProperty {}
示例:获取test图集的属性列表
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接并使用default图集,此部分代码省略
let resp = await conn.showAllProperty(
{},
{ graphSetName: "test" }
);
console.log(resp.data?.node);
console.log(resp.data?.edge);
};
sdkUsage();
showProperty()
方法及相关接口:
showProperty(isNode: boolean,
req?: RequestType.ListProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<ResponseType.Property[]>>
interface ListProperty {
schema?: string;
}
示例:获取test图集的点schema customer和边schema transfer的属性列表
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接并使用default图集,此部分代码省略
let resp = await conn.showProperty(
true,
{ schema: "customer" },
{ graphSetName: "test" },
);
console.log(resp.data);
resp = await conn.showProperty(
false,
{ schema: "transfer" },
{ graphSetName: "test" },
);
console.log(resp.data);
};
sdkUsage();
showNodeProperty() | showEdgeProperty()
方法及相关接口:
showNodeProperty(req?: RequestType.ListProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<ResponseType.Property[]>>
showEdgeProperty(req?: RequestType.ListProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<ResponseType.Property[]>>
interface ListProperty {
schema?: string;
}
示例:获取test图集的点schema customer和边schema transfer的属性列表
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接并使用default图集,此部分代码省略
let resp = await conn.showNodeProperty(
{ schema: "customer" },
{ graphSetName: "test" },
);
console.log(resp.data);
resp = await conn.showEdgeProperty(
{ schema: "transfer" },
{ graphSetName: "test" },
);
console.log(resp.data);
};
sdkUsage();
createProperty()
方法及相关接口:
createProperty(isNode: boolean,
req: RequestType.CreateProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface CreateProperty {
name: string;
schema?: string;
type?: ULTIPA.PropertyType;
description?: string;
}
示例:为图集test创建点属性@customer.level和边属性@transfer.amount
import { ConnectionPool, ULTIPA } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接并使用default图集,此部分代码省略
let resp = await conn.createProperty(
true,
{
name: "level",
schema: "customer",
type: ULTIPA.PropertyType.PROPERTY_INT32,
description: "customer level",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
resp = await conn.createProperty(
false,
{
name: "amount",
schema: "transfer",
type: ULTIPA.PropertyType.PROPERTY_FLOAT,
description: "customer level",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();
createNodeProperty() | createEdgeProperty()
方法及相关接口:
createNodeProperty(req: RequestType.CreateProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
createEdgeProperty(req: RequestType.CreateProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface CreateProperty {
name: string;
schema?: string;
type?: ULTIPA.PropertyType;
description?: string;
}
示例:为图集test创建点属性@customer.level和边属性@transfer.amount
import { ConnectionPool, ULTIPA } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接并使用default图集,此部分代码省略
let resp = await conn.createNodeProperty(
{
name: "level",
schema: "customer",
type: ULTIPA.PropertyType.PROPERTY_INT32,
description: "customer level",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
resp = await conn.createEdgeProperty(
{
name: "amount",
schema: "transfer",
type: ULTIPA.PropertyType.PROPERTY_FLOAT,
description: "customer level",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();
updateProperty()
方法及相关接口:
updateProperty(isNode: boolean,
req: RequestType.UpdateProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface UpdateProperty {
schema?: string;
name: string;
newName?: string;
newDesc?: string;
}
示例:对图集test的点属性@client.level以及边属性@transfer.type做适当修改
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接并使用default图集,此部分代码省略
let resp = await conn.updateProperty(
true,
{
name: "level",
schema: "client",
newName: "grade",
newDesc: "client grade",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
resp = await conn.updateProperty(
false,
{
name: "type",
schema: "transfer",
newName: "category",
newDesc: "transfer category",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();
updateNodeProperty() | updateEdgeProperty()
方法及相关接口:
updateNodeProperty(req: RequestType.UpdateProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
updateEdgeProperty(req: RequestType.UpdateProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface UpdateProperty {
schema?: string;
name: string;
newName?: string;
newDesc?: string;
}
示例:对图集test的点属性@client.level以及边属性@transfer.type做适当修改
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接并使用default图集,此部分代码省略
let resp = await conn.updateNodeProperty(
{
name: "level",
schema: "client",
newName: "grade",
newDesc: "client grade",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
resp = await conn.updateEdgeProperty(
{
name: "type",
schema: "transfer",
newName: "category",
newDesc: "transfer category",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();
deleteProperty()
方法及相关接口:
deleteProperty(isNode: boolean,
req: RequestType.DeleteProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface DeleteProperty {
schema?: string;
name: string;
}
示例:删除图集test的点属性@client.level以及边属性@transfer.type
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接并使用default图集,此部分代码省略
let resp = await conn.deleteProperty(
true,
{
name: "level",
schema: "client",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
resp = await conn.deleteProperty(
false,
{
name: "type",
schema: "transfer",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();
deleteNodeProperty() | deleteEdgeProperty()
方法及相关接口:
deleteNodeProperty(req: RequestType.DeleteProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
deleteEdgeProperty(req: RequestType.DeleteProperty,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface DeleteProperty {
schema?: string;
name: string;
}
示例:删除图集test的点属性@client.level以及边属性@transfer.type
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// 创建名为conn的连接并使用default图集,此部分代码省略
let resp = await conn.deleteNodeProperty(
{
name: "level",
schema: "client",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
resp = await conn.deleteEdgeProperty(
{
name: "type",
schema: "transfer",
},
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();