| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package FAIR::Profile::Class; |
|
2
|
|
|
|
|
|
|
$FAIR::Profile::Class::VERSION = '0.230'; |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: A FAIR Class is a meta representation of a data resources Class |
|
6
|
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
31
|
use strict; |
|
|
6
|
|
|
|
|
16
|
|
|
|
6
|
|
|
|
|
202
|
|
|
8
|
6
|
|
|
6
|
|
30
|
use Carp; |
|
|
6
|
|
|
|
|
9
|
|
|
|
6
|
|
|
|
|
419
|
|
|
9
|
6
|
|
|
6
|
|
34
|
use Moose; |
|
|
6
|
|
|
|
|
34
|
|
|
|
6
|
|
|
|
|
59
|
|
|
10
|
6
|
|
|
6
|
|
39037
|
use FAIR::NAMESPACES; |
|
|
6
|
|
|
|
|
11
|
|
|
|
6
|
|
|
|
|
601
|
|
|
11
|
6
|
|
|
6
|
|
36
|
use vars qw($AUTOLOAD @ISA); |
|
|
6
|
|
|
|
|
10
|
|
|
|
6
|
|
|
|
|
369
|
|
|
12
|
6
|
|
|
6
|
|
2794
|
use FAIR::Profile::SerializableProperty; |
|
|
6
|
|
|
|
|
16
|
|
|
|
6
|
|
|
|
|
244
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
6
|
|
|
6
|
|
66
|
use base 'FAIR::Base'; |
|
|
6
|
|
|
|
|
13
|
|
|
|
6
|
|
|
|
|
833
|
|
|
15
|
6
|
|
|
6
|
|
40
|
no if $] >= 5.017011, warnings => 'experimental::smartmatch'; # perl 5.18 warns about smartmatch... |
|
|
6
|
|
|
|
|
9
|
|
|
|
6
|
|
|
|
|
61
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
#use vars qw /$VERSION/; |
|
18
|
|
|
|
|
|
|
#$VERSION = sprintf "%d.%02d", q$Revision: 1.5 $ =~ /: (\d+)\.(\d+)/; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has URI => ( |
|
36
|
|
|
|
|
|
|
is => 'rw', |
|
37
|
|
|
|
|
|
|
isa => "Str", |
|
38
|
|
|
|
|
|
|
builder => '_generate_URI', |
|
39
|
|
|
|
|
|
|
); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has type => ( |
|
42
|
|
|
|
|
|
|
is => 'rw', |
|
43
|
|
|
|
|
|
|
isa => 'ArrayRef[Str]', |
|
44
|
|
|
|
|
|
|
traits => [qw/Serializable/], # it is, but it is handled differently than most serializable traits |
|
45
|
|
|
|
|
|
|
default => sub {[FAIR.'FAIRClass']}, |
|
46
|
|
|
|
|
|
|
); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has label => ( |
|
49
|
|
|
|
|
|
|
is => 'rw', |
|
50
|
|
|
|
|
|
|
isa => "Str", |
|
51
|
|
|
|
|
|
|
default => 'FAIR Profile Class', |
|
52
|
|
|
|
|
|
|
traits => [qw/Serializable/], |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has hasProperty => ( |
|
56
|
|
|
|
|
|
|
is => 'rw', |
|
57
|
|
|
|
|
|
|
isa => 'ArrayRef[FAIR::Profile::Property]', |
|
58
|
|
|
|
|
|
|
traits => [qw/Serializable/], |
|
59
|
|
|
|
|
|
|
writer => '_add_Property', |
|
60
|
|
|
|
|
|
|
default => sub {[]}, |
|
61
|
|
|
|
|
|
|
); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has provenance => ( |
|
64
|
|
|
|
|
|
|
is => 'rw', |
|
65
|
|
|
|
|
|
|
isa => 'FAIR::Profile', |
|
66
|
|
|
|
|
|
|
traits => [qw/Serializable/], |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
has onClassType => ( # represents the OWL Class URI |
|
70
|
|
|
|
|
|
|
is => 'rw', |
|
71
|
|
|
|
|
|
|
isa => "Str", # TODO - this should be constrained to be a URI |
|
72
|
|
|
|
|
|
|
traits => [qw/Serializable/], |
|
73
|
|
|
|
|
|
|
); |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _generate_URI { |
|
77
|
1
|
|
|
1
|
|
312
|
my ($self, $newval) = @_; |
|
78
|
1
|
50
|
|
|
|
4
|
return $newval if $newval; |
|
79
|
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
10
|
my $ug = UUID::Generator::PurePerl->new(); |
|
81
|
1
|
|
|
|
|
8
|
my $ug1 = $ug->generate_v4()->as_string; |
|
82
|
1
|
|
|
|
|
4070
|
return "http://datafairport.org/sampledata/profileschemaclass/$ug1"; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub add_Property { |
|
86
|
6
|
|
|
6
|
1
|
3693
|
my ($self, $p) = @_; |
|
87
|
|
|
|
|
|
|
# print STDERR "ADD PROPERTY TYPE:", $p->meta->name, "\n"; |
|
88
|
6
|
50
|
|
|
|
22
|
die "not a FAIR Profile Schema Property " .($p->type)."\n" unless (FAIR.'FAIRProperty' ~~ $p->type); |
|
89
|
6
|
|
|
|
|
128
|
my $ps = $self->hasProperty; |
|
90
|
6
|
|
|
|
|
14
|
push @$ps, $p; |
|
91
|
6
|
|
|
|
|
142
|
$self->_add_Property($ps); |
|
92
|
6
|
|
|
|
|
25
|
return 1; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
1; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
__END__ |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=pod |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=encoding UTF-8 |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 NAME |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
FAIR::Profile::Class - A FAIR Class is a meta representation of a data resources Class |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 VERSION |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
version 0.230 |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
use FAIR::Profile::Class; |
|
115
|
|
|
|
|
|
|
use FAIR::Profile::Property; |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
my $ProfileClass = FAIR::Profile::Class->new( |
|
118
|
|
|
|
|
|
|
class_type => DCAT."dataset", # DCAT is an exported constant |
|
119
|
|
|
|
|
|
|
URI => "http://example.org//ProfileClasses/ThisClass.rdf", |
|
120
|
|
|
|
|
|
|
label => "core metadata for the thesis submission" |
|
121
|
|
|
|
|
|
|
); |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
my $TitleProperty = FAIR::Profile::Property->new( |
|
124
|
|
|
|
|
|
|
property_type => DCT.'title', # DCT is an exported constant |
|
125
|
|
|
|
|
|
|
allow_multiple => "false", |
|
126
|
|
|
|
|
|
|
); |
|
127
|
|
|
|
|
|
|
$TitleProperty->set_RequirementStatus('required'); |
|
128
|
|
|
|
|
|
|
$TitleProperty->add_ValueRange(XSD."string"); |
|
129
|
|
|
|
|
|
|
$ProfileClass->add_Property($TitleProperty); |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
DCAT Class describes a group of metadata elements that should be |
|
134
|
|
|
|
|
|
|
associated with a given information entity. They ARE NOT containers for this metadata, |
|
135
|
|
|
|
|
|
|
they only describe what that metadata should look like (meta-meta-data :-) ) |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Effectively, this module groups-together a set of properties and their value-constraints. |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 NAME |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
FAIR::Profile::Class - a module representing a FAIR Profile Class |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 AUTHORS |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Mark Wilkinson (markw at illuminae dot com) |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 METHODS |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 new |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Title : new |
|
152
|
|
|
|
|
|
|
Usage : my $Class = FAIR::Profile::Class->new(); |
|
153
|
|
|
|
|
|
|
Function: Builds a new FAIR::Profile::Class |
|
154
|
|
|
|
|
|
|
Returns : FAIR::Profile::Class |
|
155
|
|
|
|
|
|
|
Args : label => $string |
|
156
|
|
|
|
|
|
|
class_type => $URI (possibly an OWL class URI) |
|
157
|
|
|
|
|
|
|
URI => $URI (optional - a unique URI will be auto-generated) |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 label |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Title : label |
|
162
|
|
|
|
|
|
|
Usage : $label = $Class->label($label); |
|
163
|
|
|
|
|
|
|
Function: get/set the RDF label for this object when serialized |
|
164
|
|
|
|
|
|
|
Returns : string |
|
165
|
|
|
|
|
|
|
Args : string |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head2 onClassType |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
Title : onClassType |
|
170
|
|
|
|
|
|
|
Usage : $class_type = $Class->onClassType($class_type); |
|
171
|
|
|
|
|
|
|
Function: get/set the class type (should be a URI, e.g. of an ontology class) |
|
172
|
|
|
|
|
|
|
Returns : string |
|
173
|
|
|
|
|
|
|
Args : string |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head2 URI |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Title : URI |
|
178
|
|
|
|
|
|
|
Usage : $uri = $Class->URI($uri); |
|
179
|
|
|
|
|
|
|
Function: get/set the URI for this Class - the URI in the RDF |
|
180
|
|
|
|
|
|
|
Returns : string (should be a URI) |
|
181
|
|
|
|
|
|
|
Args : string (should be a URI) |
|
182
|
|
|
|
|
|
|
notes: if this is not supplied, a unique URI will be automatically generated |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head2 add_Property |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Title : add_Property |
|
187
|
|
|
|
|
|
|
Usage : $Class->add_Property($Property); |
|
188
|
|
|
|
|
|
|
Function: add a new FAIR::Profile::Property to the Profile Class |
|
189
|
|
|
|
|
|
|
Returns : boolean (1 for success) |
|
190
|
|
|
|
|
|
|
Args : FAIR::Profile::Property |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 hasProperty |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Title : hasProperty |
|
195
|
|
|
|
|
|
|
Usage : $Class->hasProperty(); |
|
196
|
|
|
|
|
|
|
Function: Retrieve all properties of the Class |
|
197
|
|
|
|
|
|
|
Returns : listref of FAIR::Profile::Property objects |
|
198
|
|
|
|
|
|
|
Args : none |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head1 AUTHOR |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Mark Denis Wilkinson (markw [at] illuminae [dot] com) |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This software is Copyright (c) 2015 by Mark Denis Wilkinson. |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
This is free software, licensed under: |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=cut |