showSchema()
Method and interface:
showSchema(commonReq?: RequestType.RequestConfig): Promise<ULTIPA.Response<ResponseType.AllSchema>>
Example: Acquire all schemas of graphset 'test'
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// omit code of establishing server connection 'conn' using graphset 'default'
let resp = await conn.showSchema({ graphSetName: "test" });
console.log(resp.data?.nodeSchema);
console.log(resp.data?.edgeSchema);
};
sdkUsage();
showNodeSchema() | showEdgeSchema()
Method and interface:
showNodeSchema(req?: RequestType.GetSchema,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<ResponseType.Schema>>
showEdgeSchema(req?: RequestType.GetSchema,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<ResponseType.Schema>>
interface GetSchema {
name: string;
}
Example: Acquire node schema 'account' and edge schema 'transfer' of graphset 'test'
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// omit code of establishing server connection 'conn' using graphset 'default'
let resp = await conn.showNodeSchema({ name: "account" }, { graphSetName: "test" });
console.log(resp.data);
resp = await conn.showEdgeSchema({ name: "transfer" }, { graphSetName: "test" });
console.log(resp.data);
};
sdkUsage();
createSchema()
Method and interface:
createSchema(isNode: boolean,
req: RequestType.CreateSchema,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface CreateSchema {
name: string;
desc?: string;
}
Example: Create node schema 'card' and edge schema 'own' for graphset 'test'
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// omit code of establishing server connection 'conn' using graphset 'default'
let resp = await conn.createSchema(
true,
{ name: "card", desc: "bank card" },
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
resp = await conn.createSchema(
false,
{ name: "own", desc: "card owned by customer" },
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();
createNodeSchema() | createEdgeSchema()
Method and interface:
createNodeSchema(req: RequestType.CreateSchema,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
createEdgeSchema(req: RequestType.CreateSchema,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface CreateSchema {
name: string;
desc?: string;
}
Example: Create node schema 'card' and edge schema 'own' for graphset 'test'
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// omit code of establishing server connection 'conn' using graphset 'default'
let resp = await conn.createNodeSchema(
{ name: "card", desc: "bank card" },
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
resp = await conn.createEdgeSchema(
{ name: "own", desc: "customer owns card" },
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();
updateNodeSchema() | updateEdgeSchema()
Method and interface:
updateNodeSchema(req: RequestType.UpdateSchema,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
updateEdgeSchema(req: RequestType.UpdateSchema,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface UpdateSchema {
name: string;
newName?: string;
newDesc?: string;
}
Example: Modify node schema 'card' and edge schema 'own' of graphset 'test'
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// omit code of establishing server connection 'conn' using graphset 'default'
let resp = await conn.updateNodeSchema(
{ name: "card", newName: "account", newDesc: "bank account" },
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
resp = await conn.updateEdgeSchema(
{ name: "own", newName: "has", newDesc: "customer has card" },
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();
dropSchema()
Method and interface:
dropSchema(isNode: boolean,
req: RequestType.DeleteSchema,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface DeleteSchema {
name: string;
}
Example: Delete node schema 'account' and edge schema 'has' from graphset 'test'
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// omit code of establishing server connection 'conn' using graphset 'default'
let resp = await conn.dropSchema(
true,
{ name: "account" },
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
resp = await conn.dropSchema(
false,
{ name: "has" },
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();
dropNodeSchema() | dropEdgeSchema()
Method and interface:
dropNodeSchema(req: RequestType.DeleteSchema,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
dropEdgeSchema(req: RequestType.DeleteSchema,
commonReq?: RequestType.RequestConfig
): Promise<ULTIPA.Response<null>>
interface DeleteSchema {
name: string;
}
Example: Delete node schema 'account' and edge schema 'has' from graphset 'test'
import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
let sdkUsage = async () => {
// omit code of establishing server connection 'conn' using graphset 'default'
let resp = await conn.dropNodeSchema(
{ name: "account" },
{ graphSetName: "test" },
);
resp = await conn.dropEdgeSchema(
{ name: "has" },
{ graphSetName: "test" },
);
console.log(resp.status.code_desc);
};
sdkUsage();