KgBase markup language is a user-friendly way to create graphs just by writing text.
[food.banana] taste="sweet" [food.vinegar] taste="sour" [person.tom] name = "Tom Conway" age = 23 :knows john [person.john] name = "john baez" age = 54 :knows tom :likes banana vinegar
The script above generates this graph in KgBase:
A KgBase script is just a list of nodes. Let's analyze the parts of a node:
1. Node Type
The type of this node is
person. In the beginning example we have nodes of 2 types:
In KgBase, nodes are grouped by their types in tables:
2. Node ID
The ID of this node is
john. Its purpose is to identify the node so that you can create relationships linking to it in other nodes.
Node Type and ID must be separated by a dot
. and enclosed in square brackets
3. Node Properties
This node has 2 properties:
age. The value of each property comes after a
= symbol. Properties can be of 2 types: number or string. Strings are enclosed in double quotes
" ... ". Each new property will create a column in the corresponding table in KgBase.
This nodes has 3 relationships with others nodes: It
knows tom, it
likes banana and it
likes vinegar. Each of these relationships creates an edge in the KgBase graph.
To create a relationship, you must start the line with
: followed by the type of relationship (i.e.
likes) and then a list on node ids, which refer to other nodes that you have created in the same script