HomePhabricator

Add support to group by year of date properties

Description

Add support to group by year of date properties

For some content, the most pertinent grouping would be by a date property.

Here we implement a bare-bones version of it, with a new template parameter
triggering a grouping by year: the date is then converted using YEAR.

Ideally, we would be able to specify another granularity than year (eg decade/century).
This is not as straightforward (as far as I know, no handy SPARQL primitive like YEAR)
so let's kick that use case down the road.

  • Add GroupingType Enum
  • Add grouping_type class attribute to PropertyStatistics
  • Add BIND dance to:
    • get_grouping_information
    • get_query_for_items_for_property_negative
    • get_query_for_items_for_property_positive
  • Change accordingly the formatting of groupings in make_stats_for_one_grouping
  • Add unit tests

Bug: T236590

Details

Provenance
JeanFredAuthored on Oct 28 2021, 12:36 PM
Parents
R2566:30a2f2bac506: Extend QueryException with the query itself and surface it in the error page
Branches
Unknown
Tags
Unknown
ChangeId
None