<commit_before>using Tracker;
using Tracker.Sparql;

public class TestApp : GLib.Object {
	MainLoop loop;
	Sparql.Connection con;
	int res = 0;

	public TestApp (Sparql.Connection connection) {
		con = connection;
	}

	int iter_cursor (Cursor cursor) {
		int i;

		try {
			for (i = 0; i < cursor.n_columns; i++) {
				print ("| %s ", cursor.get_variable_name (i));
			}
			print ("| -> %d columns\n", cursor.n_columns);

			while (cursor.next()) {

				for (i = 0; i < cursor.n_columns; i++) {
					print ("%s%s", i != 0 ? ",":"", cursor.get_string (i));
				}

				print ("\n");
			}
		} catch (GLib.Error e) {
			warning ("Couldn't iterate query results: %s", e.message);
			return -1;
		}

		return (0);
	}

	private void test_query () {
		Cursor cursor;

		print ("Sync test\n");
		try {
			cursor = con.query ("SELECT ?u WHERE { ?u a rdfs:Class }");
		} catch (GLib.Error e) {
			warning ("Couldn't perform query: %s", e.message);
			res = -1;
			return;
		}

		res = iter_cursor (cursor);

		if (res == -1)
			return;
<commit_msg>functional-test: Added the value-type to the test<commit_after>using Tracker;
using Tracker.Sparql;

public class TestApp : GLib.Object {
	MainLoop loop;
	Sparql.Connection con;
	int res = 0;

	public TestApp (Sparql.Connection connection) {
		con = connection;
	}

	string type_to_string (Sparql.ValueType type) {
		switch (type) {
			case Sparql.ValueType.UNBOUND:
				return "unbound";
			case Sparql.ValueType.URI:
				return "uri";
			case Sparql.ValueType.STRING:
				return "string";
			case Sparql.ValueType.INTEGER:
				return "integer";
			case Sparql.ValueType.DOUBLE:
				return "double";
			case Sparql.ValueType.DATETIME:
				return "datetime";
			case Sparql.ValueType.BLANK_NODE:
				return "blank-node";
			default:
				break;
		}
		return "unknown";
	}

	int iter_cursor (Cursor cursor) {
		int i;

		try {
			for (i = 0; i < cursor.n_columns; i++) {
				print ("| %s ", cursor.get_variable_name (i));
			}
			print ("| -> %d columns\n", cursor.n_columns);

			while (cursor.next()) {

				for (i = 0; i < cursor.n_columns; i++) {
					print ("%s%s a %s", i != 0 ? ",":"",
					       cursor.get_string (i),
					       type_to_string (cursor.get_value_type (i)));
				}

				print ("\n");
			}
		} catch (GLib.Error e) {
			warning ("Couldn't iterate query results: %s", e.message);
			return -1;
		}

		return (0);
	}

	private void test_query () {
		Cursor cursor;

		print ("Sync test\n");
		try {
			cursor = con.query ("SELECT ?u WHERE { ?u a rdfs:Class }");
		} catch (GLib.Error e) {
			warning ("Couldn't perform query: %s", e.message);
			res = -1;
			return;
		}

		res = iter_cursor (cursor);

		if (res == -1)
			return;

{'fraction_non_alphanumeric': 0.15879509111193751, 'fraction_numerical': 0.005950167348456675, 'mean_word_length': 2.788732394366197, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 5, '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': '3217064', 'n_tokens_mistral': 1187, 'n_tokens_neox': 980, 'n_words': 265}