E
Edge
Select edges from your graph to begin traversal.
Copy
Ask AI
E<Type>(edge_id)
Example 1: Selecting a follows edge by ID
Copy
Ask AI
QUERY GetFollowEdge (edge_id: ID) =>
follow_edge <- E<Follows>(edge_id)
RETURN follow_edge
QUERY CreateUser (name: String, age: U8, email: String) =>
user <- AddN<User>({
name: name,
age: age,
email: email
})
RETURN user
QUERY CreateRelationships (user1_id: ID, user2_id: ID) =>
follows <- AddE<Follows>::From(user1_id)::To(user2_id)
RETURN follows
Copy
Ask AI
from helix.client import Client
client = Client(local=True, port=6969)
alice = client.query("CreateUser", {
"name": "Alice",
"age": 25,
"email": "alice@example.com",
})
alice_id = alice[0]["user"]["id"]
bob = client.query("CreateUser", {
"name": "Bob",
"age": 28,
"email": "bob@example.com",
})
bob_id = bob[0]["user"]["id"]
follows = client.query("CreateRelationships", {
"user1_id": alice_id,
"user2_id": bob_id,
})
edge_id = follows[0]["follows"]["id"]
result = client.query("GetFollowEdge", {"edge_id": edge_id})
print(result)
Example 2: Selecting all follows edges
Copy
Ask AI
QUERY GetAllFollows () =>
follows <- E<Follows>
RETURN follows
Copy
Ask AI
from helix.client import Client
client = Client(local=True, port=6969)
result = client.query("GetAllFollows")
print(result)