line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1942
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
3
|
|
|
|
|
|
|
package RDF::Flow::Union; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$RDF::Flow::Union::VERSION = '0.178'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
#ABSTRACT: Returns the union of multiple sources |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
4
|
use Log::Contextual::WarnLogger; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
10
|
1
|
|
|
|
|
8
|
use Log::Contextual qw(:log), -default_logger |
11
|
1
|
|
|
1
|
|
4
|
=> Log::Contextual::WarnLogger->new({ env_prefix => __PACKAGE__ }); |
|
1
|
|
|
|
|
2
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
2144
|
use RDF::Flow::Source qw(sourcelist_args iterator_to_model); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use parent 'RDF::Flow::Source'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
|
|
|
|
|
|
my $class = shift; |
18
|
|
|
|
|
|
|
my ($inputs, $args) = RDF::Flow::Source::sourcelist_args( @_ ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $self = bless { |
21
|
|
|
|
|
|
|
inputs => $inputs, |
22
|
|
|
|
|
|
|
name => ($args->{name} || 'anonymous union'), |
23
|
|
|
|
|
|
|
}, $class; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$self->match( $args->{match} ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
return $self; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub about { |
31
|
|
|
|
|
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
$self->name($self) . ' with ' . $self->size . ' inputs'; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub retrieve_rdf { # TODO: try/catch errors? |
36
|
|
|
|
|
|
|
my ($self, $env) = @_; |
37
|
|
|
|
|
|
|
my $result; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
if ( $self->size == 1 ) { |
40
|
|
|
|
|
|
|
$result = $self->[0]->retrieve( $env ); |
41
|
|
|
|
|
|
|
} elsif( $self->size > 1 ) { |
42
|
|
|
|
|
|
|
$result = RDF::Trine::Model->new; |
43
|
|
|
|
|
|
|
foreach my $src ( $self->inputs ) { # TODO: parallel processing? |
44
|
|
|
|
|
|
|
my $rdf = $src->retrieve( $env ); |
45
|
|
|
|
|
|
|
next unless defined $rdf; |
46
|
|
|
|
|
|
|
$rdf = $rdf->as_stream unless $rdf->isa('RDF::Trine::Iterator'); |
47
|
|
|
|
|
|
|
iterator_to_model( $rdf, $result ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
return $result; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# experimental |
55
|
|
|
|
|
|
|
sub _graphviz_edgeattr { |
56
|
|
|
|
|
|
|
my ($self,$n) = @_; |
57
|
|
|
|
|
|
|
return (); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |
64
|
|
|
|
|
|
|
=pod |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 NAME |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
RDF::Flow::Union - Returns the union of multiple sources |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 VERSION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
version 0.178 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SYNOPSIS |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
use RDF::Flow qw(union); |
77
|
|
|
|
|
|
|
$src = union( @sources ); # shortcut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
use RDF::Flow::Union; |
80
|
|
|
|
|
|
|
$src = RDF::Flow::Union->new( @sources ); # explicit |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$rdf = $src->retrieve( $env ); |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 DESCRIPTION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This L<RDF::Flow> returns the union of responses of a set of input sources. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SEE ALSO |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
L<RDF::Flow::Cascade>, L<RDF::Flow::Pipeline>, |
91
|
|
|
|
|
|
|
L<RDF::Trine::Model::Union> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 AUTHOR |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Jakob Voà <voss@gbv.de> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Jakob VoÃ. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
102
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |
105
|
|
|
|
|
|
|
|