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

    Alias Structs

    DataItem

    Using methods get() and alias() of UQLReply will return class DataItem.

    DataItem has below methods:

    Method Type Description
    asNodes() Node[] convert DataItem of NODE type to Node[]
    asEdges() Edge[] convert DataItem of EDGE type to Edge[]
    asPaths() Path[] convert DataItem of PATH type to Path[]
    asGraphs() ResponseType.Graph[] convert DataItem with alias _graph to Graph[]
    asSchemas() ResponseType.Graph[] convert DataItem with alias _nodeSchema or _edgeSchema to Schema[]
    asProperties() ResponseType.Graph[] convert DataItem with alias _nodeProperty or _edgeProperty to Property[]
    asAlgos() ResponseType.Graph[] convert DataItem with alias _algoList to Algo[]
    asTable() Table convert DataItem of TABLE type to Table
    asArray() any[][] convert DataItem of ARRAY type to any[][]
    asAttrs() AttrAlias convert DataItem of ATTR type to AttrAlias
    toJSONString() string convert DataItem of any type to json formatted string

    It is also legal to convert DataItem with alias _graph, _nodeSchema, _edgeSchema, etc., to Table using method asTable().

    Node

    Node has below fields:

    Field Type Description
    id string Node ID
    uuid string Node UUID
    schema string Node Schema
    values object Node customer properties

    Node has below methods:

    Method Type Description
    getID() string acquire ID of current Node
    getUUID() string acquire UUID of current Node
    getSchema() string acquire Schema of current Node
    getValues() object acquire Values (custom properties) of current Node
    get(prop_name: string) any acquire a custom property of current Node
    set(prop_name: string, value: any) void set a custom property of current Node, or add KV pair if prop_name is not an existing key

    Example: Send UQL query for a node list, print the ID of 2nd node, and set 'rating' of the 1st node to 8

    import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("find().nodes({@movie}) as nodes return nodes{*} limit 5");
      printers.DataItem.node(resp.data?.alias("nodes"));
    
      console.log("ID of 2nd node is: " + resp.data?.alias("nodes").asNodes()[1].getID());
      console.log("rating of 1st node was: " + resp.data?.alias("nodes").asNodes()[0].get("rating"));
      resp.data?.alias("nodes").asNodes()[0].set("rating",8)
      console.log("rating of 1st node now is: " + resp.data?.alias("nodes").asNodes()[0].get("rating"));
      
    };
    
    sdkUsage();
    

    Output:

    Alias: nodes Type: RESULT_TYPE_NODE
     @movie
    ┌─────────┬─────────┬──────────────────────────┬────────┬────────┬──────┐
    │ (index) │ @schema │           _id            │ _uuid  │ rating │ year │
    ├─────────┼─────────┼──────────────────────────┼────────┼────────┼──────┤
    │    0    │ 'movie' │ 'ULTIPA80000000000003E9' │ '1001' │   9    │ 1994 │
    │    1    │ 'movie' │ 'ULTIPA80000000000003EA' │ '1002' │   7    │ 1993 │
    │    2    │ 'movie' │ 'ULTIPA80000000000003EB' │ '1003' │   6    │ 1998 │
    │    3    │ 'movie' │ 'ULTIPA80000000000003EC' │ '1004' │   9    │ 1994 │
    │    4    │ 'movie' │ 'ULTIPA80000000000003ED' │ '1005' │   9    │ 1997 │
    └─────────┴─────────┴──────────────────────────┴────────┴────────┴──────┘
    ID of 2nd node is: ULTIPA80000000000003EA
    rating of 1st node was: 9
    rating of 1st node now is: 8
    

    Edge

    Edge has below fields:

    Field Type Description
    uuid string Edge UUID
    from_uuid string Edge start node UUID
    to_uuid string Edge end node UUID
    from string Edge start node ID
    to string Edge end node ID
    schema string Edge Schema
    values object Edge customer properties

    Edge has below methods:

    Method Type Description
    getUUID() string acquire UUID of current Edge
    getFromUUID() string acquire UUID of start node of current Edge
    getToUUID() string acquire UUID of end node of current Edge
    getFrom() string acquire ID of start node of current Edge
    getTo() string acquire ID of end node of current Edge
    getSchema() string acquire Schema of current Edge
    getValues() object acquire Values (custom properties) of current Edge
    get(prop_name: string) any acquire a custom property of current Edge
    set(prop_name: string, value: any) void set a custom property of current Edge, or add KV pair if prop_name is not an existing key

    Example: Send UQL query for an edge list, print the ID of the start node of the 2nd edge, and add 'value' for the 1st edge and set to 8

    import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("find().edges({@default}) as edges return edges{*} limit 5");
      printers.DataItem.edge(resp.data?.alias("edges"));
    
      console.log("ID of start node of 2nd edge is: " + resp.data?.alias("edges").asEdges()[1].getFrom());
      console.log("value of 1st edge was: " + resp.data?.alias("edges").asEdges()[0].get("value"));
      resp.data?.alias("edges").asEdges()[0].set("value",8)
      console.log("value of 1st edge now is: " + resp.data?.alias("edges").asEdges()[0].get("value"));
      
    };
    
    sdkUsage();
    

    Output:

    Alias: edges Type: RESULT_TYPE_EDGE
     @default
    ┌─────────┬───────────┬───────┬──────────────────────────┬──────────────────────────┬────────────┬──────────┐
    │ (index) │  @schema  │ _uuid │          _from           │           _to            │ _from_uuid │ _to_uuid │
    ├─────────┼───────────┼───────┼──────────────────────────┼──────────────────────────┼────────────┼──────────┤
    │    0    │ 'default' │ '21'  │     'ULTIPA0000003'      │      'ULTIPA0000004'     │    '20'    │   '21'   │
    │    1    │ 'default' │ '24'  │ 'ULTIPA8000000000000001' │ 'ULTIPA8000000000000002' │    '56'    │   '34'   │
    │    2    │ 'default' │ '29'  │ 'ULTIPA800000000000001A' │ 'ULTIPA800000000000001B' │    '24'    │   '65'   │
    └─────────┴───────────┴───────┴──────────────────────────┴──────────────────────────┴────────────┴──────────┘
    ID of start node of 2nd edge is: ULTIPA8000000000000001
    value of 1st edge was: undefined
    value of 1st edge now is: 8
    

    Path

    Path has below fields:

    Field Type Description
    nodes Node[] Node[] of Path
    edges Edge[] Edge[] of Path
    length number length of Path, namely the number of Edge

    Path has below methods:

    Method Type Description
    getLength() number acquire length of current Path, namely the number of Edge
    getNodes() Node[] acquire Node[] of current Path
    getEdges() Edge[] acquire Edge[] of current Path

    Example: Send UQL query for a path list, print the 2nd node in the 1st path

    import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("n().e()[2].n() as paths return paths{*} limit 3");
      printers.DataItem.path(resp.data?.alias("paths"));
    
      console.log("the 2nd node in the 1st path:");
      console.log(resp.data?.alias("paths").asPaths()[0].getNodes()[1]);
      
    };
    
    sdkUsage();
    

    Output:

    Alias: paths Type: RESULT_TYPE_PATH
    ┌─────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────┐
    │ (index) │                                                Values                                             
       │
    ├─────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────┤
    │    0    │ '(ULTIPA80000000000003E9) <- [1475] - (ULTIPA8000000000000014) - [1350] -> (ULTIPA8000000000000066)'  │
    │    1    │ '(ULTIPA80000000000003E9) <- [1363] - (ULTIPA8000000000000018) - [1353] -> (ULTIPA800000000000005F)'  │
    │    2    │ '(ULTIPA80000000000003E9) <- [1645] - (ULTIPA8000000000000016) - [1374] -> (ULTIPA80000000000003FB)' │
    └─────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────┘
    the 2nd node in the 1st path:
    Node {
      id: 'ULTIPA8000000000000014',
      uuid: '20',
      schema: 'account',
      values: { name: 'Meng', industry: 'Construction', gender: 'female', year: 1982 }
    }
    

    Graph

    Graph has below fields:

    Field Type Description
    id string Graph ID
    name string Graph name
    description string Graph description
    totalNodes string Graph total number of nodes
    totalEdges string Graph total number of edges
    status string Graph status (MOUNTED or UNMOUNTED)
    clusterID string cluster ID

    Example: Send UQL query for a graph list, print the name of the 3rd graph

    import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("show().graph()");
      printers.DataItem.table(resp.data?.alias("_graph"));
    
      console.log("name of 3rd graph is: " + resp.data?.alias("_graph").asGraphs()[2].name);
      
    };
    
    sdkUsage();
    

    Output:

    Alias: _graph Type: RESULT_TYPE_TABLE
    ┌─────────┬────────┬────────────────────┬────────────┬────────────┬─────────────┬─────────────┐
    │ (index) │   id   │        name        │ totalNodes │ totalEdges │ description │   status    │
    ├─────────┼────────┼────────────────────┼────────────┼────────────┼─────────────┼─────────────┤
    │    0    │ '1172' │  'DeliveryCenter'  │    '30'    │    '77'    │      ''     │  'MOUNTED'  │
    │    1    │ '1208' │   'GithubSocial'   │  '37700'   │  '289003'  │      ''     │  'MOUNTED'  │
    │    2    │ '1116' │      'HB_POC'      │    '0'     │    '0'     │      ''     │ 'UNMOUNTED' │
    │    3    │ '1601' │     'Industry'     │    '0'     │    '0'     │      ''     │  'MOUNTED'  │
    └─────────┴────────┴────────────────────┴────────────┴────────────┴─────────────┴─────────────┘
    name of 3rd graph is: HB_POC
    

    Schema

    Schema has below fields:

    Field Type Description
    name string Schema name
    description string Schema description
    properties Property[] Property[] of Schema
    totalNodes string Schema total number of nodes
    totalEdges string Schema total number of edges

    Example: Send UQL query for the node schema list, print the total number of nodes of the 3rd schema

    import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("show().node_schema()");
      printers.DataItem.table(resp.data?.alias("_nodeSchema"));
    
      console.log("number of nodes of 3rd node schema is: " + resp.data?.alias("_nodeSchema").asSchemas()[2].totalNodes);
      
    };
    
    sdkUsage();
    

    Output:

    Alias: _nodeSchema Type: RESULT_TYPE_TABLE
    ┌─────────┬─────────────┬──────────────────┬────────────────────────────────────────────────────────────────────┬────────────┐
    │ (index) │    name     │   description    │                             properties                             │ totalNodes │
    ├─────────┼─────────────┼──────────────────┼────────────────────────────────────────────────────────────────────┼────────────┤
    │    0    │  'default'  │ 'default schema' │                                '[]'                                │    '0'     │
    │    1    │  'country'  │        ''        │ '[{"name":"name","type":"string","description":"","lte":"false"}]' │    '23'    │
    │    2    │ 'celebrity' │        ''        │ '[{"name":"name","type":"string","description":"","lte":"false"}]' │    '78'    │
    └─────────┴─────────────┴──────────────────┴────────────────────────────────────────────────────────────────────┴────────────┘
    number of nodes of 3rd node schema is: 78
    

    Property

    Property has below fields:

    Field Type Description
    name string Property name
    description string Property description
    schema string Property Schema
    type string Property data type
    lte string Property LTE status (true, false or creating)

    Example: Send UQL query for the property list of node schema 'account', print the LTE status of the 4th property

    import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("show().node_property(@account)");
      printers.DataItem.table(resp.data?.alias("_nodeProperty"));
    
      console.log("lte of 4th node property is: " + resp.data?.alias("_nodeProperty").asProperties()[3].lte);
      
    };
    
    sdkUsage();
    

    Output:

    Alias: _nodeProperty Type: RESULT_TYPE_TABLE
     @account
    ┌─────────┬────────────┬──────────┬─────────┬───────────┬─────────────┐
    │ (index) │    name    │   type   │   lte   │  schema   │ description │
    ├─────────┼────────────┼──────────┼─────────┼───────────┼─────────────┤
    │    0    │   'name'   │ 'string' │ 'false' │ 'account' │     ''      │
    │    1    │ 'industry' │ 'string' │ 'false' │ 'account' │     ''      │
    │    2    │  'gender'  │ 'string' │ 'false' │ 'account' │     ''      │
    │    3    │   'year'   │ 'int32'  │ 'true'  │ 'account' │     ''      │
    └─────────┴────────────┴──────────┴─────────┴───────────┴─────────────┘
    lte of 4th node property is: true
    

    Algo

    Algo has below fields:

    Field Type Description
    name string Algo name
    param object Algo parameters such as algorithm name, description, version, etc.
    result_opt object Algo result options
    clusterId string cluster ID

    Example: Send UQL query for the installed algorithm list, print the name and version of the 3rd algorithm

    import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("show().algo()");
      printers.DataItem.table(resp.data?.alias("_algoList"));
    
      console.log("name of 3rd algo is: " + resp.data?.alias("_algoList").asAlgos()[2].name);
      console.log("version of 3rd algo is: " + resp.data?.alias("_algoList").asAlgos()[2].param.version);
      
    };
    
    sdkUsage();
    

    Output:

    Alias: _algoList Type: RESULT_TYPE_TABLE
    ┌─────────┬────────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────┐
    │ (index) │          name          │                                                 param                                                     │                  detail                    │
    ├─────────┼────────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────────────────────────────────────┤
    │    0    │         'celf'         │               '{"name":"celf","description":"celf","version":"1.0.0","parameters":...}'                   │ 'base:\r\n  category: Centrality\r\n  ...' │
    │    1    │ 'harmonic_centrality'  │  '{"name":"harmonic_centrality","description":"harmonic_centrality","version":"1.0.0","parameters":...}'  │ 'base:\r\n  category: Centrality\r\n  ...' │
    │    2    │ 'closeness_centrality' │ '{"name":"closeness centrality","description":"closeness centrality","version":"1.0.1","parameters":...}' │ 'base:\r\n  category: Centrality\r\n  ...' │
    │    3    │        'degree'        │    '{"name":"degree centrality","description":"degree centrality","version":"1.0.3","parameters":...}'    │ 'base:\r\n  category: Centrality\r\n  ...' │
    │    4    │       'khop_all'       │        '{"name":"khop_all","description":"khop_all","version":"1.0.2","parameters":...}'                  │   'base:\r\n  category: General\r\n  ...'  │
    └─────────┴────────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────────────────────────────────────┘
    name of 3rd algo is: closeness_centrality
    version of 3rd algo is: 1.0.1
    

    Table

    Table has below fields:

    Field Type Description
    name string Table alias
    alias string Table alias
    headers string[] Table headers
    rows any[][] Table rows

    Table has below methods:

    Method Type Description
    getHeaders() string[] acquire current Table headers
    getRows() any[][] acquire current Table rows
    toKV() any[] convert current Table to KV list

    Example: Send UQL query for a table, print the headers and the 2nd row:

    import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("find().nodes({@account}) limit 5 return table(nodes.gender, nodes.year) as myTable");
      printers.DataItem.table(resp.data?.alias("myTable"));
    
      console.log("headers are: " + resp.data?.alias("myTable").asTable().getHeaders());
      console.log("2nd row is: " + resp.data?.alias("myTable").asTable().getRows()[1]);
      
    };
    
    sdkUsage();
    

    Output:

    Alias: myTable Type: RESULT_TYPE_TABLE
    ┌─────────┬──────────────┬────────────┐
    │ (index) │ nodes.gender │ nodes.year │
    ├─────────┼──────────────┼────────────┤
    │    0    │   'female'   │    1978    │
    │    1    │   'female'   │    1989    │
    │    2    │    'male'    │    1982    │
    │    3    │   'female'   │    2007    │
    │    4    │    'male'    │    1973    │
    └─────────┴──────────────┴────────────┘
    headers are: nodes.gender,nodes.year
    2nd row is: female,1989
    

    any[][] (ARRAY)

    Example: Send UQL query for an array list, print the 3rd element of the 2nd array

    import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("find().nodes({@account}) as nodes group by nodes.industry return collect(nodes.name) as myArray limit 3");
      printers.DataItem.array(resp.data?.alias("myArray"));
    
      console.log("3rd element of 2nd array is: " + resp.data?.alias("myArray").asArray()[1][2]);
      
    };
    
    sdkUsage();
    

    Output:

    Alias: myArray Type: RESULT_TYPE_ARRAY
    [ 'jibber-jabber', 'jo', 'CR.', 'laofung', 'pepe' ]
    [ 'Meng', 'HolyC', 'pixiedust', 'Blair_self', 'sadmov' ]
    [ 'Unbeliever', 'Ivo', 'Nannobrycon', 'auric', 'Blair_self' ]
    3rd element of 2nd array is: pixiedust
    

    AttrAlias

    AttrAlias has below fields:

    Field Type Description
    alias string AttrAlias alias
    values any[] AttrAlias rows
    type PropertyType AttrAlias type code
    type_desc string AttrAlias type name

    Example: Send UQL query for an attribute list, print the 2nd attribute

    import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk";
    
    let sdkUsage = async () => {
    
      // omit code of establishing server connection 'conn'
      
      let resp = await conn.uql("find().nodes({@account}) as nodes return nodes.industry as myAttr limit 5");
      printers.DataItem.array(resp.data?.alias("myAttr"));
    
      console.log("2nd attribute is: " + resp.data?.alias("myAttr").asAttrs().values[1]);
      
    };
    
    sdkUsage();
    

    Output:

    Alias: myAttr Type: RESULT_TYPE_ATTR
    {
      alias: 'myAttr',
      type: 7,
      type_desc: 'string',
      values: [ 'Manufacturing', 'Health', 'Other', 'Education', 'Publishing' ]
    }
    2nd attribute is: Health
    
    Please complete the following information to download this book
    *
    公司名称不能为空
    *
    公司邮箱必须填写
    *
    你的名字必须填写
    *
    你的电话必须填写
    *
    你的电话必须填写