<commit_before>package beaform.debug;

import java.util.List;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.Transaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import beaform.dao.FormulaDAO;
import beaform.dao.FormulaTagDAO;
import beaform.dao.GraphDbHandler;
import beaform.dao.RelTypes;
import beaform.entities.Formula;
import beaform.entities.FormulaTag;

/**
 * This class bundles some debug utilities.
 *
 * @author <NAME>
 *
 */
public final class DebugUtils {

	private static final Logger LOG = LoggerFactory.getLogger(DebugUtils.class);

	private static final String CLEAR_DB_QUERY = "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r";
	private static final String RELATION_AMOUNT = "amount";

	private DebugUtils() {
		// Utility class.
	}

	public static void listAllFormulas() {
		List<Formula> formulas = FormulaDAO.listAllFormulas();
		if (LOG.isDebugEnabled()) {
			LOG.debug("Number of formulas: " + formulas.size());
		}

		for (Formula formula : formulas) {
			LOG.info(formula.toString());
		}
	}

	public static void listAllTags() {

		List<FormulaTag> tags = FormulaTagDAO.listAllTags();
		if (LOG.isDebugEnabled()) {
			LOG.debug("Number of tags: " + tags.size());
		}
		for (FormulaTag tag : tags) {
			LOG.info(tag.toString());
		}
	}

	public static void clearDb() {

		final GraphDatabaseService graphDb = GraphDbHandler.getDbService();
		try ( Transaction tx = graphDb.beginTx() ) {
			graphDb.execute(CLEAR_DB_QUERY);
			tx.success();
		}

		LOG.info("DB cleared");

	}

	public static void fillDb() {
		final GraphDatabaseService graphDb = GraphDbHandler.getDbService();

		try ( Transaction tx = graphDb.beginTx() ) {

			final FormulaTag firstTag = FormulaTagDAO.nodeToTag(FormulaTagDAO.findOrCreate("First"));
			final FormulaTag secondTag = FormulaTagDAO.nodeToTag(FormulaTagDAO.findOrCreate("Second"));
<commit_msg>Remove some debugging statements<commit_after>package beaform.debug;

import java.util.List;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Relationship;
import org.neo4j.graphdb.Transaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import beaform.dao.FormulaDAO;
import beaform.dao.FormulaTagDAO;
import beaform.dao.GraphDbHandler;
import beaform.dao.RelTypes;
import beaform.entities.Formula;
import beaform.entities.FormulaTag;

/**
 * This class bundles some debug utilities.
 *
 * @author <NAME>
 *
 */
public final class DebugUtils {

	private static final Logger LOG = LoggerFactory.getLogger(DebugUtils.class);

	private static final String CLEAR_DB_QUERY = "MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r";
	private static final String RELATION_AMOUNT = "amount";

	private DebugUtils() {
		// Utility class.
	}

	public static void listAllFormulas() {
		List<Formula> formulas = FormulaDAO.listAllFormulas();
		for (Formula formula : formulas) {
			LOG.info(formula.toString());
		}
	}

	public static void listAllTags() {
		List<FormulaTag> tags = FormulaTagDAO.listAllTags();
		for (FormulaTag tag : tags) {
			LOG.info(tag.toString());
		}
	}

	public static void clearDb() {

		final GraphDatabaseService graphDb = GraphDbHandler.getDbService();
		try ( Transaction tx = graphDb.beginTx() ) {
			graphDb.execute(CLEAR_DB_QUERY);
			tx.success();
		}

		LOG.info("DB cleared");

	}

	public static void fillDb() {
		final GraphDatabaseService graphDb = GraphDbHandler.getDbService();

		try ( Transaction tx = graphDb.beginTx() ) {

			final FormulaTag firstTag = FormulaTagDAO.nodeToTag(FormulaTagDAO.findOrCreate("First"));
			final FormulaTag secondTag = FormulaTagDAO.nodeToTag(FormulaTagDAO.findOrCreate("Second"));

{'fraction_non_alphanumeric': 0.11880137894457704, 'fraction_numerical': 0.0031821797931583136, 'mean_word_length': 4.767584097859327, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4040324', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1247, 'n_words': 271}