File Coverage

blib/lib/ODO/RDFS/Properties/isDefinedBy.pm
Criterion Covered Total %
statement 28 65 43.0
branch 0 10 0.0
condition 0 3 0.0
subroutine 10 14 71.4
pod 2 4 50.0
total 40 96 41.6


line stmt bran cond sub pod time code
1             package ODO::RDFS::Properties::isDefinedBy;
2              
3 1     1   8 use strict;
  1         3  
  1         43  
4 1     1   5 use warnings;
  1         2  
  1         31  
5              
6 1     1   5 use vars qw( @ISA );
  1         2  
  1         44  
7 1     1   5 use vars qw /$VERSION/;
  1         2  
  1         69  
8             $VERSION = sprintf "%d.%02d", q$Revision: 1.3 $ =~ /: (\d+)\.(\d+)/;
9              
10 1     1   5 use ODO;
  1         1  
  1         51  
11 1     1   6 use ODO::Query::Simple;
  1         8  
  1         35  
12 1     1   5 use ODO::Statement::Group;
  1         1  
  1         37  
13 1     1   5 use ODO::RDFS::Resource;
  1         1  
  1         26  
14 1     1   4 use ODO::RDFS::Properties::seeAlso;
  1         1  
  1         544  
15              
16             @ISA = ( 'ODO::RDFS::Resource', 'ODO::RDFS::Properties::seeAlso', );
17              
18             #
19             # Description: The defininition of the subject resource.
20             #
21             # Schema URI: http://www.w3.org/2000/01/rdf-schema#
22             #
23             sub new {
24 0     0 1 0 my $self = shift;
25 0         0 my ($resource, $graph, %properties) = @_;
26            
27 0         0 $self = $self->SUPER::new(@_);
28            
29             return undef
30 0 0       0 unless(ref $self);
31            
32 0         0 $self->propertyContainerName( 'ODO::RDFS::Properties::isDefinedBy::PropertiesContainer' );
33 0         0 $self->properties(bless {}, 'ODO::RDFS::Properties::isDefinedBy::PropertiesContainer');
34              
35 0         0 $self->properties()->{'parent'} = $self;
36              
37              
38 0         0 return $self;
39             }
40              
41             sub queryString {
42 0     0 0 0 return '(?subj, rdf:type, )';
43             }
44              
45             sub objectURI {
46 11     11 0 117 return 'http://www.w3.org/2000/01/rdf-schema#isDefinedBy';
47             }
48              
49             sub value {
50 0     0 1   my $self = shift;
51            
52 0 0         return $self->subject()
53             if(UNIVERSAL::isa($self->subject(), 'ODO::Node::Literal'));
54            
55 0           return $self->__to_statement_array();
56             }
57              
58             sub __to_statement_array {
59 0     0     my $self = shift;
60            
61 0           my $statements = [];
62            
63 0           foreach my $my_super (@ISA) {
64            
65             next
66 0 0         unless(UNIVERSAL::can($my_super, '__to_statement_array'));
67            
68 0           my $super_func = "${my_super}::__to_statement_array";
69 0           push @{ $statements }, @{ $self->$super_func() };
  0            
  0            
70             }
71            
72 0           my %properties = (''=> '',);
73            
74 0           foreach my $propertyName (keys(%properties)) {
75              
76             next
77 0 0 0       unless($propertyName && $propertyName ne '');
78            
79 0           my $property = $self->properties()->$propertyName();
80            
81 0           foreach my $p (@{ $property }) {
  0            
82 0           my $p_value = $p->value();
83            
84 0           my $property_uri = ODO::Node::Resource->new($properties{$propertyName}->objectURI() );
85 0 0         if(UNIVERSAL::isa($p_value, 'ODO::Node::Literal')) {
86 0           push @{ $statements }, ODO::Statement->new($self->subject(), $property_uri, $p_value);
  0            
87             }
88             else {
89 0           push @{ $statements }, ODO::Statement->new($self->subject(), $property_uri, $p->subject());
  0            
90 0           push @{ $statements }, @{ $p_value };
  0            
  0            
91             }
92             }
93             }
94            
95 0           return $statements;
96             }
97              
98             1;