Creating nodes & relationships from code

Another way to create nodes & relationships is by using a text file. This allows you to use special syntax to type all the nodes you'd like to create, and then create them all in one go.

2 min read - Start now

Create from text file

In KgBase, you can also add nodes through a text file.

In Graph view, you can add a node by selecting “Edit mode” at the top of the page, going to “Paste code” from the dropdown menu.

Paste the code

A pop-up window will appear, with an example of what the code should look like.

In the example pictured below, we are adding three nodes and two relationships (between Titanic and Kate, and Titanic and Leo).

Click the blue “Validate” button to ensure there are no syntax errors, and then click Save.

The nodes will then be created and will be displayed in the graph.

Example file

:actors kate leo

name="Kate Winslet"

name="Lenoardo DiCaprio"