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.
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

Apply New License

License Detail

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

The MAC address of the server you want to deploy.

Please complete this required field.

Please complete this required field.

Cancel
Apply
ID
Product
Status
Cores
Applied Validity Period(days)
Effective Date
Excpired Date
Mac Address
Apply Comment
Review Comment
Close
Profile
  • Full Name:
  • Phone:
  • Company:
  • Company Email:
  • Country:
  • Language:
Change Password
Apply

You have no license application record.

Apply
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

Product Created On ID Amount (USD) Invoice
Product Created On ID Amount (USD) Invoice

No Invoice

v5.0
Search
    English
    v5.0

      GQL Execution

      This section introduces the gql() and gqlStream() methods on a Connection object for querying the database using GQL.

      Each example focuses solely on the method's usage. For a complete code example, please refer to the full example.

      GQL (Gltipa Query Language) is the ISO-standard query language for graph databases. For detailed information on GQL, refer to the documentation.

      gql()

      Executes a GQL query on the current graphset or the database and returns the result.

      Parameters:

      • string: The GQL query to be executed.
      • RequestConfig (Optional): Configuration settings for the request.

      Returns:

      • Response: Result of the request.

      // Retrieves 5 movie nodes in graphset 'miniCircle' and prints their information
      
      let requestConfig = <RequestType.RequestConfig>{
        graphSetName: "miniCircle",
        useMaster: true,
      };
      
      let resp = await conn.gql(
        "MATCH (n:movie) RETURN n LIMIT 5",
        requestConfig
      );
      
      let node_list = resp.data?.get(0).asNodes();
      node_list?.forEach((node) => {
        console.log(node.get("name"));
      });
      

      The Shawshank Redemption
      Farewell My Concubine
      Léon: The Professional
      Titanic
      Life is Beautiful
      

      For more examples, please refer to Types Mapping Ultipa and Node.js.

      gqlStream()

      Executes a GQL query on the current graphset or the database and returns the result incrementally, allowing handling of large datasets without loading everything into memory at once.

      Parameters:

      • string: The GQL query to be executed.
      • QueryResponseStream: Listener for the streaming process.
      • RequestConfig (Optional): Configuration settings for the request.

      Returns:

      • void

      // Retrieves all 1-step paths in graphset 'miniCircle'
      
      RequestConfig requestConfig = new RequestConfig() { Graph = "miniCircle", UseMaster = true };
      
      let count = 0;
      let resp = await conn.gqlStream(
        "MATCH p = ()-[]-() RETURN p",
        {
          onData: async (res) => {
            let paths = res.data?.get(0).asPaths();
            count = count + (paths?.length || 0);
            console.log(count);
          },
          onEnd: () => {
            console.log("End");
          },
          onStart: () => {
            console.log("Start");
          },
          onError: (err) => {
            console.log(err);
          },
        },
        requestConfig
      );
      

      Start
      Count =  1390
      End
      

      Full Example

      import { ConnectionPool, printers } from "@ultipa-graph/ultipa-node-sdk5";
      import { RequestType } from "@ultipa-graph/ultipa-node-sdk5/dist/types"; 
      
      
      let sdkUsage = async () => {
        // Connection configurations
        //URI example: hosts="mqj4zouys.us-east-1.cloud.ultipa.com:60010"
        let hosts = [
          "192.168.1.85:60061",
          "192.168.1.86:60061",
          "192.168.1.87:60061",
        ];
        let username = "***";
        let password = "***";
        let connPool = new ConnectionPool(hosts, username, password);
      
        // Establishes connection to the database
        let conn = await connPool.getActive();
        let isSuccess = await conn.test();
        console.log(isSuccess);
      
        // Request configurations
        let requestConfig = <RequestType.RequestConfig>{
          graphSetName: "miniCircle",
          useMaster: true,
        };
      
        // Retrieves 10 nodes and prints the _id and name property value of the first returned one
        let resp = await conn.gql(
          "MATCH (n:movie) RETURN n LIMIT 10",
          requestConfig
        );
      
        let node_list = resp.data?.get(0).asNodes();
        if (node_list && node_list.length > 0) {
          console.log(node_list[0]._id, node_list[0].get("name"));
        }
      };
      
      sdkUsage().then(console.log).catch(console.log);
      
      Please complete the following information to download this book
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写