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

      Downloads and Exports

      This section introduces methods on a Connection object for downloading algorithm result files and exporting nodes and edges from a graphset.

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

      downloadAlgoResultFile()

      Downloads one result file from an algorithm task in the current graph.

      Parameters:

      • str: Name of the file.
      • str: ID of the algorithm task that generated the file.
      • Callable[[bytes]: Callback function that accepts bytes.
      • RequestConfig (Optional): Configuration settings for the request.

      Returns:

      • None.

      requestConfig = RequestConfig(graphName="miniCircle")
      
      # Runs the Louvain algorithm in graphset 'miniCircle' and prints the task ID
      
      response = Conn.uql("algo(louvain).params({phase1_loop_num: 20, min_modularity_increase: 0.001}).write({file:{filename_community_id: 'communityID', filename_ids: 'ids', filename_num: 'num'}})", requestConfig);
      taskTable = response.alias("_task").asTable()
      taskID = taskTable.rows[0][0]
      print("taskID =", taskID)
      
      time.sleep(3)
      
      filename = 'communityID'
      
      # Define the callback function to handle file download
      
      def handle_down_algo_file(stream: bytes):
          text = stream.decode('utf-8')
          with open(filename, 'a', encoding='utf-8') as f:
              writer = csv.writer(f)
              if ',' in text:
                  writer.writerow(text.strip().split(','))
              else:
                  writer.writerow([text])
      
      # Execute file download using the callback
      
      cb = lambda stream: handle_down_algo_file(stream)
      Conn.downloadAlgoResultFile(filename, taskID, cb, requestConfig)
      

      taskID = 78620
      

      The file communityID is downloaded to the same directory as the file you executed.

      downloadAllAlgoResultFile()

      Downloads all result files from an algorithm task in the current graph.

      Parameters:

      • str: ID of the algorithm task that generated the file.
      • Callable[[bytes]: Callback function that accepts bytes.
      • RequestConfig (Optional): Configuration settings for the request.

      Returns:

      • None.

      requestConfig = RequestConfig(graphName="miniCircle")
      
      # Runs the Louvain algorithm in graphset 'miniCircle' and prints the task ID
      
      response = Conn.uql("algo(louvain).params({phase1_loop_num: 20, min_modularity_increase: 0.001}).write({file:{filename_community_id: 'communityID', filename_ids: 'ids', filename_num: 'num'}})", requestConfig);
      taskTable = response.alias("_task").asTable()
      taskID = taskTable.rows[0][0]
      print("taskID =", taskID)
      
      time.sleep(3)
      
      # Define the callback function to handle file download
      
      def handle_down_all_algo_file(stream: bytes, filename):
          text = stream.decode('utf-8')
          with open(filename, 'a', encoding='utf-8') as f:
              writer = csv.writer(f)
              if ',' in text:
                  writer.writerow(text.strip().split(','))
              else:
                  writer.writerow([text])
      
      # Execute file download using the callback
      
      cb = lambda stream,filename: handle_down_all_algo_file(stream,filename)
      Conn.downloadAllAlgoResultFile(taskID, cb, requestConfig)
      

      taskId = 1509
      

      The files communityID, ids and num are downloaded to the same directory as the file you executed.

      export()

      Exports nodes and edges from the current graph.

      Parameters:

      • Export: Configurations for the export request, including dbType:DBType, limit:int, schemaName:str and selectPropertiesName:List[str].
      • Callable[[List[Node], List[Edge]], None]: Callback function that accepts the nodes and edges.
      • RequestConfig (Optional): Configuration settings for the request.

      Returns:

      • None.

      # Exports 10 nodes of schema 'account' with selected properties in graphset 'miniCircle' and prints their information
      
      requestConfig = RequestConfig(graphName="miniCircle")
      
      exportRequest = Export(
          dbType=DBType.DBNODE,
          limit=10,
          schemaName="account",
          selectPropertiesName=["_id", "_uuid", "name", "year"]
      )
      
      # Define the callback function to handle the export
      
      def handle_export(nodes: List[Node], edges: List[Edge]):
          if nodes is not None:
              df = pd.DataFrame(nodes)
              df.to_excel(exportRequest.schemaName + ".xlsx", index=False)
          if edges is not None:
              df = pd.DataFrame(edges)
              df.to_excel(exportRequest.schemaName + ".xlsx", index=False)
      
      Conn.export(exportRequest, handle_export, requestConfig)
      

      The file account.xlsx is exported to the same directory as the file you executed.

      Full Example

      import csv
      
      from ultipa import Connection, UltipaConfig
      from ultipa.configuration.RequestConfig import RequestConfig
      
      ultipaConfig = UltipaConfig()
      # URI example: ultipaConfig.hosts = ["mqj4zouys.us-east-1.cloud.ultipa.com:60010"]
      ultipaConfig.hosts = ["192.168.1.85:60061", "192.168.1.87:60061", "192.168.1.88:60061"]
      ultipaConfig.username = "<username>"
      ultipaConfig.password = "<password>"
      
      Conn = Connection.NewConnection(defaultConfig=ultipaConfig)
      
      requestConfig = RequestConfig(graphName="miniCircle")
      
      # Runs the Louvain algorithm in graphset 'miniCircle' and prints the task ID
      
      response = Conn.uql("algo(louvain).params({phase1_loop_num: 20, min_modularity_increase: 0.001}).write({file:{filename_community_id: 'communityID', filename_ids: 'ids', filename_num: 'num'}})", requestConfig);
      taskTable = response.alias("_task").asTable()
      taskID = taskTable.rows[0][0]
      print("taskID =", taskID)
      
      time.sleep(3)
      
      # Define the callback function to handle file download
      
      def handle_down_all_algo_file(stream: bytes, filename):
          text = stream.decode('utf-8')
          with open(filename, 'a', encoding='utf-8') as f:
              writer = csv.writer(f)
              if ',' in text:
                  writer.writerow(text.strip().split(','))
              else:
                  writer.writerow([text])
      
      # Execute file download using the callback
      
      cb = lambda stream,filename: handle_down_all_algo_file(stream,filename)
      Conn.downloadAllAlgoResultFile(taskID, cb, requestConfig)
      
      Please complete the following information to download this book
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写