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 UltipaResponse will return class DataItem.

    DataItem has below methods:

    Method Type Description
    asNodes() List[Node] convert DataItem of NODE type to List[Node]
    asFirstNodes() Node acquire the first Node from DataItem of NODE type, equivalent of asNodes()[0]
    asEdges() List[Edge] convert DataItem of EDGE type to List[Edge]
    asFirstEdges() Edge acquire the first Edge from DataItem of EDGE type, equivalent of asEdges()[0]
    asPaths() List[Path] convert DataItem of PATH type to List[Path]
    asGraphs() List[UQLGraph] convert DataItem with alias _graph to List[UQLGraph]
    asSchemas() List[UQLSchema] convert DataItem with alias _nodeSchema or _edgeSchema to List[UQLSchema]
    asProperties() List[UQLProperty] convert DataItem with alias _nodeProperty or _edgeProperty to List[UQLProperty]
    asAlgos() List[UQLAlgos] convert DataItem with alias _algoList to List[UQLProperty]
    asTable() Table convert DataItem of TABLE type to Table
    asArray() ArrayAlias convert DataItem of ARRAY type to ArrayAlias
    asAttr() AttrAlias convert DataItem of ATTR type to AttrAlias

    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 str Node ID
    uuid int Node UUID
    schema str Node Schema
    values Dict Node customer properties

    Node has below methods:

    Method Type Description
    getID() str acquire ID of current Node
    getUUID() int acquire UUID of current Node
    getSchema() str acquire Schema of current Node
    getValues() Dict acquire Values (custom properties) of current Node
    get(propertyName: str) acquire a custom property of current Node
    set(propertyName: str, value) set a custom property of current Node, or add KV pair if 'propertyName' is not an existing key

    Build a Node via ULTIPA.Node(values: Dict, schema: str = None, id: str = None, uuid: int = None)

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

    from ultipa import Connection, UltipaConfig
    
    # omit code of establishing server connection 'conn' using graphset 'default'
    
    req = conn.uql("find().nodes({@movie}) as nodes return nodes{*} limit 5")
    req.Print()
    print("ID of 2nd node is:", req.alias("nodes").asNodes()[1].getID())
    req.alias("nodes").asFirstNodes().set("rating",8)
    print("1st node with new rating value:")
    print(req.alias("nodes").asFirstNodes().toJSON(True))
    

    Part of output:

    +--------------------------------------------------------+
    |       Alias: nodes AliasType: NODE Schema: movie       |
    +------------------------+------+--------+--------+------+
    | id                     | uuid | schema | rating | year |
    +------------------------+------+--------+--------+------+
    | ULTIPA80000000000003E9 | 1001 | movie  | 9      | 1994 |
    | ULTIPA80000000000003EA | 1002 | movie  | 7      | 1993 |
    | ULTIPA80000000000003EB | 1003 | movie  | 6      | 1998 |
    | ULTIPA80000000000003EC | 1004 | movie  | 9      | 1994 |
    | ULTIPA80000000000003ED | 1005 | movie  | 9      | 1997 |
    +------------------------+------+--------+--------+------+
    ID of 2nd node is: ULTIPA80000000000003EA
    1st node with new rating value:
    {
        "id": "ULTIPA80000000000003E9",
        "schema": "movie",
        "uuid": 1001,
        "values": {
            "rating": 8,
            "year": 1994
        }
    }
    

    Edge

    Edge has below fields:

    Field Type Description
    uuid int Edge UUID
    from_uuid int Edge start node UUID
    to_uuid int Edge end node UUID
    from_id str Edge start node ID
    to_id str Edge end node ID
    schema str Edge Schema
    values Dict Edge customer properties

    Edge has below methods:

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

    Build an Edge via ULTIPA.Edge(values: Dict, from_id: str = None, from_uuid: int = None, to_id: str = None, to_uuid: int = None, schema: str = None, uuid: int = None)

    Example: Send UQL query for an edge list, print the ID of the start node of the 2nd edge, add 'time' for the 1st edge and set to '2022-04-13 09:23:24', print the edge

    from ultipa import Connection, UltipaConfig
    
    # omit code of establishing server connection 'conn' using graphset 'default'
    
    req = conn.uql("find().edges({@review}) as edges return edges{*} limit 5")
    req.Print()
    print("ID of start node of 2nd edge is:", req.alias("edges").asEdges()[1].getFrom())
    req.alias("edges").asFirstEdges().set("time","2022-04-13 09:23:24")
    print("1st edge with new property:")
    print(req.alias("edges").asFirstEdges().toJSON(True))
    

    Part of output:

    +-----------------------------------------------------------------------------------------------+
    |                          Alias: edges AliasType: EDGE Schema: review                          |
    +------+-----------+---------+------------------------+------------------------+--------+-------+
    | uuid | from_uuid | to_uuid | from_id                | to_id                  | schema | value |
    +------+-----------+---------+------------------------+------------------------+--------+-------+
    | 4776 | 1001      | 10001   | ULTIPA80000000000003E9 | ULTIPA8000000000002711 | review | 9     |
    | 4777 | 1002      | 10001   | ULTIPA80000000000003EA | ULTIPA8000000000002711 | review | 8     |
    | 4778 | 1003      | 10001   | ULTIPA80000000000003EB | ULTIPA8000000000002711 | review | 8     |
    | 4779 | 1004      | 10001   | ULTIPA80000000000003EC | ULTIPA8000000000002711 | review | 9     |
    | 4780 | 1005      | 10001   | ULTIPA80000000000003ED | ULTIPA8000000000002711 | review | 7     |
    +------+-----------+---------+------------------------+------------------------+--------+-------+
    ID of start node of 2nd edge is: ULTIPA80000000000003EA
    1st edge with new property:
    {
        "from_id": "ULTIPA80000000000003E9",
        "from_uuid": 1001,
        "schema": "review",
        "to_id": "ULTIPA8000000000002711",
        "to_uuid": 10001,
        "uuid": 4776,
        "values": {
            "time": "2022-04-13 09:23:24",
            "value": 9
        }
    }
    

    Path

    Path has below fields:

    Field Type Description
    nodes List[Node] Node list of Path
    edges List[Edge] Edge list of Path
    nodeSchemas Dict[str, Schema] Dictionary of all node schemas of Path
    edgeSchemas Dict[str, Schema] Dictionary of all edge schemas of Path

    Path has below methods:

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

    Build a Path via ULTIPA.Path(nodes: List[Node], edges: List[Edge], nodeSchemas, edgeSchemas)

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

    from ultipa import Connection, UltipaConfig
    
    # omit code of establishing server connection 'conn' using graphset 'default'
    
    req = conn.uql("n().e()[2].n() as paths return paths{*} limit 3")
    req.Print()
    print("the 2nd node in the 1st path:")
    print(req.alias("paths").asPaths()[0].getNodes()[1].toJSON(True))
    

    Part of output:

    +-------------------------------------------+
    |        Alias: paths AliasType: PATH       |
    +-------------------------------------------+
    | data                                      |
    +-------------------------------------------+
    | (1001) <- [1475] -(20) - [1350] -> (1019) |
    | (1001) <- [1363] -(24) - [1353] -> (1045) |
    | (1001) <- [1645] -(22) - [1374] -> (1042) |
    +-------------------------------------------+
    the 2nd node in the 1st path:
    {
        "id": "ULTIPA8000000000000014",
        "schema": "account",
        "uuid": 20,
        "values": {
            "gender": "female",
            "industry": "Construction",
            "name": "Meng",
            "year": 1982
        }
    }
    

    UQLGraph

    UQLGraph has below fields:

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

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

    from ultipa import Connection, UltipaConfig
    
    # omit code of establishing server connection 'conn' using graphset 'default'
    
    req = conn.uql("show().graph()")
    req.Print()
    print("name of 3rd graph is:", req.alias("_graph").asGraphs()[2].name)
    

    Part of output:

    +--------------------------------------------------------------------------------------------+
    |                               Alias: _graph AliasType: TABLE                               |
    +------+---------------+------------+------------+-------------------------------+-----------+
    | id   | name          | totalNodes | totalEdges | description                   | status    |
    +------+---------------+------------+------------+-------------------------------+-----------+
    | 1046 | amz           | 403393     | 3387374    |                               | MOUNTED   |
    | 0    | default       | 111        | 274        | System default graph!         | MOUNTED   |
    | 1332 | miniCircle    | 303        | 1961       |                               | MOUNTED   |
    | 1024 | newTest       | 14         | 7          | rename test as newTest        | MOUNTED   |
    +------+---------------+------------+------------+-------------------------------+-----------+
    name of 3rd graph is: miniCircle
    

    UQLSchema

    UQLSchema has below fields:

    Field Type Description
    name str Schema name
    description str Schema description
    properties List[SchemaProperty] Property[] of Schema
    total int Schema total number of nodes/edges
    type str Schema type (Node or Edge)

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

    from ultipa import Connection, UltipaConfig
    
    # omit code of establishing server connection 'conn' using graphset 'default'
    
    req = conn.uql("show().node_schema()")
    req.Print()
    print("number of nodes of 3rd node schema is:", req.alias("_nodeSchema").asSchemas()[2].total)
    

    Part of output:

    +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    |                                                                    Alias: _nodeSchema AliasType: TABLE                                                                     |
    +----------+----------------+-----------------------------------------------------------------------------------------------------------------------------------+------------+
    | name     | description    | properties                                                                                                                        | totalNodes |
    +----------+----------------+-----------------------------------------------------------------------------------------------------------------------------------+------------+
    | default  | default schema | [{"name":"name","type":"string","description":"","lte":"false"},{"name":"age","type":"int32","description":"","lte":"false"}]     | 10         |
    | customer | bank customer  | [{"name":"name","type":"string","description":"","lte":"false"},{"name":"level","type":"int32","description":"","lte":"false"}]   | 3          |
    | card     | bank card      | [{"name":"level","type":"int32","description":"","lte":"false"},{"name":"balance","type":"float","description":"","lte":"false"}] | 1          |
    +----------+----------------+-----------------------------------------------------------------------------------------------------------------------------------+------------+
    number of nodes of 3rd node schema is: 1
    

    UQLProperty

    UQLProperty has below fields:

    Field Type Description
    name str Property name
    description str Property description
    schema str Property Schema
    type str Property data type
    lte bool Property LTE status

    Example: Send UQL query for a node property list, print the LTE information of the 3rd node property

    from ultipa import Connection, UltipaConfig
    
    # omit code of establishing server connection 'conn' using graphset 'default'
    
    req = conn.uql("show().node_property()")
    req.Print()
    print("lte of 3rd node property is:", req.alias("_nodeProperty").asProperties()[2].lte)
    

    Part of output:

    +------------------------------------------------------+
    |        Alias: _nodeProperty AliasType: TABLE         |
    +---------+--------+-------+----------+----------------+
    | name    | type   | lte   | schema   | description    |
    +---------+--------+-------+----------+----------------+
    | name    | string | false | default  |                |
    | age     | int32  | false | default  |                |
    | name    | string | false | customer | customer name  |
    | level   | int32  | true  | customer | customer level |
    | level   | int32  | false | card     | card level     |
    | balance | float  | true  | card     | card balance   |
    +---------+--------+-------+----------+----------------+
    lte of 3rd node property is: False
    

    UQLAlgos

    UQLAlgos has below fields:

    Field Type Description
    name str Algo name
    description str Algo description
    version str Algo version
    result_opt str Algo result options
    parameters dict Algo parameters such as algorithm name, description, version, etc.
    write_to_stats_parameters dict Algo parameters of write to stats
    write_to_db_parameters dict Algo parameters of write to db
    write_to_file_parameters dict Algo parameters of write to file

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

    from ultipa import Connection, UltipaConfig
    
    # omit code of establishing server connection 'conn' using graphset 'default'
    
    req = conn.uql("show().algo()")
    req.Print()
    print("name of 3rd algorithm is:", req.alias("_algoList").asAlgos()[2].name)
    print("version of 3rd algorithm is:", req.alias("_algoList").asAlgos()[2].version)
    

    Part of output:

    +----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
    |                                                                              Alias: _algoList AliasType: TABLE                                                                               |
    +------------------------+-----------------------------------+---------+-------------------------+---------------------------+-------------------------+--------------------------+------------+
    | name                   | description                       | version | parameters              | write_to_stats_parameters | write_to_db_parameters  | write_to_file_parameters | result_opt |
    +------------------------+-----------------------------------+---------+-------------------------+---------------------------+-------------------------+--------------------------+------------+
    | Harmonic Centrality    | harmonic centrality               | 1.0.0   | {'ids': ...}            | None                      | None                    | None                     | 27         |
    | Page Rank              | page rank                         | 1.0.1   | {'init_value': ...}     | None                      | {'property': ...}       | {'filename': ...}        | 27         |
    | Betweenness Centrality | betweenness centrality, normalize | 1.0.1   | {'sample_size': ...}    | None                      | {'property': ...}       | {'filename': ...}        | 27         |
    +------------------------+-----------------------------------+---------+-------------------------+---------------------------+-------------------------+--------------------------+------------+
    name of 3rd algorithm is: Betweenness Centrality
    version of 3rd algorithm is: 1.0.1
    

    Table

    Table has below fields:

    Field Type Description
    name str Table alias
    headers List[dict] Table headers
    rows List[List] Table rows

    Table has below methods:

    Method Type Description
    getName() str acquire alias of current Table
    getHeaders() List[dict] acquire header list of current Table
    getRows() List[List] acquire row list of current Table

    Build a Table via ULTIPA.Table(table_name: str, headers: List[dict], table_rows: List[List])

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

    from ultipa import Connection, UltipaConfig
    
    # omit code of establishing server connection 'conn' using graphset 'default'
    
    req = conn.uql("find().nodes({@account}) limit 5 return table(nodes.gender, nodes.year) as myTable")
    req.Print()
    print("header is:", req.alias("myTable").asTable().getHeaders())
    print("2nd row is:", req.alias("myTable").asTable().getRows()[1])
    

    Part of output:

    +---------------------------------+
    | Alias: myTable AliasType: TABLE |
    +-----------------+---------------+
    | nodes.gender    | nodes.year    |
    +-----------------+---------------+
    | female          | 1978          |
    | female          | 1989          |
    | male            | 1982          |
    | female          | 2007          |
    | male            | 1973          |
    +-----------------+---------------+
    header is: [{'property_name': 'nodes.gender', 'property_type': 'string'}, {'property_name': 'nodes.year', 'property_type': 'int32'}]
    2nd row is: ['female', 1989]
    

    ArrayAlias

    ArrayAlias has below fields:

    Field Type Description
    alias str ArrayAlias alias
    elements List[List] ArrayAlias rows

    Build an ArrayAlias via ULTIPA.ArrayAlias(alias: str, elements)

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

    from ultipa import Connection, UltipaConfig
    
    # omit code of establishing server connection 'conn' using graphset 'default'
    
    req = conn.uql("find().nodes({@account}) as nodes group by nodes.industry return collect(nodes.name) as myArray limit 3")
    req.Print()
    print("3rd element of 2nd array is:", req.alias("myArray").asArray().elements[1][2])
    

    Part of output:

    +-------------------------------------------------------------+
    |                Alias: myArray AliasType: ARRAY              |
    +-------------------------------------------------------------+
    | collectNames                                                |
    +-------------------------------------------------------------+
    | ["jibber-jabber", "jo", "CR.", "laofung", "pepe"]           |
    | ["Meng", "HolyC", "pixiedust", "sadmov"]                    |
    | ["Unbeliever", "Ivo", "Nannobrycon", "auric", "Blair_self"] |
    +-------------------------------------------------------------+
    3rd element of 2nd array is: pixiedust
    

    AttrAlias

    AttrAlias has below fields:

    Field Type Description
    name str AttrAlias alias
    rows List[str] AttrAlias rows
    type str AttrAlias type

    Build an AttrAlias via ULTIPA.AttrAlias(alias: str, values: List[str], type: str = None)

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

    from ultipa import Connection, UltipaConfig
    
    # omit code of establishing server connection 'conn' using graphset 'default'
    
    req = conn.uql("find().nodes({@account}) as nodes return nodes.industry as myAttr limit 5")
    req.Print()
    print("2nd attribute is:", req.alias("myAttr").asAttr().rows[1])
    

    Part of output:

    +----------------------------+
    | Alias: myAttr AliasType: ATTR |
    +----------------------------+
    | myAttr                     |
    +----------------------------+
    | Manufacturing              |
    | Health                     |
    | Other                      |
    | Education                  |
    | Publishing                 |
    +----------------------------+
    2nd attribute is: Health
    
    Please complete the following information to download this book
    *
    公司名称不能为空
    *
    公司邮箱必须填写
    *
    你的名字必须填写
    *
    你的电话必须填写
    *
    你的电话必须填写