Filter by Predicate-Object
Use the denormalized predicate_objects table to efficiently query pre-aggregated collections.
Query Structureβ
query GetPredicateObjects($predicateId: String!, $limit: Int!) {
predicate_objects(
where: { predicate_id: { _eq: $predicateId } }
order_by: { triple_count: desc }
limit: $limit
) {
predicate_id
object_id
triple_count
total_market_cap
total_position_count
object {
term_id
label
image
}
}
}
Interactive Exampleβ
Query
query GetPopularCollections($predicateId: String!, $limit: Int!) {
predicate_objects(
where: { predicate_id: { _eq: $predicateId } }
order_by: { triple_count: desc }
limit: $limit
) {
object { term_id label image }
triple_count
total_market_cap
}
}Variables
Click "Run Query" to execute the GraphQL query and see results
Best Practicesβ
- Use for aggregations instead of manually counting triples
- Order by triple_count for popular collections
- Filter by predicate to find specific relationship types
- More efficient than aggregating raw triples