code: public double calculatePathProbability(SimulationPath path) {
          
          Connection connection = null;
          PreparedStatement pstmt = null;
          ResultSet rs = null;
          
          try {
              
              connection = bamDataSource.getConnection();
              
              // collect information about node enter events
              pstmt = connection.prepareStatement(PROCESS_INSTANCE_COUNT_QUERY);
              pstmt.setString(1, processId);
              rs = pstmt.executeQuery();
              Integer instanceCount = 1;
              if (rs.next()) {
                  instanceCount = rs.getInt(1);
              }
              
              String parameters = buildParameterPlaceHolder(path.getActivityIds().size());
              String query = PROCESS_INSTANCE_COUNT_FOR_PATH_QUERY.replaceFirst("@1", parameters);
              pstmt = connection.prepareStatement(query);
              pstmt.setString(1, processId);
              int parameterIndex = 2;
              
              for (String node : path.getActivityIds()) {
                  pstmt.setString(parameterIndex, node.replaceFirst("_", ""));
                  parameterIndex++;
              }
              
              rs = pstmt.executeQuery();
              Integer pathcount = 0;
              if (rs.next()) {
                  pathcount = rs.getInt(1)/2;
              }
              
              double result = (100 * pathcount) / instanceCount;
              
              path.setProbability(result);
              
              return result;
              
          } catch (SQLException e) {
              e.printStackTrace();
          } finally {
              if (rs != null) {
                  try {
                      rs.close();
                  } catch (SQLException e) {
  
                  }
              }
              
              if (pstmt != null) {
                  try {
                      pstmt.close();
                  } catch (SQLException e) {
  
                  }
              }
              
              if (connection != null) {
                  try {
                      connection.close();
                  } catch (SQLException e) {
  
                  }
              }
          }
          
          return -1;
          
      }
docs: /*
  Experimental  - not really working yet....