Nested Triple Queries
Query triples with nested relationships to explore the knowledge graph.
Query Structureβ
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β
- Limit nesting depth to 2-3 levels maximum
- Use limits on nested queries
- Avoid circular references in graph traversal
- Consider performance with deep nesting