Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions documentation/hql/create/addE.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ E::Follows {
To: User,
}
```

```json Output
{
"follows": {
"id": "a1b2c3d4-1de9-5gbf-9247-c51604803082",
"from": "c2ca233f-0cd8-4fae-8136-b40593792071",
"to": "d3db344g-0cd8-4fae-8136-b40593792071"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the character 'g' in the to field is not valid hexadecimal. Replace with a valid character (0-9, a-f).

}
}
```
</CodeGroup>


Expand Down Expand Up @@ -249,6 +259,18 @@ E::Friends {
}
}
```

```json Output
{
"friendship": {
"id": "b2c3d4e5-1de9-5gbf-9247-c51604803082",
"from": "c2ca233f-0cd8-4fae-8136-b40593792071",
"to": "d3db344g-0cd8-4fae-8136-b40593792071",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the character 'g' in the to field is not valid hexadecimal. Replace with a valid character (0-9, a-f).

"since": "2024-01-15",
"strength": 0.85
}
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down Expand Up @@ -443,6 +465,16 @@ E::Follows {
To: User,
}
```

```json Output
{
"follows": {
"id": "a1b2c3d4-1de9-5gbf-9247-c51604803082",
"from": "c2ca233f-0cd8-4fae-8136-b40593792071",
"to": "d3db344g-0cd8-4fae-8136-b40593792071"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the character 'g' in the to field is not valid hexadecimal. Replace with a valid character (0-9, a-f).

}
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down
30 changes: 30 additions & 0 deletions documentation/hql/create/addN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ N::User {
email: String,
}
```

```json Output
{
"empty_user": {
"id": "c2ca233f-0cd8-4fae-8136-b40593792071"
}
}
```
</CodeGroup>
Here's how to run the query using the SDKs or curl

Expand Down Expand Up @@ -124,6 +132,17 @@ N::User {
email: String,
}
```

```json Output
{
"user": {
"id": "c2ca233f-0cd8-4fae-8136-b40593792071",
"name": "Alice",
"age": 25,
"email": "alice@example.com"
}
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down Expand Up @@ -242,6 +261,17 @@ N::User {
email: String,
}
```

```json Output
{
"predefined_user": {
"id": "d3db344g-1de9-5gbf-9247-c51604803082",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the character 'g' in this ID value is not valid hexadecimal (valid: 0-9, a-f). Replace 'g' with a valid hex character like 'f'.

"name": "Alice Johnson",
"age": 30,
"email": "alice@example.com"
}
}
```
</CodeGroup>


Expand Down
34 changes: 34 additions & 0 deletions documentation/hql/create/addV.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ QUERY InsertVector (vector: [F64]) =>
// it uses [F64] by default
V::Document {}
```

```json Output
{
"vector_node": {
"id": "f5e6d7c8-2ef0-6hcg-0358-d62715914193"
}
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down Expand Up @@ -140,6 +148,16 @@ V::Document {
created_at: Date
}
```

```json Output
{
"vector_node": {
"id": "f5e6d7c8-2ef0-6hcg-0358-d62715914193",
"content": "Quick brown fox",
"created_at": "2024-06-15T12:00:00Z"
}
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down Expand Up @@ -274,6 +292,12 @@ E::User_to_Document_Embedding {
To: Document,
}
```

```json Output
{
"result": "Success"
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down Expand Up @@ -439,6 +463,16 @@ V::Document {
}
```

```json Output
{
"vector_node": {
"id": "a1b2c3d4-3fg1-7hij-1469-e73826025204",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

characters 'g', 'h', 'i', 'j' in this ID are not valid hexadecimal (valid range: 0-9, a-f). Replace with valid hex characters.

"content": "Quick summary of a meeting",
"created_at": "2024-06-15T12:00:00Z"
}
}
```

```.env Environment Variables (.env)
OPENAI_API_KEY=your_api_key
```
Expand Down
30 changes: 30 additions & 0 deletions documentation/hql/deleting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ E::Follows {
To: User,
}
```

```json Output
{
"result": "Removed user node"
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down Expand Up @@ -201,6 +207,12 @@ E::Follows {
To: User,
}
```

```json Output
{
"result": "Removed outgoing neighbors"
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down Expand Up @@ -411,6 +423,12 @@ E::Follows {
To: User,
}
```

```json Output
{
"result": "Removed incoming neighbors"
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down Expand Up @@ -621,6 +639,12 @@ E::Follows {
To: User,
}
```

```json Output
{
"result": "Removed outgoing edges"
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down Expand Up @@ -831,6 +855,12 @@ E::Follows {
To: User,
}
```

```json Output
{
"result": "Removed incoming edges"
}
```
</CodeGroup>

Here's how to run the query using the SDKs or curl
Expand Down
63 changes: 53 additions & 10 deletions documentation/hql/output_values.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,49 @@ projected properties, aggregations, literals, or choose to return nothing at all
When using the [Python SDK](../sdks/helix-py), the output values are wrapped in an array for multiple query calls, so you will need to access the first element of the array to get the result of the first call.
</Warning>

## Response structure

Every HelixQL response is a JSON object whose top-level keys are the binding names
used in `RETURN`. The value for each key depends on how many elements the binding holds:

| Binding selects | Example syntax | Value shape |
|----------------------------|-----------------------------|---------------------|
| Multiple elements | `N<User>` | Array of objects |
| Single element (by ID) | `N<User>(user_id)` | Single object |
| Traversal results | `user::Out<Follows>` | Array of objects |
| Scalar / aggregation | `N<User>::COUNT` | Single value |

### Element object shapes

Every element returned by HelixDB includes an `id` field (a UUID string) alongside its
schema-defined properties.

**Node**
```json
{ "id": "c2ca233f-...", "name": "Alice", "age": 25, "email": "alice@example.com" }
```

**Edge** &mdash; includes `from` and `to` fields referencing the connected node IDs, plus
any properties defined in the `Properties` block of the schema.
```json
{ "id": "a1b2c3d4-...", "from": "c2ca233f-...", "to": "d3db344g-...", "since": "2024-01-15" }
```

**Vector** &mdash; includes metadata properties defined in the schema.
```json
{ "id": "f5e6d7c8-...", "content": "Quick brown fox", "created_at": "2024-01-15T00:00:00Z" }
```

<Note>
When you use [property projection](../hql/properties/property-access) (`::{ name, age }`),
only the fields you list are returned &mdash; `id` is **not** included unless you explicitly
request it (e.g. `::{ userID: ::ID, name }`). When you use
[property exclusion](../hql/properties/property-exclusion) (`::!{ email }`), `id` is still
included because it is not a schema-defined property.
</Note>

---

## Returning bindings

Return any previously bound value from your traversal.
Expand All @@ -43,9 +86,9 @@ N::User {
```json Output
{
"users": [
{ "name": "Alice", "age": 25, "email": "alice@example.com" },
{ "name": "Bob", "age": 30, "email": "bob@example.com" },
{ "name": "Charlie", "age": 28, "email": "charlie@example.com" },
{ "id": "c2ca233f-0cd8-4fae-8136-b40593792071", "name": "Alice", "age": 25, "email": "alice@example.com" },
{ "id": "d3db344g-1de9-5gbf-9247-c51604803082", "name": "Bob", "age": 30, "email": "bob@example.com" },
{ "id": "e4ec455h-2ef0-6hcg-0358-d62715914193", "name": "Charlie", "age": 28, "email": "charlie@example.com" }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

character 'g' in Bob's ID is not valid hexadecimal. Replace with a valid character (0-9, a-f).

]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

character 'h' in Charlie's ID is not valid hexadecimal. Replace with a valid character (0-9, a-f).

}
```
Expand Down Expand Up @@ -82,10 +125,10 @@ E::User_to_Post {

```json Output
{
"user": {"name": "Alice", "age": 25, "email": "alice@example.com"},
"posts": [
{"title": "My First Post", "content": "This is my first blog post!"},
...,
"user": {"id": "c2ca233f-0cd8-4fae-8136-b40593792071", "name": "Alice", "age": 25, "email": "alice@example.com"},
"posts": [
{"id": "d3db344g-1de9-5gbf-9247-c51604803082", "title": "My First Post", "content": "This is my first blog post!"},
...

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

character 'g' in the post ID is not valid hexadecimal. Replace with a valid character (0-9, a-f).

]
}
```
Expand Down Expand Up @@ -172,9 +215,9 @@ N::User {
```json Output
{
"users": [
{ "name": "Alice", "age": 25 },
{ "name": "Bob", "age": 30 },
{ "name": "Charlie", "age": 28 }
{ "id": "c2ca233f-0cd8-4fae-8136-b40593792071", "name": "Alice", "age": 25 },
{ "id": "d3db344g-1de9-5gbf-9247-c51604803082", "name": "Bob", "age": 30 },
{ "id": "e4ec455h-2ef0-6hcg-0358-d62715914193", "name": "Charlie", "age": 28 }
Comment on lines +219 to +220

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDs contain 'g' and 'h' which are not valid hexadecimal characters. Replace with valid characters (0-9, a-f).

]
}
```
Expand Down
10 changes: 10 additions & 0 deletions documentation/hql/updating.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ N::Person {
age: U32,
}
```

```json Output
{
"updated": {
"id": "c2ca233f-0cd8-4fae-8136-b40593792071",
"name": "Alice Johnson",
"age": 26
}
}
```
</CodeGroup>

<Info>
Expand Down