File Coverage

blib/lib/RDF/Notation3/PrefTriples.pm
Criterion Covered Total %
statement 15 28 53.5
branch 1 4 25.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 20 38 52.6


line stmt bran cond sub pod time code
1 1     1   702 use strict;
  1         1  
  1         60  
2             #use warnings;
3              
4             package RDF::Notation3::PrefTriples;
5              
6             require 5.005_62;
7 1     1   6 use RDF::Notation3;
  1         3  
  1         23  
8 1     1   7 use RDF::Notation3::Template::TTriples;
  1         2  
  1         379  
9              
10             ############################################################
11              
12             @RDF::Notation3::PrefTriples::ISA =
13             qw(RDF::Notation3::Template::TTriples RDF::Notation3);
14              
15              
16             sub _process_statement {
17 33     33   53 my ($self, $subject, $properties) = @_;
18              
19 33         59 foreach (@$properties) {
20 35 50       78 if ($_->[0] ne 'i') {
21              
22 35         106 for (my $i = 1; $i < scalar @$_; $i++ ) {
23            
24 39         42 push @{$self->{triples}},
  39         304  
25             [$subject, $_->[0], $_->[$i], $self->{context}];
26             }
27             } else {
28             # inverse mode (is, <-)
29 0           shift @$_;
30              
31 0           for (my $i = 1; $i < scalar @$_; $i++ ) {
32            
33 0           push @{$self->{triples}},
  0            
34             [$_->[$i], $_->[0], $subject, $self->{context}];
35             }
36             }
37             }
38             }
39              
40              
41             sub add_triple {
42 0     0 0   my ($self, $s, $p, $o) = @_;
43              
44 0 0         $self->{triples} or $self->{triples} = [];
45              
46 0           $self->_check_resource($s, $s);
47 0           $self->_check_resource($s, $p);
48 0           $self->_check_resource($s, $o, 'l');
49              
50 0           push @{$self->{triples}}, [$s, $p, $o, '<>'];
  0            
51 0           return scalar @{$self->{triples}};
  0            
52             }
53              
54              
55             1;
56              
57              
58             __END__