One-dimensional hypercubes pose no problem, do they? In this final chapter, let's see what the taxonomy of dimensions and the report will look like if we merge two dimensions into one hypercube.
This will lead to changes in all parts of the taxonomy — mainly to discarding elements that are no longer needed, and replacing several elements with one combined:
<element id="sample_age_group_type" name="age_group_type"> <simpleType> <restriction base="string"> <enumeration value="all" /> <enumeration value=".. - 20" /> <enumeration value="21 - 40" /> <enumeration value="41 - .." /> </restriction> </simpleType> </element>
<element id="sample_hc_gender_x_age_group" name="hc_gender_x_age_group" xbrli:periodType="instant" type="xbrli:stringItemType" substitutionGroup="xbrldt:hypercubeItem" nillable="true" abstract="true" />
When looking at the reference database definitions it becomes interesting. First of all, the definitionLink
gender-related links between the basic concepts and the hypercube, as well as between the hypercube and the measurement, are removed from the definitionLink
;
The age-related definitionLink
can be removed completely by replacing it with the definitionLink
for the new hypercube.
<definitionLink xlink:type="extended" xlink:role="http://www.sample.com/demographics" > <loc xlink:type="locator" xlink:href="sample-2006-01-06.xsd#sample_nr_employees" xlink:label="primary_nr_employees" /> <loc xlink:type="locator" xlink:href="sample-2006-01-06-dimension.xsd#sample_hc_gender_x_age_group" xlink:label="hypercube_gender_x_age_group" /> <loc xlink:type="locator" xlink:href="sample-2006-01-06-dimension.xsd#sample_dim_gender" xlink:label="dimension_gender" /> <loc xlink:type="locator" xlink:href="sample-2006-01-06-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" xlink:to="hypercube_gender_x_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_gender_x_age_group" xlink:to="dimension_gender" xbrldt:targetRole="http://www.sample.com/genderDimension" order="1" priority="0" use="optional" /> <definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="hypercube_gender_x_age_group" xlink:to="dimension_age_group" order="2" priority="0" use="optional" /> </definitionLink>
Notice that the hypercube-dimension
arcs are ordered. Also note that the targetRole
attribute in the gender dimension arc indicates the role with which the dimension elements were defined. This allows you to go from one basic set to another, forming a DRS .
Report contexts must be modified to provide all values of both dimensions. The following example shows some of the possible contexts (if you give a complete list, then you get tired to scroll).
<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> <xbrldi:typedMember dimension="sd:dim_age_group"> <sd:age_group_type>all</sd:age_group_type> </xbrldi:typedMember> </scenario> </context> <context id="c_end_gf_age_up_to_20"> <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> <xbrldi:typedMember dimension="sd:dim_age_group"> <sd:age_group_type>.. - 20</sd:age_group_type> </xbrldi:typedMember> </scenario> </context>
The first context can be used to convey facts about the number of male employees at the beginning of the reporting period, regardless of their age. The second context is for facts about the number of female employees under the age of 20 as of the end of the reporting period.
Please note that the order of the measurements should be the same as in the reference database definitions.
The visualization of such a report may look different, not necessarily as in our application, which displays it in such a tabular form (and lost somewhere in the totals):
Let's see if we can somehow make life easier for report writers who want to pass on the facts by age group regardless of gender groups. As you remember, you can use the domain_gender domain element to denote all genders . We can help by making it the default dimension member.
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/dimension-default" xlink:from="dimension_gender" xlink:to="domain_gender" order="1" priority="0" use="optional" />
Now the context might look like this:
<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>
The software for creating an XBRL report will automatically substitute the domain_gender value.
The final touch in our taxonomy of measurements is the exclusion of certain combinations of elements. Let's assume that we are real gentlemen who do not ask a woman about her age. Define the role and hypercube:
<link:roleType roleURI="http://www.sample.com/gentleman" id="gentleman"> <link:definition>A gentlemen never asks a lady about her age</link:definition> <link:usedOn>link:definitionLink</link:usedOn>
<element id="sample_hc_female_x_age_group" name="hc_female_x_age_group" xbrli:periodType="instant" type="xbrli:stringItemType" substitutionGroup="xbrldt:hypercubeItem" nillable="true" abstract="true" />
The hypercube includes the female gender and all age groups, using the role of gentleman to keep him separate from other hypercubes.
<definitionLink xlink:type="extended" xlink:role="http://www.sample.com/gentleman" > </definitionLink>
Create the necessary locators:
<loc xlink:type="locator" xlink:href="sample-2006-01-06.xsd#sample_nr_employees" xlink:label="primary_nr_employees" /> <loc xlink:type="locator" xlink:href="sample-2006-01-06-dimension.xsd#sample_hc_female_x_age_group" xlink:label="hypercube_female_x_age_group" /> <loc xlink:type="locator" xlink:href="sample-2006-01-06-dimension.xsd#sample_dim_gender" xlink:label="dimension_gender" /> <loc xlink:type="locator" xlink:href="sample-2006-01-05-dimension.xsd#sample_female" xlink:label="member_female" /> <loc xlink:type="locator" xlink:href="sample-2006-01-06-dimension.xsd#sample_dim_age_group" xlink:label="dimension_age_group" />
The hypercube fem_x_age_group includes the same two dimensions as gender_x_age_group .
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="hypercube_female_x_age_group" xlink:to="dimension_gender" order="1" priority="0" use="optional" /> <definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/hypercube-dimension" xlink:from="hypercube_female_x_age_group" xlink:to="dimension_age_group" xbrldt:targetRole="http://www.sample.com/ageGroupDimension" order="2" priority="0" use="optional" />
But the domain of the elements of the gender dimension includes only female .
Finally, we create a notAll
relationship between the basic concept of nr_employees and our new hypercube, which prohibits the use of the combinations of elements specified in it. This very effectively makes it impossible for us to convey the fact about women of any age group.
<definitionArc xlink:type="arc" xlink:arcrole="http://xbrl.org/int/dim/arcrole/notAll" xbrldt:contextElement="scenario" xlink:from="primary_nr_employees" xlink:to="hypercube_female_x_age_group" order="1" priority="0" use="optional" /> <!-- link hypercube to dimensions -->
This concludes our work with XBRL. As was shown in this chapter, a lot can be done with it, but you should carefully study how to create a taxonomy and its linkbase, while remaining within the boundaries designated by the XBRL Specification.
I hope this translation has helped you understand a bit about the basics of XBRL and maybe even put new knowledge into practice.
If you are interested in the XBRL topic, send me your questions, ideas for new articles and suggestions for translating useful materials from your opinion.
I invite you to participate in the survey and thank you all for your attention and your comments!
Source: https://habr.com/ru/post/336818/
All Articles