private static Map<Long, Map<Boolean, Map<Integer, Pair<SingleDTGraph, List<Double>>>>>
      createDataSetCache(
          RDFDataSet tripleStore,
          LargeClassificationDataSet data,
          long[] seeds,
          double fraction,
          int minSize,
          int maxClasses,
          int[] depths,
          boolean[] inference) {
    Map<Long, Map<Boolean, Map<Integer, Pair<SingleDTGraph, List<Double>>>>> cache =
        new HashMap<Long, Map<Boolean, Map<Integer, Pair<SingleDTGraph, List<Double>>>>>();

    for (long seed : seeds) {
      cache.put(seed, new HashMap<Boolean, Map<Integer, Pair<SingleDTGraph, List<Double>>>>());
      data.createSubSet(seed, fraction, minSize, maxClasses);

      for (boolean inf : inference) {
        cache.get(seed).put(inf, new HashMap<Integer, Pair<SingleDTGraph, List<Double>>>());

        for (int depth : depths) {
          System.out.println("Getting Statements...");
          Set<Statement> stmts =
              RDFUtils.getStatements4Depth(
                  tripleStore, data.getRDFData().getInstances(), depth, inf);
          System.out.println("# Statements: " + stmts.size());
          stmts.removeAll(new HashSet<Statement>(data.getRDFData().getBlackList()));
          System.out.println("# Statements: " + stmts.size() + ", after blackList");
          System.out.println("Building Graph...");

          SingleDTGraph graph =
              RDFUtils.statements2Graph(
                  stmts, RDFUtils.REGULAR_LITERALS, data.getRDFData().getInstances(), true);

          System.out.println(
              "Built Graph with "
                  + graph.getGraph().nodes().size()
                  + ", and "
                  + graph.getGraph().links().size()
                  + " links");

          cache
              .get(seed)
              .get(inf)
              .put(
                  depth,
                  new Pair<SingleDTGraph, List<Double>>(
                      graph, new ArrayList<Double>(data.getTarget())));
        }
      }
    }
    return cache;
  }
  private static void computeGraphStatistics(
      RDFDataSet tripleStore, ClassificationDataSet ds, boolean[] inference, int[] depths) {
    Map<Boolean, Map<Integer, Pair<Double, Double>>> stats =
        new HashMap<Boolean, Map<Integer, Pair<Double, Double>>>();

    for (boolean inf : inference) {
      stats.put(inf, new HashMap<Integer, Pair<Double, Double>>());
      for (int depth : depths) {

        Set<Statement> st =
            RDFUtils.getStatements4Depth(tripleStore, ds.getRDFData().getInstances(), depth, inf);
        st.removeAll(ds.getRDFData().getBlackList());
        DTGraph<String, String> graph = RDFUtils.statements2Graph(st, RDFUtils.REGULAR_LITERALS);
        List<DTNode<String, String>> instanceNodes =
            RDFUtils.findInstances(graph, ds.getRDFData().getInstances());
        graph = RDFUtils.simplifyInstanceNodeLabels(graph, instanceNodes);
        GraphList<DTGraph<String, String>> graphs =
            RDFUtils.getSubGraphs(graph, instanceNodes, depth);

        double v = 0;
        double e = 0;
        for (DTGraph<String, String> g : graphs.getGraphs()) {
          v += g.nodes().size();
          e += g.links().size();
        }
        v /= graphs.numInstances();
        e /= graphs.numInstances();

        stats.get(inf).put(depth, new Pair<Double, Double>(v, e));
      }
    }

    for (boolean k1 : stats.keySet()) {
      System.out.println("Inference: " + k1);
      for (int k2 : stats.get(k1).keySet()) {
        System.out.println(
            "Depth "
                + k2
                + ", vertices: "
                + (stats.get(k1).get(k2).getFirst())
                + " , edges: "
                + (stats.get(k1).get(k2).getSecond()));
      }
    }
  }
 private void init(RDFDataSet dataset, List<Resource> instances, List<Statement> blackList) {
   Set<Statement> stmts = RDFUtils.getStatements4Depth(dataset, instances, depth, inference);
   stmts.removeAll(blackList);
   graph = RDFUtils.statements2Graph(stmts, RDFUtils.REGULAR_LITERALS, instances, true);
 }