In the previous sections, we achieved significant success in presenting the reporting form from our example in the form of an XBRL report, but did not receive full compliance. Today, an insight has come to one of our developers: And let's try to apply XBRL Dimensions!
Looking at Chapter 5, it becomes obvious that gender and age groups can be represented as dimensions.
The basic taxonomy we have created so far has reached sample-2006-01-05.xsd
. We define domain elements and templates in a separate taxonomy, sample-2006-01-05-dimension.xsd
.
As expected, we can simplify our taxonomy. The basic concept we need is nr_employees . However, we will present it in various measurement contexts; we also need to indicate in the report the total number of employees in a context without measurements. For these purposes, we define the concepts nr_employees_by_gender , nr_employees_by_age and nr_employees_total , specifying nr_employees as the value of the substitutionGroup
attribute.
<element id="sample_nr_employees" name="nr_employees" xbrli:periodType="instant" type="xbrli:nonNegativeIntegerItemType" substitutionGroup="xbrli:item" nillable="true" /> <element id="sample_nr_employees_by_gender" name="nr_employees_by_gender" xbrli:periodType="instant" type="xbrli:nonNegativeIntegerItemType" substitutionGroup="sample:nr_employees" nillable="true" /> <element id="sample_nr_employees_by_age" name="nr_employees_by_age" xbrli:periodType="instant" type="xbrli:nonNegativeIntegerItemType" substitutionGroup="sample:nr_employees" nillable="true" /> <element id="sample_nr_employees_total" name="nr_employees_total" xbrli:periodType="instant" type="xbrli:nonNegativeIntegerItemType" substitutionGroup="sample:nr_employees" nillable="true" />
Facts about the number of employees will be presented in the context of several measurements using different substitutions (substitutions) nr_employees to separate the measurements (and presentations).
Domain elements and template taxonomy are combined into a common taxonomy scheme. The template taxonomy imports several other schemas:
<import namespace="http://www.xbrl.org/2003/instance" schemaLocation="http://www.xbrl.org/2003/xbrl-instance-2003-12-31.xsd" /> <import namespace="http://xbrl.org/2005/xbrldt" schemaLocation="http://www.xbrl.org/2005/xbrldt-2005.xsd" /> <import namespace="http://xbrl.org/2006/xbrldi" schemaLocation="http://www.xbrl.org/2006/xbrldi-2006.xsd" /> <import namespace="http://www.sample.com/2006-01-05" schemaLocation="http://www.sample.com/2006-01-05/sample-2006-01-05.xsd" />
The xbrldi
schema xbrldi
not used in the template taxonomy itself, but is used in the report, which in turn refers to the template taxonomy. In order to minimize the dependence of the report on the measurement module, it is imported into the taxonomy of templates. She also refers to the base taxonomy in order to be connected to concepts.
As we know, there are two types of measurements - typed and explicit. In this section, we will look at how age groups can be represented as a typed dimension.
First of all, we need an element to define the type for the age_group. We will use a simple type with a list of valid values:
<element id="sample_age_group_type" name="age_group_type"> <simpleType> <restriction base="string"> <enumeration value=".. - 20" /> <enumeration value="21 - 40" /> <enumeration value="41 - .." /> </restriction> </simpleType> </element>
Having a type, we can define an age group dimension that refers to a type in its typedDomainRef
attribute.
<element id="sample_dim_age_group" name="dim_age_group" substitutionGroup="xbrldt:dimensionItem" type="xbrli:stringItemType" abstract="true" xbrli:periodType="instant" xbrldt:typedDomainRef="#sample_age_group_type" />
Please note that the element is abstract, which is a requirement. The value of the substitutionGroup
attribute is specified by xbrldt:dimensionItem
.
For a change, in this section, we will show how to represent gender groups as an explicit dimension. This means that we have to define a set of concepts for the elements of the dimension and, in fact, for the dimension itself.
<element id="sample_dim_gender" name="dim_gender" substitutionGroup="xbrldt:dimensionItem" type="xbrli:stringItemType" abstract="true" xbrli:periodType="instant" /> <element id="sample_gender" name="gender" xbrli:periodType="instant" type="xbrli:stringItemType" substitutionGroup="xbrli:item" nillable="true" /> <element id="sample_male" name="male" xbrli:periodType="instant" type="xbrli:stringItemType" substitutionGroup="xbrli:item" nillable="true" /> <element id="sample_female" name="female" xbrli:periodType="instant" type="xbrli:stringItemType" substitutionGroup="xbrli:item" nillable="true" />
Note that an element with dimensionItem
abstract, which is a must. For concepts intended for dimension items, the value of the substitutionGroup
indicated by xbrli:item
. The gender concept acts as the root of the hierarchy of dimension members, the other concepts are domain members.
Elements are placed in a hierarchy by domain-member
relationships, for which we create a definition linkbase. It uses a separate role to group relationships and is included in the taxonomy scheme.
<link:roleType roleURI="http://www.sample.com/genderDimension" id="genderDimension"> <link:definition> Gender dimension for demographics on employees </link:definition> <link:usedOn>link:definitionLink</link:usedOn> </link:roleType> <link:linkbaseRef xlink:type="simple" xlink:href="sample-2006-01-05-dimension-definition.xml" xlink:role="http://www.xbrl.org/2003/role/definitionLinkbaseRef" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase" />
In the linkbase, we use the role and define the concept locators in the usual way.
<roleRef xlink:type="simple" xlink:href="sample-2006-01-05-dimension.xsd#genderDimension" roleURI="http://www.sample.com/genderDimension" /> <definitionLink xlink:type="extended" xlink:role="http://www.sample.com/genderDimension" > <loc xlink:type="locator" xlink:href="sample-2006-01-05-dimension.xsd#sample_dimension_gender" xlink:label="dimension_gender" /> <loc xlink:type="locator" xlink:href="sample-2006-01-05-dimension.xsd#sample_gender" xlink:label="domain_gender" /> <loc xlink:type="locator" xlink:href="sample-2006-01-05-dimension.xsd#sample_male" xlink:label="member_male" /> <loc xlink:type="locator" xlink:href="sample-2006-01-05-dimension.xsd#sample_female" xlink:label="member_female" /> </definitionLink>
A dimension has a dimension-domain
relationship with its domain. Domain elements are defined by domain-member
relationships between concept locators in the definition reference database.
<definitionArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/int/dim/arcrole/dimension-domain" xlink:from="dimension_gender" xlink:to="domain_gender" order="1" priority="0" use="optional" /> <definitionArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/int/dim/arcrole/domain-member" xlink:from="domain_gender" xlink:to="member_male" order="1" priority="0" use="optional" /> <definitionArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/int/dim/arcrole/domain-member" xlink:from="domain_gender" xlink:to="member_female" order="2" priority="0" use="optional" />
Now that we have a basic taxonomy and taxonomy of domain elements, we can combine them with hypercubes in the taxonomy of templates.
First, we define hypercube concepts as abstract elements with the hypercubeItem
attribute of the substitutionGroup
attribute hypercubeItem
.
<element id="sample_hc_gender" name="hc_gender" xbrli:periodType="instant" type="xbrli:stringItemType" substitutionGroup="xbrli:hypercubeItem" nillable="true" abstract="true" /> <element id="sample_hc_age_group" name="hc_age_group" xbrli:periodType="instant" type="xbrli:stringItemType" substitutionGroup="xbrli:hypercubeItem" nillable="true" abstract="true" />
We create links between basic concepts, hypercubes and dimensions.
<loc xlink:type="locator" xlink:href="sample-2006-01-05.xsd#sample_nr_employees_by_gender" xlink:label="primary_nr_employees_by_gender" /> <loc xlink:type="locator" xlink:href="sample-2006-01-05-dimension.xsd#sample_hc_gender" xlink:label="hypercube_gender" /> <definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xbrldt:contextElement="scenario" xlink:from="primary_nr_employees_by_gender" xlink:to="hypercube_gender" order="1" priority="0" use="optional" /> <definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="hypercube_gender" xlink:to="dimension_gender" order="1" priority="0" use="optional" />
Similarly for age groups:
<definitionLink xlink:type="extended" xlink:role="http://www.sample.com/ageGroupDimension" > <loc xlink:type="locator" xlink:href="sample-2006-01-05.xsd#sample_nr_employees_by_age" xlink:label="primary_nr_employees_by_age" /> <loc xlink:type="locator" xlink:href="sample-2006-01-05-dimension.xsd#sample_hc_age_group" xlink:label="hypercube_age_group" /> <loc xlink:type="locator" xlink:href="sample-2006-01-05-dimension.xsd#sample_dim_age_group" xlink:label="dimension_age_group" /> <definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/all" xbrldt:contextElement="scenario" xlink:from="primary_nr_employees_by_age" xlink:to="hypercube_age_group" order="1" priority="0" use="optional" /> <definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="hypercube_age_group" xlink:to="dimension_age_group" order="1" priority="0" use="optional" /> </definitionLink>
Please note that the link should use the role defined in the taxonomy of dimensions - ageGroupDimension
:
<link:roleType roleURI="http://www.sample.com/ageGroupDimension" id="ageGroupDimension"> <link:definition> Age group dimension for demographics on employees </link:definition> <link:usedOn>link:definitionLink</link:usedOn> </link:roleType>
Reference databases of presentations and labels are similar to those we considered earlier; we will not repeat them here.
Now that our measurement taxonomy is ready, we can make a report related to it. First, we define contexts for the total number of employees at the beginning and end of the reporting period.
<context id="c_start"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-01-01</instant> </period> </context> <context id="c_end"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-12-31</instant> </period> </context>
Next, we define contexts for the age group dimension values.
<context id="c_start_age_up_to_20"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-01-01</instant> </period> <scenario> <xbrldi:typedMember dimension="sd:dim_age_group"> <sd:age_group_type>.. - 20</sd:age_group_type> </xbrldi:typedMember> </scenario> </context> <context id="c_end_age_up_to_20"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-12-31</instant> </period> <scenario> <xbrldi:typedMember dimension="sd:dim_age_group"> <sd:age_group_type>.. - 20</sd:age_group_type> </xbrldi:typedMember> </scenario> </context> <context id="c_start_age_21_to_40"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-01-01</instant> </period> <scenario> <xbrldi:typedMember dimension="sd:dim_age_group"> <sd:age_group_type>21 - 40</sd:age_group_type> </xbrldi:typedMember> </scenario> </context> <context id="c_end_age_21_to_40"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-12-31</instant> </period> <scenario> <xbrldi:typedMember dimension="sd:dim_age_group"> <sd:age_group_type>21 - 40</sd:age_group_type> </xbrldi:typedMember> </scenario> </context> <context id="c_start_age_41_and_up"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-01-01</instant> </period> <scenario> <xbrldi:typedMember dimension="sd:dim_age_group"> <sd:age_group_type>41 - ..</sd:age_group_type> </xbrldi:typedMember> </scenario> </context> <context id="c_end_age_41_and_up"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-12-31</instant> </period> <scenario> <xbrldi:typedMember dimension="sd:dim_age_group"> <sd:age_group_type>41 - ..</sd:age_group_type> </xbrldi:typedMember> </scenario> </context>
The change is indicated in the dimension
attribute of the xbrldi:typedMember
. The dimension value is defined as an element of sd:age_group_type
- the type defined for the dimension.
Now we define contexts for gender dimension values.
<context id="c_start_gm"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-01-01</instant> </period> <scenario> <xbrldi:explicitMember dimension="sd:dim_gender">sd:male</xbrldi:explicitMember> </scenario> </context> <context id="c_end_gm"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-12-31</instant> </period> <scenario> <xbrldi:explicitMember dimension="sd:dim_gender">sd:male</xbrldi:explicitMember> </scenario> </context> <context id="c_start_gf"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-01-01</instant> </period> <scenario> <xbrldi:explicitMember dimension="sd:dim_gender">sd:female</xbrldi:explicitMember> </scenario> </context> <context id="c_end_gf"> <entity> <identifier scheme="http://www.statistics.org">12-34567</identifier> </entity> <period> <instant>2005-12-31</instant> </period> <scenario> <xbrldi:explicitMember dimension="sd:dim_gender">sd:female</xbrldi:explicitMember> </scenario> </context>
The change is indicated in the dimension
attribute of the xbrldi:explicitMember
element. The dimension value is determined by reference to the dimension domain member.
Note that the report refers to the taxonomy of the templates, and not to the base taxonomy.
<link:schemaRef xlink:type="simple" xlink:href="http://www.sample.com/2006-01-05/sample-2006-01-05-dimension.xsd" />
Now we can convey the facts, each in its own context.
<!-- --> <s:nr_employees_total contextRef="c_start" unitRef="u_person" decimals="0">35</s:nr_employees_total> <s:nr_employees_total contextRef="c_end" unitRef="u_person" decimals="0">41</s:nr_employees_total> <!-- --> <s:nr_employees_by_gender contextRef="c_start_gm" unitRef="u_person" decimals="0">23</s:nr_employees_by_gender> <s:nr_employees_by_gender contextRef="c_end_gm" unitRef="u_person" decimals="0">27</s:nr_employees_by_gender> <s:nr_employees_by_gender contextRef="c_start_gf" unitRef="u_person" decimals="0">12</s:nr_employees_by_gender> <s:nr_employees_by_gender contextRef="c_end_gf" unitRef="u_person" decimals="0">15</s:nr_employees_by_gender> <!-- --> <s:nr_employees_by_age contextRef="c_start_age_up_to_20" unitRef="u_person" decimals="0">5</s:nr_employees_by_age> <s:nr_employees_by_age contextRef="c_end_age_up_to_20" unitRef="u_person" decimals="0">9</s:nr_employees_by_age> <s:nr_employees_by_age contextRef="c_start_age_21_to_40" unitRef="u_person" decimals="0">23</s:nr_employees_by_age> <s:nr_employees_by_age contextRef="c_end_age_21_to_40" unitRef="u_person" decimals="0">21</s:nr_employees_by_age> <s:nr_employees_by_age contextRef="c_start_age_41_and_up" unitRef="u_person" decimals="0">7</s:nr_employees_by_age> <s:nr_employees_by_age contextRef="c_end_age_41_and_up" unitRef="u_person" decimals="0">11</s:nr_employees_by_age>
Our simple report visualization application does not support measurements, so the report looks like this:
After some manual adjustments — removing unused columns, arranging the remaining columns, and adding table headers — we can look at a slightly better version of the report that you would expect from a measurement-enabled application:
Source: https://habr.com/ru/post/336506/
All Articles