Search in sources :

Example 1 with MetricsCalculationException

use of uk.ac.ebi.spot.goci.exception.MetricsCalculationException in project goci by EBISPOT.

the class KBMetricsDriver method generateMetricsReport.

/**
     * Generate a report on the data metrics of the knowledgebase and write them this report to the supplied output
     * stream
     *
     * @param out the output stream to write the report to
     */
public void generateMetricsReport(OutputStream out) throws MetricsCalculationException, IOException {
    try {
        // first, calculate data spread in KB
        Map<IRI, Integer> metrics = loader.quantifyKnowledgeBase(_efoLocation, _gwasSchemaLocation, _kbLocation);
        // build the efo tree
        IRITree tree = treeBuilder.buildIRITree(_efoLocation);
        // now tree is constructed, overlay counts onto it
        walkTreeAndAddCounts(tree.getRootNode(), metrics);
        // process the tree and write the "ideal legend" report
        treeProcessor.processTree(tree, out);
        // write the tree into a report
        tree.prettyPrint(out);
    } catch (OWLOntologyCreationException e) {
        throw new MetricsCalculationException("Failed to calculate metrics because one or more ontologies failed to load " + "(" + e.getMessage() + ")", e);
    } catch (URISyntaxException e) {
        throw new MetricsCalculationException("Failed to calculate metrics - a reference to a supplied location was not valid " + "(" + e.getMessage() + ")", e);
    }
}
Also used : IRI(org.semanticweb.owlapi.model.IRI) MetricsCalculationException(uk.ac.ebi.spot.goci.exception.MetricsCalculationException) OWLOntologyCreationException(org.semanticweb.owlapi.model.OWLOntologyCreationException) URISyntaxException(java.net.URISyntaxException) IRITree(uk.ac.ebi.spot.goci.tree.IRITree)

Aggregations

URISyntaxException (java.net.URISyntaxException)1 IRI (org.semanticweb.owlapi.model.IRI)1 OWLOntologyCreationException (org.semanticweb.owlapi.model.OWLOntologyCreationException)1 MetricsCalculationException (uk.ac.ebi.spot.goci.exception.MetricsCalculationException)1 IRITree (uk.ac.ebi.spot.goci.tree.IRITree)1