Lesson 2 - Turning flat file into a graph

In this lesson, you'll learn how to convert a flat file into graph by extracting relationships. You will also become familiar with the Graph interface of KgBase.

3 min read - Start now

Step 1

Open the "Top Music Albums" project from the previous lesson. In data tab, locate the "Genre" column.

Click on the "..." icon that appears when you move your mouse over column header. Select the "To relationship" item.

Step 2

When creating a relationship, you have to options: A to-one relationship and a to-many relationship. After glancing at our genre column, we'll see that some albums reference multiple relationships, for example Rock, Blues.

To accommodate for these to-many genres, we'll select the to-many relationship type. We'll also have to specify a delimiter. In this case, we can leave the default , value, because our genres are separated by the comma symbol.

Step 3

The next step is to pick a target table. You have an option to match values against an existing table.

In this case, we don't have the target Genres table just yet, so we'll stick with the default "Create new table" option.

Step 4

After a short while, the table will refresh itself. You'll notice that values in Genre column are now changed from text to relationships.

Step 5

From the top menu, switch over to the graph tab. You will now see a graph with your albums and related genres. Notice that something is wrong with these graphs. Genre has the correct label, but albums are labelled by their years.

We need to change column used for graph labels in the albums table.

Step 6

Switch back to the data tab. Once again, edit the Albums table.

Step 7

In the form that shows up, change value of "Column for graph label" to "Album". Save the changes.

Step 8

Now switch back to the Graph tab. Both genres and albums are now using the correct labels.

Next

Lesson 3 - Analyzing data in a table

So far we've imported our music albums file, and converted the "Genre" column into a relationship. Before we move on to graph functionality, let's learn how to do basic analysis of a flat file.