|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author SignpostMarv |
|
4
|
|
|
*/ |
|
5
|
|
|
declare(strict_types=1); |
|
6
|
|
|
|
|
7
|
|
|
namespace SignpostMarv\DaftObject\SchemaOrg\CreativeWork; |
|
8
|
|
|
|
|
9
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\CreativeWork as Base; |
|
10
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits; |
|
11
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\PropertyValue; |
|
12
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @property array<int, MediaObject\DataDownload> $distribution |
|
16
|
|
|
* @property array<int, DataCatalog> $includedInDataCatalog |
|
17
|
|
|
* @property array<int, string> $issn |
|
18
|
|
|
* @property array<int, string> $measurementTechnique |
|
19
|
|
|
* @property array<int, string|PropertyValue> $variableMeasured |
|
20
|
|
|
*/ |
|
21
|
|
|
class Dataset extends Base |
|
22
|
|
|
{ |
|
23
|
|
|
use DaftObjectTraits\Issn; |
|
24
|
|
|
use DaftObjectTraits\MeasurementTechnique; |
|
25
|
|
|
|
|
26
|
|
|
const SCHEMA_ORG_TYPE = 'Dataset'; |
|
27
|
|
|
|
|
28
|
|
|
const PROPERTIES = [ |
|
29
|
|
|
'distribution', |
|
30
|
|
|
'includedInDataCatalog', |
|
31
|
|
|
'issn', |
|
32
|
|
|
'measurementTechnique', |
|
33
|
|
|
'variableMeasured', |
|
34
|
|
|
]; |
|
35
|
|
|
|
|
36
|
|
|
const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [ |
|
37
|
|
|
'distribution' => [ |
|
38
|
|
|
MediaObject\DataDownload::class, |
|
39
|
|
|
], |
|
40
|
|
|
'includedInDataCatalog' => [ |
|
41
|
|
|
DataCatalog::class, |
|
42
|
|
|
], |
|
43
|
|
|
'issn' => [ |
|
44
|
|
|
'string', |
|
45
|
|
|
], |
|
46
|
|
|
'measurementTechnique' => [ |
|
47
|
|
|
'string', |
|
48
|
|
|
], |
|
49
|
|
|
'variableMeasured' => [ |
|
50
|
|
|
'string', |
|
51
|
|
|
PropertyValue::class, |
|
52
|
|
|
], |
|
53
|
|
|
]; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @return array<int, MediaObject\DataDownload> |
|
57
|
|
|
*/ |
|
58
|
11 |
|
public function GetDistribution() : array |
|
59
|
|
|
{ |
|
60
|
|
|
/** |
|
61
|
|
|
* @var array<int, MediaObject\DataDownload> |
|
62
|
|
|
*/ |
|
63
|
11 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
64
|
11 |
|
'distribution', |
|
65
|
11 |
|
$this->RetrievePropertyValueFromData('distribution'), |
|
66
|
11 |
|
static::class |
|
67
|
|
|
); |
|
68
|
|
|
|
|
69
|
11 |
|
return $out; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param array<int, MediaObject\DataDownload> $value |
|
74
|
|
|
*/ |
|
75
|
2 |
|
public function SetDistribution(array $value) : void |
|
76
|
|
|
{ |
|
77
|
2 |
|
$this->NudgePropertyValue( |
|
78
|
2 |
|
'distribution', |
|
79
|
2 |
|
$value |
|
80
|
|
|
); |
|
81
|
2 |
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @return array<int, DataCatalog> |
|
85
|
|
|
*/ |
|
86
|
11 |
|
public function GetIncludedInDataCatalog() : array |
|
87
|
|
|
{ |
|
88
|
|
|
/** |
|
89
|
|
|
* @var array<int, DataCatalog> |
|
90
|
|
|
*/ |
|
91
|
11 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
92
|
11 |
|
'includedInDataCatalog', |
|
93
|
11 |
|
$this->RetrievePropertyValueFromData('includedInDataCatalog'), |
|
94
|
11 |
|
static::class |
|
95
|
|
|
); |
|
96
|
|
|
|
|
97
|
11 |
|
return $out; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @param array<int, DataCatalog> $value |
|
102
|
|
|
*/ |
|
103
|
2 |
|
public function SetIncludedInDataCatalog(array $value) : void |
|
104
|
|
|
{ |
|
105
|
2 |
|
$this->NudgePropertyValue( |
|
106
|
2 |
|
'includedInDataCatalog', |
|
107
|
2 |
|
$value |
|
108
|
|
|
); |
|
109
|
2 |
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @return array<int, string|PropertyValue> |
|
113
|
|
|
*/ |
|
114
|
11 |
|
public function GetVariableMeasured() : array |
|
115
|
|
|
{ |
|
116
|
|
|
/** |
|
117
|
|
|
* @var array<int, string|PropertyValue> |
|
118
|
|
|
*/ |
|
119
|
11 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
120
|
11 |
|
'variableMeasured', |
|
121
|
11 |
|
$this->RetrievePropertyValueFromData('variableMeasured'), |
|
122
|
11 |
|
static::class |
|
123
|
|
|
); |
|
124
|
|
|
|
|
125
|
11 |
|
return $out; |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @param array<int, string|PropertyValue> $value |
|
130
|
|
|
*/ |
|
131
|
2 |
|
public function SetVariableMeasured(array $value) : void |
|
132
|
|
|
{ |
|
133
|
2 |
|
$this->NudgePropertyValue( |
|
134
|
2 |
|
'variableMeasured', |
|
135
|
2 |
|
$value, |
|
136
|
2 |
|
self::BOOL_DEFAULT_AUTOTRIMSTRINGS |
|
137
|
|
|
); |
|
138
|
2 |
|
} |
|
139
|
|
|
} |
|
140
|
|
|
|