Re: [Xbrlapi-developer] List of Namespaces
Brought to you by:
shuetrim
From: Geoff S. <ge...@ga...> - 2011-12-07 23:35:26
|
Matt, You need to get familiar with is the query methods in the Store interface. The best way to get a feel for how to use these is to look at some of the query-based methods in the BaseStoreImpl class and in the InstanceImpl class. That should enable you to do all of the things you are after here. Note the one big tweak on XQueries: to select all of the root elements of XML resources in the data container that is your data store, you need to use the String #roots#. That gets substituted for in a datastore-implementation specific way by each data store implementation so that the XQuery is valid XQuery syntax. Thus, to get the facts in an XBRL instance, the query would be: String query = "for $fact in #roots#[@fact and @uri=' http://my.com/example/instance.xml'] return $fact"; This exploits the design feature of the XBRLAPI that each fragment of an XBRL document is wrapped in metadata XML. For each fact, that metadata has a @fact attribute and it contains the URI of the containing document. I really should document all of this XML stuff at the fragment metadata level but time is hard to find. You run that query with: store.<Fact>queryForXMLResources(query); You can also return strings or a count of the number of query results using other methods in the Store interface. Using this more specifically for your specific requirements we have: 1. Getting all namespaces of facts in an XBRL instance: String query = " for $fact in #roots#[@fact and @uri=' http://my.com/example/instance.xml'] return namespace-uri($fact)"; Set<String> factNamespaces = store.queryForStrings(query); 2. To retrieve facts in a specific namespace, can use: String query = " for $fact in #roots#[@fact and @uri=' http://my.com/example/instance.xml'] and namespace-uri(xbrlapi:data/*)=' http://eg.com/example/namespace'] return namespace-uri($fact)"; Set<String> factNamespaces = store.<Fact>queryForXMLResources(query); I am not totally convinced of the performance of this last suggestion but if it is not great, try getting all of the facts and then filtering them out of a fact set based on a customised concept-namespace aspect (where the aspect is like a standard concept aspect except that values vary only with namespace and not local name. None of the above has been tested but let me know if you have troubles. Good luck, and send me any working code for these queries. I think they make good sense as additions to the main API. Regards Geoff Shuetrim On 7 December 2011 08:25, Matthew DeAngelis <ro...@gm...> wrote: > Hi Geoff, > > Is there a way to retrieve a list of namespaces for a particular SEC > filing? I would like to retrieve Facts specifically for the "dei" > namespace in a pile of files, and they vary based on the time period > because there is a US GAAP taxonomy change in 2011. I am thinking that I > can get all of the namespaces and regex through them to get the "dei" one. > > > Regards, > Matt DeAngelis > > > ------------------------------------------------------------------------------ > Cloud Services Checklist: Pricing and Packaging Optimization > This white paper is intended to serve as a reference, checklist and point > of > discussion for anyone considering optimizing the pricing and packaging > model > of a cloud services business. Read Now! > http://www.accelacomm.com/jaw/sfnl/114/51491232/ > _______________________________________________ > Xbrlapi-developer mailing list > Xbr...@li... > https://lists.sourceforge.net/lists/listinfo/xbrlapi-developer > > |