blib/lib/FAIR/AccessorConfig.pm untested

filter: Statementstmt 0.0% 0 / 48 Branchbran 0.0% 0 / 22 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 76 CC 12 SCAR 47.7
CC
12
Cov
0%
BUILD
156.0
BEGIN
2.0
BEGIN
2.0
CRAP 117.5
1 package FAIR::AccessorConfig;
2 $FAIR::AccessorConfig::VERSION = '0.41';
3  
4  
5 # ABSTRACT: The key/value of the current configuration of the Accessor
6  
7  
8 use strict;
9 use warnings;
10 use Moose;
11 use RDF::NS '20131205'; # check at compile time
12  
13 # define common metadata elements here, and their namespaces
14  
15  
16 my @CDE = qw(
17 dcat:contactPoint
18 dcat:description
19 dcat:distribution
20 dcat:frequency
21 dcat:identifier
22 dcat:keyword
23 dcat:landingPage
24 dcat:language
25 dcat:publisher
26 dcat:releaseDate
27 dcat:spatial
28 dcat:temporal
29 dcat:theme
30 dcat:license
31 dc:title
32 dcat:updateDate
33 void:entities
34 daml:has-Technical-Lead
35 daml:has-Administrative-Contact
36 daml:has-Program-Manager
37 daml:has-Principle-Investigator
38
39 ldp:contains
40  
41 );
42  
43 has 'title' => (
44 isa => 'Str',
45 is => 'rw',
46 );
47  
48 has 'serviceTextualDescription' => (
49 isa => 'Str',
50 is => 'rw'
51 );
52  
53 has 'textualAccessibilityInfo' => (
54 isa => 'Str',
55 is => 'rw',
56 );
57  
58 has 'mechanizedAccessibilityInfo' => (
59 isa => 'Str',
60 is => 'rw',
61 );
62  
63 has 'textualLicenseInfo' => (
64 isa => 'Str',
65 is => 'rw',
66 );
67  
68 has 'mechanizedLicenseInfo' => (
69 isa => 'Str',
70 is => 'rw',
71 );
72  
73 has 'basePATH' => (
74 isa => 'Str', # string representing a regular expression to be applied against $ENV{PATH_INFO}
75 is => 'rw',
76 );
77  
78 has 'localNamespaces' => (
79 isa => 'HashRef',
80 is => 'rw',
81 );
82  
83 has 'localMetadataElements' => (
84 isa => 'ArrayRef[Str]',
85 is => 'rw',
86 );
87  
88 has 'Namespaces' => (
89 isa => "RDF::NS",
90 is => "rw",
91 default => sub {return RDF::NS->new('20131205')}
92 );
93  
94 has 'ETAG_Base' => (
95 isa => "Str",
96 is => "rw",
97 );
98  
99 has 'MetadataElements' => (
100 isa => 'ArrayRef[Str]',
101 is => 'rw',
102 );
103  
104  
105  
106
107  
108 sub BUILD {
109 my ($self) = @_;
110 my $NS = $self->Namespaces;
111 die "can't set namespace $!\n" unless ($NS->SET(ldp => 'http://www.w3.org/ns/ldp#'));
112 die "can't set namespace $!\n" unless ($NS->SET(daml => "http://www.ksl.stanford.edu/projects/DAML/ksl-daml-desc.daml#"));
113 die "can't set namespace $!\n" unless ($NS->SET(edam => "http://edamontology.org/"));
114 die "can't set namespace $!\n" unless ($NS->SET(sio => "http://semanticscience.org/resource/"));
115 die "can't set namespace $!\n" unless ($NS->SET(example => 'http://example.org/ns#'));
116 die "can't set namespace $!\n" unless ($NS->SET(prov => 'http://www.w3.org/ns/prov#'));
117 die "can't set namespace $!\n" unless ($NS->SET(dctypes => 'http://purl.org/dc/dcmitype/'));
118 die "can't set namespace $!\n" unless ($NS->SET(pav => 'http://purl.org/pav/'));
119 die "can't set namespace $!\n" unless ($NS->SET(schemaorg => 'http://schema.org/'));
120 die "can't set namespace $!\n" unless ($NS->SET(void => 'http://rdfs.org/ns/void#'));
121  
122 foreach my $abbreviation(keys %{$self->localNamespaces()}){
123 my $namespace = $self->localNamespaces()->{$abbreviation};
124 unless ($NS->SET($abbreviation => $namespace)){
125 print STDERR "Failed to set namespace $abbreviation == $namespace Make sure your abbreviation has no capital letters (Perl library quirk!)";
126 }
127 }
128 my @MetaDataElements = (@CDE, @{$self->localMetadataElements()});
129 $self->MetadataElements(\@MetaDataElements); # concatinate local with common metadata elements
130
131 }
132  
133 1;
134  
135 __END__
136  
137 =pod
138  
139 =encoding UTF-8
140  
141 =head1 NAME
142  
143 FAIR::AccessorConfig - The key/value of the current configuration of the Accessor
144  
145 =head1 VERSION
146  
147 version 0.41
148  
149 =head1 AUTHOR
150  
151 Mark Denis Wilkinson (markw [at] illuminae [dot] com)
152  
153 =head1 COPYRIGHT AND LICENSE
154  
155 This software is Copyright (c) 2016 by Mark Denis Wilkinson.
156  
157 This is free software, licensed under:
158  
159 The Apache License, Version 2.0, January 2004
160  
161 =cut