lib/OWL/Data/OWL/DatatypeProperty.pm

filter: Statementstmt 97.9% 47 / 48 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 15 / 15 Podpod 100% 1 / 1 totaltotal 94.2% 66 / 70 CC 4 SCAR 4.3
CC
4
Cov
93%
_attr_prop
3.5
_accessible
2.1
BEGIN
1.0
CRAP 1.5
« lib/OWL/Data/Object.pm ↑ Summary lib/OWL/RDF/Predicates/DC_PROTEGE.pm »
1 #-----------------------------------------------------------------
2 # OWL::Data::OWL::DatatypeProperty
3 # Author: Edward Kawas <edward.kawas@gmail.com>,
4 # For copyright and disclaimer see below.
5 #
6 # $Id: DatatypeProperty.pm,v 1.5 2009-11-12 21:11:30 ubuntu Exp $
7 #-----------------------------------------------------------------
8 package OWL::Data::OWL::DatatypeProperty;
9 2 ▶use base ("OWL::Base");
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11
12 # imports
13 2 ▶use RDF::Core::Resource;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶use RDF::Core::Statement;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶use RDF::Core::Literal;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use RDF::Core::NodeFactory;
Subroutine BEGIN: called CC=1 SCAR=0.0
17
18 2 ▶use OWL::RDF::Predicates::DC_PROTEGE;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use OWL::RDF::Predicates::OMG_LSID;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use OWL::RDF::Predicates::OWL;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use OWL::RDF::Predicates::RDF;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use OWL::RDF::Predicates::RDFS;
Subroutine BEGIN: called CC=1 SCAR=0.0
23
24 # add versioning to this module
25 2 ▶use vars qw /$VERSION/;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 $VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /: (\d+)\.(\d+)/;
27
28 =head1 NAME
29
30 OWL::Data::OWL::DatatypeProperty
31
32 =head1 SYNOPSIS
33
34 use OWL::Data::OWL::DatatypeProperty;
35
36 # create an owl DatatypeProperty
37 my $data = OWL::Data::OWL::DatatypeProperty->new ();
38
39
40 =head1 DESCRIPTION
41
42 An object representing an OWL DatatypeProperty
43
44 =head1 AUTHORS
45
46 Edward Kawas (edward.kawas [at] gmail [dot] com)
47
48 =cut
49
50 #-----------------------------------------------------------------
51 # A list of allowed attribute names. See OWL::Base for details.
52 #-----------------------------------------------------------------
53
54 =head1 ACCESSIBLE ATTRIBUTES
55
56 Details are in L<OWL::Base>. Here just a list of them:
57
58 =over
59
60 =item B<value> - the value that this datatype property assumes
61
62 =item B<range> - the range of this datatype property
63
64 =item B<domain> - the domain for this datatype property
65
66 =item B<uri> - the uri of this datatype property
67
68 =back
69
70 =cut
71
72 =head1 subroutines
73
74 =cut
75
76 {
77 2 my %_allowed = (
78 value => {
79 type => OWL::Base->STRING,
80 },
81 range => { type => OWL::Base->STRING },
82 domain => { type => OWL::Base->STRING },
83 uri => { type => OWL::Base->STRING },
84 );
85
86 18 ▶ sub _accessible {
Subroutine _accessible: called CC=2 SCAR=7.2
87 18 my ( $self, $attr ) = @_;
88 18 ▶ exists $_allowed{$attr} or $self->SUPER::_accessible($attr);
Branch: 1 branch
BranchTrueFalseTotal
exists $_allowed{$attr} or $self->SUPER::_accessible($attr) 18 0 18
89 }
90
91 72 ▶ sub _attr_prop {
Subroutine _attr_prop: called CC=3 SCAR=12.5
92 72 my ( $self, $attr_name, $prop_name ) = @_;
93 72 my $attr = $_allowed{$attr_name};
94 72 ▶ return ref($attr) ? $attr->{$prop_name} : $attr if $attr;
Branch: 2 branches
BranchTrueFalseTotal
if $attr 72 0 72
ref $attr ? : 72 0 72
95 0 return $self->SUPER::_attr_prop( $attr_name, $prop_name );
96 }
97 }
98
99 #-----------------------------------------------------------------
100
101 =head1 SUBROUTINES
102
103 =cut
104
105 #-----------------------------------------------------------------
106 # init
107 #-----------------------------------------------------------------
108 2 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
109 18 my ($self) = shift;
110 18 $self->SUPER::init();
111 }
112
113 2 1;
114 __END__
« lib/OWL/Data/Object.pm ↑ Summary lib/OWL/RDF/Predicates/DC_PROTEGE.pm »