| 1 | package PMLTQ::Commands; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | our $AUTHORITY = 'cpan:MATY'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | $PMLTQ::Commands::VERSION = '2.0.1'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # ABSTRACT: PMLTQ command line interface | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use PMLTQ::Base -strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Cwd qw/getcwd abs_path/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use File::Basename 'fileparse'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use File::Spec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use Getopt::Long (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Hash::Merge 'merge'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use List::MoreUtils 'apply'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use PMLTQ::Loader qw/find_modules load_class/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use YAML::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | sub DEFAULT_CONFIG { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | my $base_dir = shift || getcwd(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DEFAULT_CONFIG: not called CC=2 SCAR=17.9
Pod
undocumented
Condition0%0/3
shift() || getcwd()
MC/DC0%0/2
shift() || getcwd()
shift()
getcwd()
Truth table0%0/3
A || B
A= shift()B= getcwd()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | data_dir => File::Spec->catdir( $base_dir, 'data' ), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | output_dir => File::Spec->catdir( $base_dir, 'sql_dump' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | resources => File::Spec->catdir( $base_dir, 'resources' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | db => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | host => 'localhost', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | port => 5432 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | isFree => 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | isAllLogged => 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | isPublic => 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | isFeatured => 'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | info => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | fields => 'name' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | sub run { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | my ( $self, $name, @args ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | if ( $name && $name =~ /^\w+$/ && ( $name ne 'help' || $args[0] ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$name and $name =~ /^\w+$/ and $name ne "help" || $args[0]
$name and $name =~ /^\w+$/
$name ne "help" or $args[0]
MC/DC0%0/4
$name and $name =~ /^\w+$/ and $name ne "help" || $args[0]
$name
$name =~ /^\w+$/
$name ne "help"
$args[0]
Truth table0%0/5
A and B and C or D
A= $nameB= $name =~ /^\w+$/C= $name ne "help"D= $args[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | $name = shift @args if my $help = $name eq 'help'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $command = _command( "PMLTQ::Command::$name", \@args ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | return $help ? $command->help : $command->run(@args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | print "Available commands:\n\t", join( "\n\t", sort { $a cmp $b } _available_commands() ), "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | sub _available_commands { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | apply {s/^PMLTQ::Command:://} find_modules('PMLTQ::Command'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
_available_commands: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | sub _command { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | ▶ | my ( $module, $args ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_command: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | die qq{Unknown command "$module", maybe you need to install it?\n} unless load_class($module); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | die qq{Command doesn't inherit from PMLTQ::Command} unless $module->isa('PMLTQ::Command'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $config = _parse_args($args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | return $module->new( config => $config ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | sub _parse_args { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | my $args = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_parse_args: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $p = Getopt::Long::Parser->new( config => [qw/pass_through no_ignore_case no_auto_abbrev/] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my $config_file = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $config = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $command_line_config = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my @unprocessed_args = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | $p->getoptionsfromarray( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | $args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 'c|config=s' => \$config_file, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | '<>' => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | my $arg = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my ( $path, $value ) = $arg =~ m/^--([a-z0-9-_]+)=(.*)$/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | unless ($path) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | push @unprocessed_args, $arg; # push back to args | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my @path = split /-/, $path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $name = pop @path; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | my $ref = $command_line_config; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | while ( my $part = shift @path ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | $ref->{$part} = {} unless defined $ref->{$part}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $ref = $ref->{$part}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $ref->{$name} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if ( $config_file ne '--' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if ($config_file) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | die "Configuration file '$config_file' does not exists or is not readable" unless -r $config_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | $config_file = File::Spec->catfile( getcwd(), 'pmltq.yml' ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | $config_file = undef unless -r $config_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | push @$args, @unprocessed_args if @unprocessed_args > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | $config = _load_config($config_file) if $config_file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | return merge( $command_line_config, merge( $config, DEFAULT_CONFIG ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | sub _load_config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | my $config_file = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_config: not called CC=19 SCAR=59.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | my $data; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | my $yaml_str; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | if ( $config_file eq '--' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | $yaml_str = do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | local $/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | <STDIN>; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | eval { $data = YAML::Tiny->read_string($yaml_str) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | eval { $data = YAML::Tiny->read($config_file) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if ( $@ && $@ =~ m/YAML_LOAD_ERR/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/3
$@ and $@ =~ /YAML_LOAD_ERR/
MC/DC0%0/2
$@ and $@ =~ /YAML_LOAD_ERR/
$@
$@ =~ /YAML_LOAD_ERR/
Truth table0%0/3
A and B
A= $@B= $@ =~ /YAML_LOAD_ERR/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | die "Unable to load config file '$config_file'\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | ▶ | } elsif ( $@ && $@ =~ m/YAML_PARSE_ERR/ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$@ and $@ =~ /YAML_PARSE_ERR/
MC/DC0%0/2
$@ and $@ =~ /YAML_PARSE_ERR/
$@
$@ =~ /YAML_PARSE_ERR/
Truth table0%0/3
A and B
A= $@B= $@ =~ /YAML_PARSE_ERR/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $@ =~ s/\n.*//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | die "Unable to parse config file '$config_file'\n\t$@\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | ▶ | } elsif ( $config_file eq '--' && !$data ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config_file eq "--" and not $data
MC/DC0%0/2
$config_file eq "--" and not $data
$config_file eq "--"
not $data
Truth table0%0/3
A and not(B)
A= $config_file eq "--"B= not $data
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | die "Unable to parse config from STDIN:\n$yaml_str\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } elsif ( !$data ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | die "Unable to open config file '$config_file'\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $config = $data->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my $base_dir = $config->{base_dir}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | unless ($base_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ( undef, $base_dir, undef ) = fileparse($config_file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $base_dir = abs_path($base_dir); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | $config->{db} = {} unless $config->{db}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | $config->{db}->{name} = $config->{treebank_id} if ( $config->{treebank_id} && !$config->{db}->{name} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$config->{"treebank_id"} and not $config->{"db"}{"name"}
MC/DC0%0/2
$config->{"treebank_id"} and not $config->{"db"}{"name"}
$config->{"treebank_id"}
not $config->{"db"}{"name"}
Truth table0%0/3
A and not(B)
A= $config->{"treebank_id"}B= not $config->{"db"}{"name"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | for ( grep { $config->{$_} } qw/data_dir resources output_dir/ ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $config->{$_} = abs_path( File::Spec->rel2abs( $config->{$_}, $base_dir ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | if ( $config->{layers} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | for my $lr ( @{ $config->{layers} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | $lr->{'related-schema'} = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | [ map { abs_path( File::Spec->rel2abs( $_, $config->{resources} ) ) } @{ $lr->{'related-schema'} } ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if $lr->{'related-schema'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | $lr->{filelist} = abs_path( File::Spec->rel2abs( $lr->{filelist}, $base_dir ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if $lr->{filelist} && !File::Spec->file_name_is_absolute( $lr->{filelist} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$lr->{"filelist"} and not "File::Spec"->file_name_is_absolute($lr->{"filelist"})
MC/DC0%0/2
$lr->{"filelist"} and not "File::Spec"->file_name_is_absolute($lr->{"filelist"})
$lr->{"filelist"}
not "File::Spec"->file_name_is_absolute($lr->{"filelist"})
Truth table0%0/3
A and not(B)
A= $lr->{"filelist"}B= not "File::Spec"->file_name_is_absolute($lr->{"filelist"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | return merge( $config, DEFAULT_CONFIG($base_dir) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | Usage: pmltq COMMAND [OPTIONS] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | pmltq version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | pmltq configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | pmltq init schema1.xml schema2.xml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | pmltq convert | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | pmltq load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | pmltq initdb | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | pmltq delete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | pmltq webload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | pmltq webdelete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | pmltq webtreebank | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | pmltq webverify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | Options (for all commands): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | -c, --config Config file, by default commands will look | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | for config file called C<pmltq.yml> in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | current directory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | =head1 COMMANDS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | These commands are available by default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | =head2 configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | $ pmltq convert | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | Uses L<PMLTQ::Command::configuration> to to get current configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | =head2 convert | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | $ pmltq convert | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | Uses L<PMLTQ::Command::convert> to convert data in the C<data_dir> based on | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | layers configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | =head2 delete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | $ pmltq delete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | Uses L<PMLTQ::Command::delete> to delete the database for current treebank | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | =head2 init | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | $ pmltq init resources/schema1.xml resources/schema2.xml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | Uses L<PMLTQ::Command::init> to generate initial configuration file skeleton | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | based on given schemas. This command can help you quickly bootstrap the layers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | =head2 initdb | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | $ pmltq initdb | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | Uses L<PMLTQ::Command::initdb> to create and initialize new database for given | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | treebank | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | =head2 load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | $ pmltq load | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | Uses L<PMLTQ::Command::load> to load the data generated by C<convert> command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | =head2 query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | Uses L<PMLTQ::Command::query> to run a query on given treebank. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | =head2 verify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | Uses L<PMLTQ::Command::verify> to check if database exists and contains some | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | data. For now the checking is very simple | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | =head2 version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | Uses L<PMLTQ::Command::version> to display current PMLTQ version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | =head2 webdelete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | Uses L<PMLTQ::Command::webdelete> to delete treebank from web interface | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | =head2 webload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | Uses L<PMLTQ::Command::webload> to load treebank to web interface | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | =head2 webtreebank | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | Uses L<PMLTQ::Command::webtreebank> to get list of treebanks or single treebank info | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | =head2 webverify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | Uses L<PMLTQ::Command::webverify> to verify treebank visibility in web interface | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | =head1 CONFIG FILE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | =head2 Options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | =item C<treebank_id> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | ID of the treebank. Can contain only [a-zA-Z0-9_]. It will be default for the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | database name and treebank name in web interface. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | =item C<data_dir> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | Directory where the data are (this is also base directory for data layers) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | Defaults: B<data> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | =item C<resources> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | Base directory for PML schemas | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | Defaults: B<resources> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | =item C<output_dir> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | Directory for all sql dump files. The files generated by C<convert> and used by C<load> command | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | Defaults: B<sql_dump> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | =item C<db> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | =item C<name> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | Database name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | Defaults: B<C<treebank_id>> if defined | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | =item C<host> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | Database server hostname or IP address | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | Defaults: B<localhost> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | =item C<port> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | Database port | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | Defaults: B<5432> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | =item C<user>, C<password> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | Database credentials | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | =item C<sys_db> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | Name of the 'system database' used for administration commands such as | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | C<CREATE> and C<DROP>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | =item C<layers> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | The configuration of treebank's layers and references for each layer. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | =item C<name> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | Schema root name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | =item C<data> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | A C<glob> path name matching pattern relative to C<data_dir> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | =item C<path> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | A path name matching pattern relative to PML-TQ server data directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | =item C<related-schema> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | List of related schemas that contain node types required in this layer's | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | reference configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | =item C<references> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | This is key-value hash where key is path to the member of the node structure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | and value is node type or '-' (dash) if you intend to ignore that particular | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | reference. If the node type is not in the current layer schema you have to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | prefix node type with the schema name and the appropriate schema have to be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | listed in C<related-schema> list. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | Examples: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | references: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | path/attr1: '-' #--> ignore this reference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | path/attr2: ref-node #--> reference node type 'ref-node' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | path/attr3: schema:other-node #--> reference node type 'other-node' in schema 'schema' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | =item C<title> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | Treebank title visible at the web. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | =item C<homepage> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | Treebank homepage url. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | =item C<description> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | Treebank description visible at the web. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | =item C<isFree> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | Boolean value (C<true>, C<false>) sets if the logging in is not required for querying treebank. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | Defaults: B<false> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | =item C<isAllLogged> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | Boolean value (C<true>, C<false>) sets if treebank is queryable for all logged in users. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | Defaults: B<false> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | =item C<isPublic> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | Boolean value (C<true>, C<false>) sets if the treebank is visible for not logged users. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | Defaults: B<false> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | =item C<isFeatured> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | Boolean value (C<true>, C<false>) sets if the treebank is featured. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | Defaults: B<false> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | =item C<web_api> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | =item C<dbserver> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | Name of database server setted in web interface. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | =item C<url> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | Link to PML-TQ web service. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | =item C<user>, C<password> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | Web API credentials of user with admin privileges. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | =item C<manuals> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | List of manuals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | =item C<title>, C<url> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | Title and link to manual | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | =item C<tags> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | List of tags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | =item C<language> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | Language code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | =item C<test_query> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | =item C<result_dir> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | Directory where should be saved results of test queries (SVG and text files) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | =item C<queries> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | =item C<filename> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | Name of the file where the results should be saved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | =item C<query> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | PML-TQ query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | =head2 Change values using CLI | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | You can use command line parameters to modify any configuration options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | For example you can use | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | pmltq load --output_dir='/some/path' --data_dir='some/other/path' --db-name='abc' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | Dash C<-> in the parameter's name means dive into the hash, so C<--db-name='abc'> is | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | going to change C<db: name: 'abc'> while C<--db_name='abc'> would just set configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | option C<db_name: 'abc'>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | =head2 Commands and options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | Following table shows which options are used in commands. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | =item B<*> required | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | =item B<+> optional (defaults or nothing is used) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | =item B<-> not used | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | =begin html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | <table> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | <tr><td></td><th>convert</th><th>delete</th><th>init</th><th>initdb</th><th>load</th><th>verify</th><th>webdelete</th><th>webload</th><th>webverify</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | <tr><td>treebank_id</td><th>*</th><th>*</th><th>-</th><th>*</th><th>*</th><th>*</th><th>*</th><th>*</th><th>*</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | <tr><td>data_dir</td><th>+</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | <tr><td>resources</td><th>+</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | <tr><td>output_dir</td><th>+</th><th>-</th><th>-</th><th>-</th><th>+</th><th>-</th><th>-</th><th>-</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | <tr><td>db-name</td><th>-</th><th>+</th><th>-</th><th>+</th><th>+</th><th>+</th><th>-</th><th>+</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | <tr><td>db-host</td><th>-</th><th>+</th><th>-</th><th>+</th><th>+</th><th>+</th><th>-</th><th>-</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | <tr><td>db-port</td><th>-</th><th>+</th><th>-</th><th>+</th><th>+</th><th>+</th><th>-</th><th>-</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | <tr><td>db-user</td><th>-</th><th>-</th><th>-</th><th>*</th><th>*</th><th>*</th><th>-</th><th>-</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | <tr><td>db-password</td><th>-</th><th>-</th><th>-</th><th>*</th><th>*</th><th>*</th><th>-</th><th>-</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | <tr><td>sys_db</td><th>-</th><th>*</th><th>-</th><th>*</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | <tr><td>layers</td><th>*</th><th>-</th><th>-</th><th>-</th><th>*</th><th>-</th><th>-</th><th>*</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | <tr><td>title</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>*</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | <tr><td>homepage</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>+</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | <tr><td>description</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>+</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | <tr><td>isFree</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>+</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | <tr><td>isPublic</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>+</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | <tr><td>isFeatured</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>+</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | <tr><td>web_api-dbserver</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>*</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | <tr><td>web_api-url</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>*</th><th>*</th><th>*</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | <tr><td>web_api-user</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>*</th><th>*</th><th>*</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | <tr><td>web_api-password</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>*</th><th>*</th><th>*</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | <tr><td>manuals</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>+</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | <tr><td>tags</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>+</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | <tr><td>language</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>+</th><th>-</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | <tr><td>test_query-result_dir</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>+</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | <tr><td>test_query-queries</td><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>+</th></tr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | </table> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | =end html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | =head2 Example: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | data_dir: /pmltq/data/dir/ # directory where the data are (this is also base directory for data layers) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | resources: /pmltq/resources/ # main directory with PML schemas | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | treebank_id: tbid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | db: # typical DB auth stuff | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | name: treebank_db_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | host: localhost | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | port: 5432 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | user: pmltq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | password: pwd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | layers: # description of all data layers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | - name: adata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | data: ./relative/to/data_dir/**/*.a.gz | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | related-schema: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | - adata_schema.xml | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | references: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | t-node/val_frame.rf: '-' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | t-a/aux.rf: 'adata:a-node' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | t-node/coref_gram.rf: t-node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | - name: tdata | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | data: **/*.t.gz | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | web_api: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | user: webuser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | password: pwd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | url: 'https://serviceurl.com/' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | dbserver: myserver | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | title: 'Treebank name' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | description: 'Short trebank descrioprion' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | language: cs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | tags: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | - mytag1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | - mytag2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||