blib/lib/FAIR/AccessorConfig.pm untested

filter: Statementstmt 0.0% 0 / 46 Branchbran 0.0% 0 / 30 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 82 CC 16 SCAR 53.8
CC
16
Cov
0%
BUILD
272.0
BEGIN
2.0
BEGIN
2.0
CRAP 218.0
1 package FAIR::AccessorConfig;
2 $FAIR::AccessorConfig::VERSION = '1.0';
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 has 'title' => (
17 isa => 'Str',
18 is => 'rw',
19 );
20  
21 has 'serviceTextualDescription' => (
22 isa => 'Str',
23 is => 'rw'
24 );
25  
26 has 'textualAccessibilityInfo' => (
27 isa => 'Str',
28 is => 'rw',
29 );
30  
31 has 'mechanizedAccessibilityInfo' => (
32 isa => 'Str',
33 is => 'rw',
34 );
35  
36 has 'textualLicenseInfo' => (
37 isa => 'Str',
38 is => 'rw',
39 );
40  
41 has 'mechanizedLicenseInfo' => (
42 isa => 'Str',
43 is => 'rw',
44 );
45  
46 has 'basePATH' => (
47 isa => 'Str', # string representing a regular expression to be applied against $ENV{PATH_INFO}
48 is => 'rw',
49 );
50  
51 has 'localNamespaces' => (
52 isa => 'HashRef',
53 is => 'rw',
54 );
55  
56  
57 has 'Namespaces' => (
58 isa => "RDF::NS",
59 is => "rw",
60 default => sub {return RDF::NS->new('20131205')}
61 );
62  
63 has 'ETAG_Base' => (
64 isa => "Str",
65 is => "rw",
66 );
67  
68
69  
70 sub BUILD {
71 my ($self) = @_;
72 my $NS = $self->Namespaces;
73 die "can't set namespace $!\n" unless ($NS->SET(ldp => 'http://www.w3.org/ns/ldp#'));
74 die "can't set namespace $!\n" unless ($NS->SET(daml => "http://www.ksl.stanford.edu/projects/DAML/ksl-daml-desc.daml#"));
75 die "can't set namespace $!\n" unless ($NS->SET(edam => "http://edamontology.org/"));
76 die "can't set namespace $!\n" unless ($NS->SET(sio => "http://semanticscience.org/resource/"));
77 die "can't set namespace $!\n" unless ($NS->SET(example => 'http://example.org/ns#'));
78 die "can't set namespace $!\n" unless ($NS->SET(prov => 'http://www.w3.org/ns/prov#'));
79 die "can't set namespace $!\n" unless ($NS->SET(dctypes => 'http://purl.org/dc/dcmitype/'));
80 die "can't set namespace $!\n" unless ($NS->SET(pav => 'http://purl.org/pav/'));
81 die "can't set namespace $!\n" unless ($NS->SET(schemaorg => 'http://schema.org/'));
82 die "can't set namespace $!\n" unless ($NS->SET(void => 'http://rdfs.org/ns/void#'));
83 die "can't set namespace $!\n" unless ($NS->SET(fair => 'http://datafairport.org/ontology/FAIR-schema.owl#'));
84 die "can't set namespace $!\n" unless ($NS->SET(rr => 'http://www.w3.org/ns/r2rml#'));
85 die "can't set namespace $!\n" unless ($NS->SET(rml => 'http://semweb.mmlab.be/ns/rml#'));
86 die "can't set namespace $!\n" unless ($NS->SET(ql => 'http://semweb.mmlab.be/ns/ql#'));
87  
88 foreach my $abbreviation(keys %{$self->localNamespaces()}){
89 my $namespace = $self->localNamespaces()->{$abbreviation};
90 unless ($NS->SET($abbreviation => $namespace)){
91 print STDERR "Failed to set namespace $abbreviation == $namespace Make sure your abbreviation has no capital letters (Perl library quirk!)";
92 }
93 }
94  
95
96 }
97  
98 1;
99  
100 __END__
101  
102 =pod
103  
104 =encoding UTF-8
105  
106 =head1 NAME
107  
108 FAIR::AccessorConfig - The key/value of the current configuration of the Accessor
109  
110 =head1 VERSION
111  
112 version 1.0
113  
114 =head1 AUTHOR
115  
116 Mark Denis Wilkinson (markw [at] illuminae [dot] com)
117  
118 =head1 COPYRIGHT AND LICENSE
119  
120 This software is Copyright (c) 2016 by Mark Denis Wilkinson.
121  
122 This is free software, licensed under:
123  
124 The Apache License, Version 2.0, January 2004
125  
126 =cut