Skip to main content

N   Nodes

Select nodes from your graph to begin traversal.
N<Type>(node_id)

Example 1: Selecting a user by ID

QUERY GetUser (user_id: ID) =>
    user <- N<User>(user_id)
    RETURN user

QUERY CreateUser (name: String, age: U8, email: String) =>
    user <- AddN<User>({
        name: name,
        age: age,
        email: email
    })
    RETURN user
from helix.client import Client

client = Client(local=True, port=6969)

user = client.query("CreateUser", {
    "name": "Alice",
    "age": 25,
    "email": "alice@example.com",
})
user_id = user[0]["user"]["id"]

result = client.query("GetUser", {"user_id": user_id})
print(result)

Example 2: Selecting all users

QUERY GetAllUsers () =>
    users <- N<User>
    RETURN users
from helix.client import Client

client = Client(local=True, port=6969)

result = client.query("GetAllUsers")
print(result)
You can also do specific property-based filtering, e.g., returning only ID, see the Property Filtering. You can also do aggregation steps, e.g., returning the count of nodes, see the Aggregations.
⌘I