Skip to main content

approx_median

approx_median calculates the median value of a distribution of values. The value found has is approximately at the 50th percentile, within some error term (0.01, by default). approx_median(x)  is equivalent to approx_percentile(0.5, x).

Parameter

Type

Description

value

decimal, double

the values to be counted

value

decimal, double

the maximum allowable error of the percentile to be found. Must be greater than 0.0 and less than 1.0, and must be the same for all values. This argument is optional, with default value 0.01

Returns: decimal

Example

Query:

PREFIX : <https://ddw-doccorp.linked.data.world/d/sparql-aggregation-sample-queries/>
PREFIX agg: <http://data.world/function/aggregate#>

SELECT (agg:approx_median(?foo) AS ?approx_median)
{
    [ :col-aggregations-foo ?foo ]
}

Run query

Result:

approx_median

5.0