class ChecklistExporter {

    List<ForcedRoot> query(final Session session, final String statement) throws RepositoryException {
        final QueryManager qm = session.getWorkspace().getQueryManager();
        final NamespaceMapping mapping = new NamespaceMapping(new SessionNamespaceResolver(session));
        final String language =
                statement.toUpperCase().replaceFirst("^\\s*((MEASURE|EXPLAIN)\\s*)*", "")
                        .startsWith("SELECT") ? Query.JCR_SQL2 : Query.XPATH;
        final Query query = qm.createQuery(statement, language);
        final QueryResult result = query.execute();
        final Map<String, ForcedRoot> roots = new LinkedHashMap<>();
        for (NodeIterator nodes = result.getNodes(); nodes.hasNext(); ) {
            nodeToRoot(nodes.nextNode(), mapping).ifPresent(root -> roots.put(root.getPath(), root));
        }
        return new ArrayList<>(roots.values());
    }

    private  ChecklistExporter(final List<Op> operations,
                              final List<String> exportTypeDefs,
                              final List<Rule> pathScopes,
                              final List<Rule> nodeTypeFilters,
                              final List<JcrNs> jcrNamespaces);

}