<commit_before>package InterMine::Query::Roles::Runnable;

use Moose::Role;
requires qw(url view service);

use InterMine::Service;

around BUILDARGS => sub {
    my $orig = shift;
    my $class = shift;
    if ( @_ == 1 && ! ref $_[0] ) {
	my $service = InterMine::Service->new(root => $_[0]);
	my $model   = $service->model;
	return $class->$orig(
			     service => $service,
			     model   => $model,
			    );
    }
    else {
	return $class->$orig(@_);
    }
};


sub url {
    my $self = shift;
    my $xml = $self->to_xml('query');
    my $url = $self->service_root.$self->query_path;
    my $uri = URI->new($url);
    my %query_form = (
	query  => $xml,
	format => 'tab',
    );
    $uri->query_form(%query_form);
    return $uri;
}


sub results_iterator {
    my $self  = shift;
    my %args  = @_;
    my $roles = $args{with} if (exists $args{with});
    return $self->service->get_results_iterator(
	$self->url,<commit_msg>Refactored out url generation to its own role<commit_after>package InterMine::Query::Roles::Runnable;

use Moose::Role;
requires qw(view service url);

use InterMine::Service;

around BUILDARGS => sub {
    my $orig = shift;
    my $class = shift;
    if ( @_ == 1 && ! ref $_[0] ) {
	my $service = InterMine::Service->new(root => $_[0]);
	my $model   = $service->model;
	return $class->$orig(
			     service => $service,
			     model   => $model,
			    );
    }
    else {
	return $class->$orig(@_);
    }
};


sub results_iterator {
    my $self  = shift;
    my %args  = @_;
    my $roles = $args{with} if (exists $args{with});
    return $self->service->get_results_iterator(
	$self->url,
{'fraction_non_alphanumeric': 0.17769607843137256, 'fraction_numerical': 0.003676470588235294, 'mean_word_length': 2.9160671462829737, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, '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': '5707998', 'n_tokens_mistral': 616, 'n_tokens_neox': 588, 'n_words': 139}