Filter Triples by Subject
Query all triples where a specific atom is the subject.
Query Structureβ
query GetTriplesBySubject($subjectId: String!, $limit: Int!) {
triples(
where: { subject_id: { _eq: $subjectId } }
order_by: { created_at: desc }
limit: $limit
) {
term_id
predicate { label }
object { label image }
}
}
Interactive Exampleβ
Query
query GetTriplesBySubject($subjectId: String!, $limit: Int!) {
triples(
where: { subject_id: { _eq: $subjectId } }
order_by: { created_at: desc }
limit: $limit
) {
term_id
predicate { term_id label }
object { term_id label image }
created_at
}
}Variables
Click "Run Query" to execute the GraphQL query and see results
Best Practicesβ
- Use indexed subject_id field for performance
- Order by created_at for chronological results
- Include limit to prevent over-fetching
- Filter by predicate to narrow relationship types