---
title: Nested Triple Queries
description: Query complex nested triple relationships
url: https://docs.intuition.systems/docs/v1/graphql-api/queries/triples/nested-queries
markdown_url: https://docs.intuition.systems/docs/v1/graphql-api/queries/triples/nested-queries.md
version: V1
llms_index: https://docs.intuition.systems/docs/v1/llms.txt
---

Query triples with nested relationships to explore the knowledge graph.

## Nested Triple Queries - Query Structure

```graphql
query GetNestedTriples($subjectId: String!, $depth: Int!) {
  triples(where: { subject_id: { _eq: $subjectId } }, limit: $depth) {
    term_id
    predicate { label }
    object {
      term_id
      label
      as_subject_triples(limit: 5) {
        predicate { label }
        object { label }
      }
    }
  }
}
```

## Best Practices

1. **Limit nesting depth** to 2-3 levels maximum
2. **Use limits** on nested queries
3. **Avoid circular references** in graph traversal
4. **Consider performance** with deep nesting
