xbrl dimensions linkbase parsing

孤街浪徒 提交于 2019-12-10 11:45:49

问题


I am trying to parse SEC edgar xml data and am confused by definition linkable. Below is an extract from the definition linkbase for apple for their 10-Q. Note: the roleURI column has been added from the roleRef elements in the definition linkbase.

idx order   role    {http://www.w3.org/1999/xlink}arcrole   {http://www.w3.org/1999/xlink}from  roleURI {http://www.w3.org/1999/xlink}to
16  1   http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/dimension-domain    dei_LegalEntityAxis aapl-20151226.xsd#Role_StatementOfIncome    dei_EntityDomain
33  1   http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/hypercube-dimension us-gaap_StatementTable  aapl-20151226.xsd#Role_StatementOfIncome    dei_LegalEntityAxis
17  1.01    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_OperatingExpensesAbstract   aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_ResearchAndDevelopmentExpense
18  1.02    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_OperatingExpensesAbstract   aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_SellingGeneralAndAdministrativeExpense
19  1.03    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_OperatingExpensesAbstract   aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_OperatingExpenses
14  1.04    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_EarningsPerShareAbstract    aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_EarningsPerShareBasic
15  1.05    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_EarningsPerShareAbstract    aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_EarningsPerShareDiluted
21  1.06    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_SalesRevenueNet
22  1.07    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_CostOfGoodsAndServicesSold
23  1.08    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_GrossProfit
24  1.09    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_OperatingExpensesAbstract
25  1.1 http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_OperatingIncomeLoss
26  1.11    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_NonoperatingIncomeExpense
27  1.12    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest
28  1.13    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_IncomeTaxExpenseBenefit
29  1.14    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_NetIncomeLoss
30  1.15    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_EarningsPerShareAbstract
31  1.16    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_WeightedAverageNumberOfSharesOutstandingAbstract
32  1.17    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_CommonStockDividendsPerShareDeclared
34  1.19    http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_WeightedAverageNumberOfSharesOutstandingAbstract    aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_WeightedAverageNumberOfSharesOutstandingBasic
35  1.2 http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/domain-member   us-gaap_WeightedAverageNumberOfSharesOutstandingAbstract    aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_WeightedAverageNumberOfDilutedSharesOutstanding
20  100 http://www.apple.com/taxonomy/role/StatementOfIncome    http://xbrl.org/int/dim/arcrole/all us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_StatementTable

From this data, I would like to be able to recreate the format presented here for the Condensed Consolidated Statements of Operations.

My issue is that I am not sure how to parse it. I assume that one starts at the arcrole/all which states has a from link = us-gaap_StatementLineItems and to = us-gaap_StatementTable. From this point it is possible to trace the following links through the table:

from                                 to 
us-gaap_StatementTable               dei_LegalEntityAxis
dei_LegalEntityAxis                  dei_EntityDomain

From here, it stops as dei_EntityDomain does not link to anything. I know that the structure should look like this:

Rendered Data:

Model Structure:

I would expect the structure of the linkbase to look something like this:

from                                 to 
us-gaap_StatementTable               dei_LegalEntityAxis
us-gaap_StatementTable               us-gaap_StatementLineItems

I can see that this would allow effectively two levels to hang from the Statement table but it clearly isn't working like that.

Can someone tell me how I can use the definition linkbase data provided to read it to get to the intended structure shown in the picture above above. Once I understand how the definition linkbase works, I can extract the facts and concepts.


回答1:


The definition linkbase is used to indicate valid concepts in a given dimensional context, not for rendering. However I think you can still use it to achieve your goal.

There is a table linkbase, which is intended to assist with rendering instance documents but I cannot find one for the taxonomy you are working with.

The trick here is not to think of the definition linkbase as a table. Strictly speaking it is an acyclic directed graph, but it may help to think of it as a tree with the XBRL hypercube as the root (referred to in your extract as "us-gaap_StatementTable", and in the taxonomy as {http://fasb.org/us-gaap/2015-01-31}StatementTable).

One branch of the tree leads to the concepts, or line items. The other branch leads to the axes; in this case a single dimension {http://xbrl.sec.gov/dei/2014-01-31}LegalEntityAxis with a single possible domain value of {http://xbrl.sec.gov/dei/2014-01-31}EntityDomain.

The hypercube will not appear in an instance document, but the dimensions and domains it links to will.

In an instance document you will look for a {http://www.xbrl.org/2003/instance}context element with these values as the dimension attribute and value respectively of a child {http://xbrl.org/2006/xbrldi}explicitMember node. The facts associated with this context will be the ones you're after (they will have the same contextRef attribute as the parent context's id attribute). The context nodes are also where you get your period information from.

With no help from me you've worked out that there is a convention here using abstract elements (us-gaap_OperatingExpensesAbstract, us-gaap_EarningsPerShareAbstract and us-gaap_WeightedAverageNumberOfSharesOutstandingAbstract) as subheadings. Being abstract they won't appear in instance documents.

Remember, in the definition linkbase extract you've included, "dei_EntityDomain" doesn't point at anything; the concepts point at the hypercube, and the hypercube points at the dimensions, which point at the domains. The XML elements used to represent dimensions and domains appear as children of xbrli:context elements in instance documents.




回答2:


I have created the model structure of the table from the presentation linkbase for the StatementofIncome role.

order   preferredLabel  role    {http://www.w3.org/1999/xlink}arcrole   {http://www.w3.org/1999/xlink}from  roleURI {http://www.w3.org/1999/xlink}to
1   http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_IncomeStatementAbstract aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_StatementTable
1   http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementTable  aapl-20151226.xsd#Role_StatementOfIncome    dei_LegalEntityAxis
1   http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   dei_LegalEntityAxis aapl-20151226.xsd#Role_StatementOfIncome    dei_EntityDomain
100 http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementTable  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_StatementLineItems
1.06    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_SalesRevenueNet
1.07    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_CostOfGoodsAndServicesSold
1.08    http://www.xbrl.org/2003/role/totalLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_GrossProfit
1.09    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_OperatingExpensesAbstract
1.01    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_OperatingExpensesAbstract   aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_ResearchAndDevelopmentExpense
1.02    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_OperatingExpensesAbstract   aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_SellingGeneralAndAdministrativeExpense
1.03    http://www.xbrl.org/2003/role/totalLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_OperatingExpensesAbstract   aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_OperatingExpenses
1.04    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_EarningsPerShareAbstract    aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_EarningsPerShareBasic
1.05    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_EarningsPerShareAbstract    aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_EarningsPerShareDiluted
1.1 http://www.xbrl.org/2003/role/totalLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_OperatingIncomeLoss
1.11    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_NonoperatingIncomeExpense
1.12    http://www.xbrl.org/2003/role/totalLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_IncomeLossFromContinuingOperationsBeforeIncomeTaxesExtraordinaryItemsNoncontrollingInterest
1.13    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_IncomeTaxExpenseBenefit
1.14    http://www.xbrl.org/2003/role/totalLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_NetIncomeLoss
1.15    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_EarningsPerShareAbstract
1.16    http://www.xbrl.org/2003/role/verboseLabel  http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_WeightedAverageNumberOfSharesOutstandingAbstract
1.17    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_StatementLineItems  aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_CommonStockDividendsPerShareDeclared
1.19    http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_WeightedAverageNumberOfSharesOutstandingAbstract    aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_WeightedAverageNumberOfSharesOutstandingBasic
1.2 http://www.xbrl.org/2003/role/terseLabel    http://www.apple.com/taxonomy/role/StatementOfIncome    http://www.xbrl.org/2003/arcrole/parent-child   us-gaap_WeightedAverageNumberOfSharesOutstandingAbstract    aapl-20151226.xsd#Role_StatementOfIncome    us-gaap_WeightedAverageNumberOfDilutedSharesOutstanding

Firstly, I sorted by order and then found the first 'from' row which contained the word 'Abstract'. From here I iterated through the 'links}to' links to create the following table structure using the order field to create the correct sorting:

us-gaap_IncomeStatementAbstract

Statement [Table]                                           us-gaap_StatementTable
    Legal Entity [Axis]                                     dei_LegalEntityAxis
        Entity [Domain]                                     dei_EntityDomain
    Statement [Line Items]                                  us-gaap_StatementLineItems
        Net sales                                           us-gaap_SalesRevenueNet
        Cost of sales                                       us-gaap_CostOfGoodsAndServicesSold
        Gross margin                                        us-gaap_GrossProfit
        Operating expenses:                                 us-gaap_OperatingExpensesAbstract
            Research and development                        us-gaap_ResearchAndDevelopmentExpense
            Selling, general and administrative             us-gaap_SellingGeneralAndAdministrativeExpense
            Total operating expenses                        us-gaap_OperatingExpenses
        Operating income                                    us-gaap_OperatingIncomeLoss
        Other income/(expense), net                         us-gaap_NonoperatingIncomeExpense
        Income before provision for income taxes            us-gaap_IncomeLossFromContinuingOperationsBeforeIn...
        Provision for income taxes                          us-gaap_IncomeTaxExpenseBenefit
        Net income                                          us-gaap_NetIncomeLoss
        Earnings per share:                                 us-gaap_EarningsPerShareAbstract
            Basic                                           us-gaap_EarningsPerShareBasic
            Diluted                                         us-gaap_EarningsPerShareDiluted
        Shares used in computing earnings per share:        us-gaap_WeightedAverageNumberOfSharesOutstandingAb...
            Basic                                           us-gaap_WeightedAverageNumberOfSharesOutstandingBa...
            Diluted                                         us-gaap_WeightedAverageNumberOfDilutedSharesOutsta...
        Cash dividends declared per share                   us-gaap_CommonStockDividendsPerShareDeclared

This looks very similar to the model structure created from a rendering application:



来源:https://stackoverflow.com/questions/36087829/xbrl-dimensions-linkbase-parsing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!