sdmx-twg / sdmx-rest

This repository is used for maintaining the SDMX RESTful web services specification.
111 stars 24 forks source link

027-Clarity-Expected behaviour of the Item Query for Categories #92

Closed stratosn closed 3 years ago

stratosn commented 4 years ago

In #14 the support for getting Categorisations according to specific Categories (i.e. TargetCategories) was implemented. This is achieved via the Item Query #20 combined with the query string parameter reference=parents.

While requesting a specific Category requires also to specify the full path of its container Categories, it is not clear what to return when a Category, apart from being contained in another Category, contains also one or more Categories.

For example, assume the following request to the Global Registry, for the Category SECTORAL_STAT, which is contained within Category ECO_STAT: https://registry.sdmx.org/ws/public/sdmxapi/rest/categoryscheme/SDMX/STAT_SUBJECT_MATTER/1.0/ECO_STAT.SECTORAL_STAT While all Categories until SECTORAL_STAT shall be returned, any Categories under the latter are not, i.e.:

<str:CategoryScheme urn="urn:sdmx:org.sdmx.infomodel.categoryscheme.CategoryScheme=SDMX:STAT_SUBJECT_MATTER(1.0)" isExternalReference="false" isPartial="true" agencyID="SDMX" id="STAT_SUBJECT_MATTER" isFinal="false" version="1.0">
  <com:Annotations>...</com:Annotations>
  <com:Name xml:lang="en">SDMX Statistical Subject-Matter Domains</com:Name>
  <com:Description xml:lang="en">
  This is the canonical representation of the SDMX Content Guidelines for Statistical Subject-Matter Domains. Within SDMX, the list of Statistical Subject-Matter Domains (aligned to the Classification of International Statistical Activities maintained by the Conference of European Statisticians of the United Nations Economic Commission for Europe, UNECE) is a standard reference list against which the categorisation schemes of various participants in exchange arrangements can be mapped to facilitate data and metadata exchange.
  </com:Description>
  <str:Category urn="urn:sdmx:org.sdmx.infomodel.categoryscheme.Category=SDMX:STAT_SUBJECT_MATTER(1.0).ECO_STAT" id="ECO_STAT">
    <com:Annotations>...</com:Annotations>
    <com:Name xml:lang="en">Economic statistics</com:Name>
    <str:Category urn="urn:sdmx:org.sdmx.infomodel.categoryscheme.Category=SDMX:STAT_SUBJECT_MATTER(1.0).ECO_STAT.SECTORAL_STAT" id="SECTORAL_STAT">
      <com:Annotations>...</com:Annotations>
      <com:Name xml:lang="en">Sectoral statistics</com:Name>
    </str:Category>
  </str:Category>
</str:CategoryScheme>

NOTE: the Category ECO_STAT.SECTORAL_STAT contains six (6) Categories.

The question is: should it return the contained Categories, and consequently any Categories contained within the latter?

Moreover, another question that arises is how to apply reference resolution on the result partial Category Scheme, since it will contain all Categories required to return the requested Category, but also may include all Categories that the latter contains.

dosse commented 4 years ago

A connected question is the expected behaviour when querying CategorySchemes as references with detail=referencepartial.

E.g. Let's assume that a dataflow is categorised in a second-level category (which has also itself child categories). When querying http://sdmx-ws-root/dataflow/[agencyID]/[dataflowID]/[version]?references=all&detail=referencepartial, then the CategoryScheme in the references contains: