String query = "for $index in distinct-values(for $er in #roots#[@type='org.xbrlapi.impl.EntityResourceImpl'], $e in #roots#[@type='org.xbrlapi.impl.EntityImpl'] where $er/*/*/@scheme = $e/*/*/*/@scheme and $er/*/*/@value=$e/*/*/* return $er/@index),$root in #roots# where $root/@index=$index return $root";
List<EntityResource> entitiesWithData = store.<EntityResource>queryForXMLResources(query);
NetFinancialIncome Query Attempts
store.queryForXMLResources("for $r in #roots#[@local-name='NetFinancialIncome'] return $r");
store.queryForXMLResources("for $r in #roots#[@name='NetFinancialIncome'] return $r");
store.queryForXMLResources("for $r in #roots#[@type='NetFinancialIncome'] return $r");
XML (http://www.xbrl.org/taxonomy/int/fr/ias/ci/pfs/2002-11-15/Novartis-2002-11-15.xml)
Basic process is to get a set of facts from the instance, associate them with an aspect model that defines how segment and scenario are interpreted (apply an XBRL dimensions interpretation), and then filter that fact set based upon specifications of aspect values. The Matt DeAngelis examples provide simple code to follow.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there an example of a sample query anywhere? For example I'd like to query for NetFinancialIncome across all periods for this business report that I have loaded - http://www.xbrl.org/taxonomy/int/fr/ias/ci/pfs/2002-11-15/Novartis-2002-11-15.xml.
My loading code (I'm just using the DOM instead of dbxml for the time being):
For example none of these queries return anything
Example Query
NetFinancialIncome Query Attempts
XML (http://www.xbrl.org/taxonomy/int/fr/ias/ci/pfs/2002-11-15/Novartis-2002-11-15.xml)
Last edit: Angus Mitchell 2016-06-06
Check out the MattDeAngelis examples in:
https://sourceforge.net/p/xbrlapi/org_xbrlapi/ci/master/tree/org.xbrlapi/module-examples/src/test/java/org/xbrlapi/data/bdbxml/examples/tests/
You need to have a look at the javadocs for:
http://www.xbrlapi.org/javadoc/org/xbrlapi/aspects/FactSet.html
and
http://www.xbrlapi.org/javadoc/org/xbrlapi/xdt/aspects/DimensionalAspectModelImpl.html
Basic process is to get a set of facts from the instance, associate them with an aspect model that defines how segment and scenario are interpreted (apply an XBRL dimensions interpretation), and then filter that fact set based upon specifications of aspect values. The Matt DeAngelis examples provide simple code to follow.