Change Password

Please enter the password.
Please enter the password. Between 8-64 characters. Not identical to your email address. Contain at least 3 of uppercase, lowercase, numbers, and special characters (such as @*&#).
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

v4.2
Search
中文EN
v4.2

    Send UQL

    UQLResponse | UQLReply

    Sending uql() request will return class ULTIPA.UQLResponse。

    UQLResponse has below fileds:

    Field Type Description
    data? ULTIPA.UQLReply result of UQL
    req? any request of UQL
    explainPlans? ExplainPlan UQL statement explanation tree
    status Status status of request execution
    statistic? Statistic statistics of request execution, including timecost, metadata affected, etc.

    The filed data of ULTIPA.UQLResponse is a class ULTIPA.UQLReply.

    UQLReply has below fileds:

    Field Type Description
    datas DataItem[] aliases and values (DataItem) of each return value
    aliasMap object aliases and types of each return value
    statistics Statistics statistics of request execution, including timecost, metadata affected, etc.
    explainPlansTreeTopNode PlanNode the top node of UQL statement explanation tree

    UQLReply has below methods:

    Method Type Description
    toJSON() object convert UQLReply (excluding aliasMap) to json object
    singleDataNodes() Node[] acquire the first alias (must be NODE type) as Node[]
    singleDataEdges() Edge[] acquire the first alias (must be EDGE type) as Edge[]
    singleDataPaths() Path[] acquire the first alias (must be PATH type) as Path[]
    singleDataAttrs() AttrAlias acquire the first alias (must be ATTR type) as AttrAlias
    singleDataArrays() any[][] acquire the first alias (must be ARRAY type) as any[][]
    singleDataTables() Table acquire the first alias (must be TABLE type) as Table
    getTables() Table[] convert all aliases of TABLE type to Table[]
    get(index: number) DataItem acquire an alias of datas as DataItem by index
    alias(alias: string) DataItem acquire an alias of datas as DataItem by name

    Alias types such as NODE, EDGE and PATH can be connverted to corresponding classes using methods of class DataItem, see next chapter Alias Structs for detail.

    toJSON()

    Example: Send UQL insert().into(@default).nodes({}) to server and print the result in json format

    import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("insert().into(@default).nodes({})");
      console.log(resp.data?.toJSON());
      
    };
    
    sdkUsage();
    

    Output:

    {
      statistics: {
        node_affected: '1',
        edge_affected: '0',
        total_time_cost: '1',
        engine_time_cost: '0'
      },
      explainPlansTreeTopNode: null,
      datas: []
    }
    

    get()

    Example: Send UQL return now() as currentTime, pi() as PI to server and print the first alias

    import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("return now() as currentTime, pi() as PI");
      console.log(resp.data?.get(0));
      
    };
    
    sdkUsage();
    

    Output:

    DataItem {
      data: [ '2022-12-22 02:10:14.816351' ],
      alias: 'currentTime',
      type: 4,
      typeDesc: 'RESULT_TYPE_ATTR'
    }
    

    alias()

    Example: Send UQL return now() as currentTime, pi() as PI to server and print the second alias

    import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("return now() as currentTime, pi() as PI");
      console.log(resp.data?.alias("PI"));
      
    };
    
    sdkUsage();
    

    Output:

    DataItem {
      data: [ 3.14159265358979 ],
      alias: 'PI',
      type: 4,
      typeDesc: 'RESULT_TYPE_ATTR'
    }
    
    Please complete the following information to download this book
    *
    公司名称不能为空
    *
    公司邮箱必须填写
    *
    你的名字必须填写
    *
    你的电话必须填写
    *
    你的电话必须填写