| 1 | package PMLTQ::Relation::PDT::ALexOrAuxRFIterator; | ||||||||||
| 2 | 12 | our $AUTHORITY = 'cpan:MATY'; | |||||||||
| 3 | 12 | $PMLTQ::Relation::PDT::ALexOrAuxRFIterator::VERSION = '1.5.0'; | |||||||||
| 4 | # ABSTRACT: a/lex.rf or a/aux.rf relation iterator for PDT like treebanks | ||||||||||
| 5 | |||||||||||
| 6 | 12 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 12 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 12 | ▶ | use base qw(PMLTQ::Relation::SimpleListIterator); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | use PMLTQ::Relation { | ||||||||||
| 10 | 12 | name => 'a/lex.rf|a/aux.rf', | |||||||||
| 11 | table_name => 'tdata__#a_rf', | ||||||||||
| 12 | schema => 'tdata', | ||||||||||
| 13 | tree_root => 't-root', | ||||||||||
| 14 | start_node_type => 't-node', | ||||||||||
| 15 | target_node_type => 'a-node', | ||||||||||
| 16 | iterator_class => __PACKAGE__, | ||||||||||
| 17 | iterator_weight => 2, | ||||||||||
| 18 | test_code => q(grep($_ eq $end->{id}, PMLTQ::Relation::PDT::TGetANodeIDs($start)) ? 1 : 0), | ||||||||||
| 19 | 12 | ▶ | }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | |||||||||||
| 21 | |||||||||||
| 22 | sub get_node_list { | ||||||||||
| 23 | 0 | ▶ | my ($self, $node) = @_; | ||||||||
|
Subroutine
get_node_list: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 24 | 0 | my $fsfile = $self->start_file; | |||||||||
| 25 | 0 | my $a_file = TAFile($fsfile); # TODO: TAFile is not defined !! | |||||||||
| 26 | 0 | ▶ | return [ $a_file ? map [ $_, $a_file ], PMLTQ::Relation::PDT::TGetANodes($node, $fsfile) : () ]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | sub init_sql { | ||||||||||
| 30 | 0 | ▶ | my ($table_name, $schema, $desc, $fh) = @_; | ||||||||
|
Subroutine
init_sql: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 31 | |||||||||||
| 32 | 0 | $fh->{'#POST_SQL'}->print(<<"EOF"); | |||||||||
| 33 | INSERT INTO "${table_name}" | ||||||||||
| 34 | SELECT t."#idx" AS "#idx", a."lex" AS "#value" | ||||||||||
| 35 | FROM "t-node" t JOIN "t-a" a ON a."#idx"=t."a" | ||||||||||
| 36 | UNION | ||||||||||
| 37 | SELECT t."#idx" AS "#idx", aux."#value" AS "#value" | ||||||||||
| 38 | FROM "t-node" t JOIN "t-a" a ON a."#idx"=t."a" JOIN "t-a/aux.rf" aux ON aux."#idx"=a."aux.rf" | ||||||||||
| 39 | UNION | ||||||||||
| 40 | SELECT r."#idx" AS "#idx", r."atree" FROM "t-root" r; | ||||||||||
| 41 | EOF | ||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 12 | 1; | |||||||||
| 45 | |||||||||||
| 46 | __END__ | ||||||||||