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

      Modeling: Relational to Graph

      You may already have an existing project running on a relational database that you'd like to convert to a graph, or you might want to start a new graph project but are more familiar with relational models. Either way, this guide will walk you through the process of easily transforming a relational data model into a graph model.

      Introducing the Tables

      Assume we have three tables in a retail business: Customer, Merchant, and Transaction. The Transaction table records customers' transaction behaviors with merchants.

      Relational Data Model
      cust_no (Primary Key)
      name level
      C100250090 John Doe 2
      C100250091 Alice Carter 3
      C100250092 David Miller 1
      Columns in the Customer Table and Example Data
      merch_no (Primary Key)
      name type
      RS00JF1DF Fay's Shop IV
      RT67KNH2R SunnyMart V
      Columns in the Merchant Table and Example Data
      trans_no
      (Primary Key)
      cust_no
      (Foreign Key)
      merch_no
      (Foreign Key)
      time
      amount
      TR58542 C100250090 RS00JF1DF 2025-01-21 09:12:56 123.45
      TR58543 C100250091 RT67KNH2R 2025-01-21 10:03:23 87.0
      TR58544 C100250090 RT67KNH2R 2025-01-22 13:08:10 255.8
      TR58545 C100250092 RS00JF1DF 2025-01-22 13:52:12 85.4
      TR58546 C100250090 RS00JF1DF 2025-01-22 14:00:52 88.3
      Columns in the Transaction Table and Example Data

      Modeling into a Graph

      Graph databases are unlike relational databases that require you to establish connections between entities using foreign keys. Instead, you can model the connections directly as edges in the graph.

      Building on the graph structure introduced, here's how the transformation goes:

      • Entity tables to node types: Map the Customer and Merchant tables, which represent entities, to node types Customer and Merchant.
      • Columns to node properties: Transform columns in each entity table into properties of the corresponding node type. Use the primary key as the unique identifier _id for the nodes.
      • Relationship tables to edge types: Map the Transaction table, which defines connections, to an edge type TransfersTo. Consider using a verb for the edge type name to better describe the action and its direction.
      • Columns to edge properties: Transform columns in each relationship table into properties of the corresponding edge type. Use the foreign keys cust_no and merch_no as edge system properties _from and _to (_id of the source and destination nodes).
      • Rows to nodes and edges: Treat each row in the tables as a node or an edge in the graph.

      This effectively maps the relational data model to graph structures as shown below:

      Graph Structure

      And here is the graph produced:

      You can refer to Importing Data to Ultipa to learn how to import data into the graph database.

      Customizing the Graph Structure

      Graph structure is highly flexible and can be adapted to meet specific analytical or operational requirements. Adjusting the structure allows you to better align the graph with the focus of your use case.

      For example, some scenarios focus on transactions as primary entities that require modeling them as nodes instead of edges. The graph structure can be adjusted as below where the Trasaction table is mapped into the Transaction node type, which connects to the User and Merchant nodes through hasPayer and hasPayee edge types:

      Graph Structure: Transactions as Nodes

      In cases where there is a need to analyze the types of merchants, you can enhance the graph structure by extracting the type column in the Merchant table and converting it into a separate node type. Instead of storing this information as a property of Merchant nodes, the graph structure would include Type nodes connected to Merchant nodes.

      Graph Structure: Merchant Types as Nodes

      Ensure the type column is deduplicated before converting rows into Type nodes.

      Please complete the following information to download this book
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写