Create Nodes using AddN
Create new nodes in your graph.
AddN<Type>
AddN<Type>({properties})
When using the SDKs or curling the endpoint, the query name must match what is defined in the queries.hx
file exactly.
Example 1: Adding in an empty user node
QUERY CreateUsers () =>
empty_user <- AddN<User>
RETURN empty_user
Heres how to run the query using the SDKs or curl
from helix.client import Client
client = Client(local=True, port=6969)
print(client.query("CreateUsers"))
Example 2: Adding in user with parameters
QUERY CreateUser (name: String, age: U8, email: String) =>
user <- AddN<User>({
name: name,
age: age,
email: email
})
RETURN user
Heres how to run the query using the SDKs or curl
from helix.client import Client
client = Client(local=True, port=6969)
params = {
"name": "Alice",
"age": 25,
"email": "alice@example.com",
}
print(client.query("CreateUser", params))
Example 3: Adding in a user with predefined properties
QUERY CreateUser () =>
predefined_user <- AddN<User>({
name: "Alice Johnson",
age: 30,
email: "alice@example.com"
})
RETURN predefined_user
Heres how to run the query using the SDKs or curl
from helix.client import Client
client = Client(local=True, port=6969)
print(client.query("CreateUser"))