Thursday, September 22, 2011

A Detailed View of Extensible Business Reporting Language Taxonomy

This is the second article in the extensible business reporting language series. If you have not read the first one, you can read it here. This article assumes that the reader has already read this previous article. In this article, I will attempt to cover the most important aspects in detail.

Discoverable Taxonomy Set: Taxonomy is made out of two kinds of XML documents - W3 schema files and linkbase files. The schema files can include other schema files and the linkbase files. This inclusion mechanism enables discovery of taxonomy documents starting from one or more given schema documents. The starting schema document is generally known as the entry point. Although it is normally a common practice to have only one entry point, it is possible to have more than one. The taxonomy documents that can be found starting from a given set of entry points are together called the discoverable taxonomy set (DTS).

The following example show how schema document can include a linkbase document through linkbaseRef element. linkbaseRef elements are actually simple XLinks that point to the particular linkbase document.

<xsd:schema targetNamespace="http://www.geekyarticles.com/demoXBRL" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:link="http://www.xbrl.org/2003/linkbase" xmlns:xlink="http://www.w3.org/1999/xlink" >
  <xsd:annotation>
    <xsd:appinfo>
      <link:linkbaseRef xlink:type="simple" xlink:href="abc_pre.xml" xlink:role="http://www.xbrl.org/2003/role/presentationLinkbaseRef" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase"/>
      <link:linkbaseRef xlink:type="simple" xlink:href="abc_cal.xml" xlink:role="http://www.xbrl.org/2003/role/calculationLinkbaseRef" xlink:arcrole="http://www.w3.org/1999/xlink/properties/linkbase"/>
    </xsd:appinfo>
  </xsd:annotation>
  <xsd:import namespace="http://www.xbrl.org/2003/linkbase" schemaLocation="http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd"/>
  <xsd:import namespace="http://www.xbrl.org/in/2011-03-31/in-gaap" schemaLocation="../abc.xsd"/>
</xsd:schema>


Note that the schema also imports two more schema documents that participate in the DTS.

xml:base: Normally if the file referred through xlink:href attribute is a relative URL, it will be evaluated with respect to the URL of the current document. However, this behavior can be changed by specifying xml:base attribute to any element. If the xml:base attribute is specified on an element, the xlink:href will be resolved with respect to the URL specified with the xml:base attribute. If the value of the xml:base attribute is a relative URL, its value is first evaluated with respect to the base URL of the parent tag before it is used. xml:base attribute are also applicable to the descendent tags. If multiple ancestor elements specify xml:base attribute, the value specified in the nearest (innermost) ancestor takes precedence.


Base Set: The arcs in all the linkbases are grouped into base sets. A base set contains arcs with the same element qualified name and same arcrole and are contained in link elements with the same qualified name and same role. So, all calculation arcs in the same role (and same arcrole of summation item) are grouped into a single base set. All arcs in the same base set are considered to be together while drawing any relationships from the arcs. For example, if two links in the same base set (ie. two links that contain arcs from only the same base set) define two calculation relationships like A=B+C and A=D+E. Then the net relationship after grouping as base set will become A=B+C+D+E.

Role Declaration: The Roles used in the links as the value of the xlink:role attribute must be first defined in the DTS. Note that this is specifically an XBRL requirement and not in general an XLink requirement. Roles are defined in the schema and then must also be first referenced with roleRef element in the linkbase file in which it is used. The following are example of roleType.

<xsd:schema targetNamespace="http://www.geekyarticles.com/doesNotMatterInThisCase" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:link="http://www.xbrl.org/2003/linkbase">
  <xsd:annotation>
    <xsd:appinfo>
       <link:roleType roleURI="http://www.geekyarticles.com/demoRole" id="demoRole">
        <link:definition>A role for demo</link:definition>
        <link:usedOn>link:presentationLink</link:usedOn>
        <link:usedOn>link:calculationLink</link:usedOn>
        <link:usedOn>link:definitionLink</link:usedOn>
       </link:roleType>
    </xsd:appinfo>
</xsd:schema>


The role is defined here. It also says in which links the roles can be used. This role can only be used in presentationLin, calculationLink and definitionLink elements. The following shows how it is used in the linkbase.

<link:linkbase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:link="http://www.xbrl.org/2003/linkbase"  xmlns:xlink="http://www.w3.org/1999/xlink" >

  <link:roleRef roleURI="http://www.geekyarticles.com/demoRole" xlink:type="simple" xlink:href="abc.xsd#demoRole"/>

<!--more elements here-->
</link:linkbase>


However, there is one spec defined role that neither needs a definition nor a reference. http://www.xbrl.org/2003/role/link

Arcrole Declaration: Similarly arcroles must be declared for use. However, spec defined arcroles do not need to be either defined or referenced. Normally a taxonomy does not need to define or reference arcroles. However, it is required if other specifications are developed based on XBRL. Such an example is the XBRL dymentions specification.

<schema targetNamespace="http://www.geekyarticles.com/doesNotMatterInThisCase"

        xmlns:link="http://www.xbrl.org/2003/linkbase"

        xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

<annotation>

<appinfo>

    <link:arcroleType arcroleURI="http://www.geekyarticles.com/demoArcrole"

      id="demoArcrole"

      cyclesAllowed="none">

      <link:usedOn>link:calculationArc</link:usedOn>

    </link:arcroleType>

  </appinfo>

</annotation>

</schema>


This arcrole can be referenced in a linkbase as follows.

<link:arcroleRef xlink:type="simple" 

  xlink:href="abc.xsd#demoArcrole"

  arcroleURI="http://www.geekyarticles.com/demoArcrole"/>




Cycles: Notice that in the arcroleType definition, there an attribute called cyclesAllowed which is set to none. If we take all the arcs in a base set, we can check whether the arcs form any cycles. Cycles are of two kinds - directed and undirected. A directed cycle is formed if starting from any node, it is possible to traverse the arcs in the direction specified to arrive back at the same node. An undirected cycle is formed if it is possible to traverse the arcs in any direction (independent of the arcs' direction) to arrive back at the same point. Obviously, all directed cycles are also undirected cycles, but not all undirected cycles are directed cycles.

Hence, if cyclesAllowed is none, it means even the directed cycles are not allowed. If cycles allowed is undirected, then directed cycles are not allowed. If cyclesAllowed is all, it means, well of course, all cycles are allowed.

Extension Points: One very important feature of XBRL is extensibility. A taxonomy can be extended, and that is a feature currently widely used for all financial reporting purpose. To extend a taxonomy, we must use a different entry point and then refer to the taxonomy being extended from any schema within the DTS. Thus, it will be more appropriate to say that the entry point of a taxonomy can be referenced from another to include it.

Inclusion of Schema: Of course it we can include a taxonomy entry point from a schema document, all the schema documents in the DTS gets included with it. This means all schema defined elements and all linkbase documents referenced from the schema also gets included. However, there is no way to remove any element/linkbase from the DTS while extending it.

Prohibition and Overriding of Arcs: All arcs can have a use attribute. The value of this attribute is either optional or prohibited. There is another attribute priority which can have any integer value. These two attributes in an arc form the basis of extensibility. I will describe how.

Equivalent Arcs: First we need to know the concept of equivalent arcs. Two arcs are equivalent if
  1. All the non-exempt attributes of the arcs are equal
  2. The two arcs have same number of non-exempt attributes
  3. The arcs are between the same elements, ie the from side and the to side point to the same elements in the same documents


Now what is a non-exempt attribute? The following attributes are exempt. All other attributes are non-exempt.
  • All attributes from namespace http://www.w3.org/2000/xmlns/
  • All attributes from namespace http://www.w3.org/1999/xlink
  • The use and priority attributes
Note that while checking for the equality of attributes, the default values and fixed values of attributes are first evaluated.

Overriding and Prohibiting Relationships: It is guaranteed that within the equivalent arcs, only one will be applicable at the most. Only the arcs with the highest priority matters while choosing this one applicable arc. If there is at least one arc with the highest priority (you see many arcs can have the same priority) with the use attribute set to prohibited, then none of the arcs are included in the relationship. Otherwise, only one of the arcs with the highest priority is included. If there are more than one, any arbitrary one is chosen [From the conditions for equivalent arcs, it really does not matter which one is chosen]. The default value of use attribute is optional.

For example, say we have the following set of calculation links in our taxonomy.
<link:calculationLink xlink:type="extended" xlink:role="http://www.geekyarticels.com/somerole/">
    <link:loc xlink:type="locator" xlink:href="abc.xsd#a" xlink:label="a" xlink:title="a"/>
    <link:loc xlink:type="locator" xlink:href="abc.xsd#b" xlink:label="b" xlink:title="b"/>
    <link:loc xlink:type="locator" xlink:href="abc.xsd#c" xlink:label="c" xlink:title="c"/>
    <link:calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="a" xlink:to="b" xlink:show="replace" order="1.0" weight="1"/>
    <link:calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="a" xlink:to="c" xlink:show="replace" order="1.0" weight="1"/>
</link:calculationLink> 


So we have a relationship a=b+c. Now lets say we want it to be a=b-c. Since the weight attribute is not exempt, we must first prohibit the a to c arc and then create a new one, as seen below.
<link:calculationLink xlink:type="extended" xlink:role="http://www.geekyarticels.com/somerole/">
    <link:loc xlink:type="locator" xlink:href="abc.xsd#a" xlink:label="a" xlink:title="a"/>
    <link:loc xlink:type="locator" xlink:href="abc.xsd#c" xlink:label="c" xlink:title="c"/>

   <!--First prohibit the arc. The default priority is zero-->
    <link:calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="a" xlink:to="c" xlink:show="replace"  order="1.0" weight="1" use="prohibited" />

   <!--Then create a new one -->
   <link:calculationArc xlink:type="arc" xlink:arcrole="http://www.xbrl.org/2003/arcrole/summation-item" xlink:from="a" xlink:to="c" xlink:show="replace"  order="1.0" weight="-1" priority="2" />
   
</link:calculationLink> 


If we do not create the new one, it will represent a=b. This way, we can modify any relationship we want.

These are some of the most important aspects of XBRL taxonomy. I will also cover the important aspects of XBRL instance documents. Stay tuned!

2 comments:

Alex Bandit said...

Thank you and looking for more posts. I am really satisfied with this posting that you have given us. This is really a stupendous work done by you. french translation service

gepsio said...

Can you give specific examples of the umpact of the various possible values of the cyclesAllowed attribute? One of the 2012 conformance tests in the XBRL conformance suite uses cyclesAllowed=all to point a footnote to another footnote, which is not allowed in the normal case because footnotes are supposed to link back to facts. This is apparently allowed if cyclesAllowed=all, and I am trying to understand why. Thank you!

Post a Comment