Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


Accessing tuples

  • Karel Arkema
    Karel Arkema


    I've been playing around with XBRL API for a while, but i can't find out a way to access tuples.
    When I discover a XBRL file through loader.discover(xbrlFile) the discover process seems to be working fine and afterwards I can access the items trough store.getitems, store.getfacts, etc. This is working fine, but for some reason store.getTuples() always returns an empty List (although there are several tuples in the XBRL file) . Any ideas how to solve this issue?

    btw I'm using the Berkley store implementation under winXP 32.
    Many thanks in advance..

    • Karel Arkema
      Karel Arkema

      Thank you for your quick reply. I downloaded the new jar today, but it seems the problem with tuples still exists. I looked into the source code of th getTuples() method, an basically this method returns all facts of type org.xbrlapi.impl.TupleImpl.
      When I get a list of all facts in my xbrl instance by calling store.getFacts() this list contains SimpleNumericItemImpl's and NonNumericItemImpl's, this list also contains the items that are contained within the tuples, but the actual tuples themselves don't appear in this list.
      Any ideas?

      • It is odd that the unit test passed but I will take a quick look at the offending method again today.

    • The relevant database query to retrieve all of the facts in a given instance is:

      #roots#[@parentIndex='" + this.getIndex() + "' and (@type='org.xbrlapi.impl.SimpleNumericItemImpl' or @type='org.xbrlapi.impl.FractionItemImpl' or
      @type='org.xbrlapi.impl.NonNumericItemImpl'  or

      (See line 131 of the org.xbrlapi.impl.InstanceImpl class.)

      so it should be retrieving tuples also.  I am puzzled by the fact that the getFacts method seems to be retrieving facts nested within tuples as that would violate the parentIndex predicate in the query above.  Anyway - further investigation is warranted but I am not sure quite how to proceed except to expand on the set of relevant unit tests.  If something comes up I will let you know on this forum.

    • I am not able to replicate your experience but have been able to confirm that the getFacts method picks up facts that are not children of other facts, be they tuples or items.

      I did add a new getTuples method to the Instance interface and am now using that to improve the performance of the store.getTuples() method so you might notice a difference on that front.  The modified files will again be posted to SVN and I hope to do a new file release with relevant bug fixes today also.

    • Karel Arkema
      Karel Arkema

      Once again thank you for your quick reply (darn timezones though). Unfortunately I don't have any knowledge of Xlink, so evaluating this query is quite difficult for me. I'll try to elaborate a bit more about my problem. I've written a small application that creates a Store, using the BdbXml impl, afterwards I create a loader, based om the loader in SEC-filings example witch loads a  XBRL document in the store an starts the discovery process. For testing purposes I use the following file:  "Voorbeeld_Balansmodel_D.xbrl", this file can be found on: http://www.xbrl-ntp.nl/Taxonomie/vbinstances2009/vbinstanceskvk (don't mind the Dutch texts in this file).
      This file contains a tuple item named: <kvk-rj:ContingentLiabilities>, this tuple contains 2 items: ContingentLiabilitiesDescription and ContingentLiabilitiesDisclosure.  When i call the store.getFacts() method, the "ContingentLiabilities"fact doesn't appear in the list, while the ContingentLiabilitiesDescription and ContingentLiabilitiesDisclosure facts do appear in this list (witch can;t be correct) .
      I properly overlook something quite simple, but i can't figure it out.