Menu

Sample Query

Help
2016-06-03
2016-06-06
  • Angus Mitchell

    Angus Mitchell - 2016-06-03

    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):

            Store store = new StoreImpl();
    
            XBRLXLinkHandlerImpl xlinkHandler = new XBRLXLinkHandlerImpl(); 
            XBRLCustomLinkRecogniserImpl clr = new XBRLCustomLinkRecogniserImpl(); 
            XLinkProcessor xlinkProcessor = new XLinkProcessorImpl(xlinkHandler ,clr);
    
            EntityResolver entityResolver = new EntityResolverImpl(); // Adds to local document cache if set up
    
            Loader loader = new LoaderImpl(store, xlinkProcessor, entityResolver);  
            xlinkHandler.setLoader(loader);
            loader.discover("http://www.xbrl.org/taxonomy/int/fr/ias/ci/pfs/2002-11-15/Novartis-2002-11-15.xsd");
            store.close();
    
     
  • Angus Mitchell

    Angus Mitchell - 2016-06-06

    For example none of these queries return anything

    Example Query

    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)

    <novartis:NetFinancialIncome numericContext="Group2001ForPeriod">1067000000</novartis:NetFinancialIncome>
    <novartis:NetFinancialIncome numericContext="Group2000ForPeriod">1091000000</novartis:NetFinancialIncome>
    
     

    Last edit: Angus Mitchell 2016-06-06

Log in to post a comment.