Skip to main content

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​

  1. Use indexed subject_id field for performance
  2. Order by created_at for chronological results
  3. Include limit to prevent over-fetching
  4. Filter by predicate to narrow relationship types