<commit_before>package org.intermine.webservice.server.path;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.intermine.api.InterMineAPI;
import org.intermine.metadata.Model;
import org.intermine.objectstore.ObjectStore;
import org.intermine.objectstore.query.Query;
import org.intermine.objectstore.query.QueryClass;
import org.intermine.objectstore.query.QueryField;
import org.intermine.objectstore.query.QueryFunction;
import org.intermine.objectstore.query.Results;
import org.intermine.pathquery.Path;
import org.intermine.pathquery.PathException;
import org.intermine.webservice.server.WebService;
import org.intermine.webservice.server.exceptions.BadRequestException;
import org.intermine.webservice.server.output.JSONFormatter;
import org.json.JSONObject;

public class PossibleValuesService extends WebService {

    private static final int DEFAULT_BATCH_SIZE = 5000;

    public PossibleValuesService(InterMineAPI im) {
        super(im);
    }

    @Override
    protected int getDefaultFormat() {
        if (hasCallback()) {
            return JSONP_FORMAT;
        } else {
            return JSON_FORMAT;
        }
    }

    private Map<String, Object> getHeaderAttributes() {
        Map<String, Object> attributes = new HashMap<String, Object>();
        if (formatIsJSON() && !formatIsCount()) {
            attributes.put(JSONFormatter.KEY_INTRO, "\"values\":[");
            attributes.put(JSONFormatter.KEY_OUTRO, "]");<commit_msg>Added docstring<commit_after>package org.intermine.webservice.server.path;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.intermine.api.InterMineAPI;
import org.intermine.metadata.Model;
import org.intermine.objectstore.ObjectStore;
import org.intermine.objectstore.query.Query;
import org.intermine.objectstore.query.QueryClass;
import org.intermine.objectstore.query.QueryField;
import org.intermine.objectstore.query.QueryFunction;
import org.intermine.objectstore.query.Results;
import org.intermine.pathquery.Path;
import org.intermine.pathquery.PathException;
import org.intermine.webservice.server.WebService;
import org.intermine.webservice.server.exceptions.BadRequestException;
import org.intermine.webservice.server.output.JSONFormatter;
import org.json.JSONObject;

public class PossibleValuesService extends WebService {

    private static final int DEFAULT_BATCH_SIZE = 5000;

    /**
     * A service for providing column summary information. This information is
     * designed to be used in forms that provide autocomplete or drop-down options
     * to suggest possible values. It expects a path (such as Employee.name, or
     * CEO.company.departments.employees.name), and lists all possible values
     * that path may represent, along with their frequency. The values list is sorted
     * by the value, not the frequency.
     *
     * @param im A reference to the InterMine API bundle.
     */
    public PossibleValuesService(InterMineAPI im) {
        super(im);
    }

    @Override
    protected int getDefaultFormat() {
        if (hasCallback()) {
            return JSONP_FORMAT;
        } else {
            return JSON_FORMAT;
        }
    }

    private Map<String, Object> getHeaderAttributes() {
        Map<String, Object> attributes = new HashMap<String, Object>();
        if (formatIsJSON() && !formatIsCount()) {
            attributes.put(JSONFormatter.KEY_INTRO, "\"values\":[");
            attributes.put(JSONFormatter.KEY_OUTRO, "]");
{'fraction_non_alphanumeric': 0.09809885931558936, 'fraction_numerical': 0.0020278833967046894, 'mean_word_length': 4.058974358974359, 'pattern_counts': {'":': 2, '<': 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': '4445685', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1102, 'n_words': 249}