rank
relationalai.semantics.std.aggregates
rank(*args: AggValue | Ordering) -> AggregateCompute rank based on the ordering of values.
Parameters
Section titled “Parameters”
(*argsAggValue|Ordering, default:()) - Values or Ordering specifications to rank by.
Returns
Section titled “Returns”Aggregate- AnAggregaterepresenting the computation of the rank. ReturnsInteger.
Examples
Section titled “Examples”Rank employees by salary:
select(Employee, aggregates.rank(aggregates.desc(Employee.salary)))Rank products by price per category:
select( Product, aggregates.rank(aggregates.asc(Product.price)) .per(Category) .where(Product.category == Category),)Referenced By
Section titled “Referenced By”RelationalAI Documentation ├── Build With RelationalAI │ └── Understand how PyRel works │ ├── Build a semantic model │ │ └── Query a model │ │ └── Rank and select top results withrank,asc,desc, andtop│ └── Use advanced reasoning > Rules-based reasoning │ └── Aggregate and group data │ └── Rank groups with.rank()└── Release Notes └── Python API Release Notes ├── What’s New in Version 1.18.0 │ └── Bug Fixes └── What’s New in Version 1.26.0 └── Bug Fixes