|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Funstaff\RefLibRis; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* RisDefinition |
|
7
|
|
|
* |
|
8
|
|
|
* @author Bertrand Zuchuat <[email protected]> |
|
9
|
|
|
* @see http://referencemanager.com/sites/rm/files/m/direct_export_ris.pdf |
|
10
|
|
|
*/ |
|
11
|
|
|
class RisDefinition implements RisDefinitionInterface |
|
12
|
|
|
{ |
|
13
|
|
|
/** |
|
14
|
|
|
* @var array |
|
15
|
|
|
*/ |
|
16
|
|
|
protected static $fields = [ |
|
17
|
|
|
'TY' => 'Type', |
|
18
|
|
|
'A1' => 'Author Primary', |
|
19
|
|
|
'A2' => 'Secondary Author', |
|
20
|
|
|
'A3' => 'Tertiary Author', |
|
21
|
|
|
'A4' => 'Subsidiary Author', |
|
22
|
|
|
'AB' => 'Abstract', |
|
23
|
|
|
'AD' => 'Author Address', |
|
24
|
|
|
'AN' => 'Accession Number', |
|
25
|
|
|
'AU' => 'Author', |
|
26
|
|
|
'AV' => 'Availability', |
|
27
|
|
|
'BT' => 'field can contain alphanumeric characters', |
|
28
|
|
|
'C1' => 'Custom 1', |
|
29
|
|
|
'C2' => 'Custom 2', |
|
30
|
|
|
'C3' => 'Custom 3', |
|
31
|
|
|
'C4' => 'Custom 4', |
|
32
|
|
|
'C5' => 'Custom 5', |
|
33
|
|
|
'C6' => 'Custom 6', |
|
34
|
|
|
'C7' => 'Custom 7', |
|
35
|
|
|
'C8' => 'Custom 8', |
|
36
|
|
|
'CA' => 'Caption', |
|
37
|
|
|
'CN' => 'Call Number', |
|
38
|
|
|
'CP' => 'length limit to this field', |
|
39
|
|
|
'CT' => 'Unpublished Work references', |
|
40
|
|
|
'CY' => 'Place Published', |
|
41
|
|
|
'DA' => 'Date', |
|
42
|
|
|
'DB' => 'Name of Database', |
|
43
|
|
|
'DO' => 'DOI', |
|
44
|
|
|
'DP' => 'Database Provider', |
|
45
|
|
|
'ED' => 'preceded by this tag', |
|
46
|
|
|
'EP' => 'Ending page number', |
|
47
|
|
|
'ET' => 'Edition', |
|
48
|
|
|
'ID' => 'Reference ID', |
|
49
|
|
|
'IS' => 'Issue', |
|
50
|
|
|
'J1' => 'Periodical name: user abbreviation 1', |
|
51
|
|
|
'J2' => 'Periodical name: user abbreviation 2', |
|
52
|
|
|
'JA' => 'periodical in which the article was published', |
|
53
|
|
|
'JF' => 'Periodical name: full format', |
|
54
|
|
|
'JO' => 'Periodical name: standard abbreviation', |
|
55
|
|
|
'KW' => 'Keywords', |
|
56
|
|
|
'L1' => 'Link to PDF', |
|
57
|
|
|
'L2' => 'Link to Full-text', |
|
58
|
|
|
'L3' => 'Related Records', |
|
59
|
|
|
'L4' => 'Images', |
|
60
|
|
|
'LA' => 'Language', |
|
61
|
|
|
'LB' => 'Label', |
|
62
|
|
|
'M1' => 'Miscellaneous 1', |
|
63
|
|
|
'M2' => 'Miscellaneous 2', |
|
64
|
|
|
'M3' => 'Miscellaneous 3', |
|
65
|
|
|
'N1' => 'Notes', |
|
66
|
|
|
'N2' => 'Abstract', |
|
67
|
|
|
'NV' => 'Number of Volumes', |
|
68
|
|
|
'OP' => 'Original Publication', |
|
69
|
|
|
'PB' => 'Publisher', |
|
70
|
|
|
'PY' => 'Year (Format: YYYY/MM/DD/other info)', |
|
71
|
|
|
'RP' => 'Reprint status', |
|
72
|
|
|
'SP' => 'Start page number', |
|
73
|
|
|
'SN' => 'ISSN/ISBN', |
|
74
|
|
|
'T1' => 'Title Primary', |
|
75
|
|
|
'T2' => 'Title Secondary', |
|
76
|
|
|
'T3' => 'Title Series', |
|
77
|
|
|
'TI' => 'This field only for Whole Book', |
|
78
|
|
|
'U1' => 'User definable 1', |
|
79
|
|
|
'U2' => 'User definable 2', |
|
80
|
|
|
'U3' => 'User definable 3', |
|
81
|
|
|
'U4' => 'User definable 4', |
|
82
|
|
|
'U5' => 'User definable 5', |
|
83
|
|
|
'UR' => 'Web/URL', |
|
84
|
|
|
'VL' => 'Volume number', |
|
85
|
|
|
'Y1' => 'Date Primary', |
|
86
|
|
|
'Y2' => 'Date Secondary', |
|
87
|
|
|
]; |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @var array |
|
91
|
|
|
*/ |
|
92
|
|
|
protected static $types = [ |
|
93
|
|
|
'GEN' => 'Generic', |
|
94
|
|
|
'ABST' => 'Abstract', |
|
95
|
|
|
'AGGR' => 'Aggregated Database', |
|
96
|
|
|
'ANCIENT' => 'Ancient Text', |
|
97
|
|
|
'ART' => 'Artwork', |
|
98
|
|
|
'ADVS' => 'Audiovisual Material', |
|
99
|
|
|
'BILL' => 'Bill', |
|
100
|
|
|
'BLOG' => 'Blog', |
|
101
|
|
|
'BOOK' => 'Book', |
|
102
|
|
|
'CHAP' => 'Book Section', |
|
103
|
|
|
'CASE' => 'Case', |
|
104
|
|
|
'CTLG' => 'Catalog', |
|
105
|
|
|
'CHART' => 'Chart', |
|
106
|
|
|
'CLSWK' => 'Classical Work', |
|
107
|
|
|
'COMP' => 'Computer Program', |
|
108
|
|
|
'CPAPER' => 'Conference Paper', |
|
109
|
|
|
'CONF' => 'Conference Proceeding', |
|
110
|
|
|
'DATA' => 'Dataset', |
|
111
|
|
|
'DICT' => 'Dictionary', |
|
112
|
|
|
'EDBOOK' => 'Edited Book', |
|
113
|
|
|
'EBOOK' => 'Electronic Book', |
|
114
|
|
|
'ECHAP' => 'Electronic Book Section', |
|
115
|
|
|
'EJOUR' => 'Electronic Article', |
|
116
|
|
|
'ENCYC' => 'Encyclopedia', |
|
117
|
|
|
'EQUA' => 'Equation', |
|
118
|
|
|
'FIGURE' => 'Figure', |
|
119
|
|
|
'MPCT' => 'Film or Broadcast', |
|
120
|
|
|
'JFULL' => 'Full Journal', |
|
121
|
|
|
'GOVDOC' => 'Government Document', |
|
122
|
|
|
'GRNT' => 'Grant', |
|
123
|
|
|
'HEAR' => 'Hearing', |
|
124
|
|
|
'INPR' => 'In Press Article', |
|
125
|
|
|
'ICOMM' => 'Internet Communication', |
|
126
|
|
|
'JOUR' => 'Journal Article', |
|
127
|
|
|
'LEGAL' => 'Legal Rule', |
|
128
|
|
|
'MGZN' => 'Magazine Article', |
|
129
|
|
|
'MANSCPT' => 'Manuscript', |
|
130
|
|
|
'MAP' => 'Map', |
|
131
|
|
|
'MUSIC' => 'Music', |
|
132
|
|
|
'NEWS' => 'Newspaper Article', |
|
133
|
|
|
'DBASE' => 'Online Database', |
|
134
|
|
|
'MULTI' => 'Online Multimedia', |
|
135
|
|
|
'PAMP' => 'Pamphlet', |
|
136
|
|
|
'PAT' => 'Patent', |
|
137
|
|
|
'PCOMM' => 'Personal Communication', |
|
138
|
|
|
'RPRT' => 'Report', |
|
139
|
|
|
'SER' => 'Serial', |
|
140
|
|
|
'SLIDE' => 'Slide', |
|
141
|
|
|
'SOUND' => 'Sound Recording', |
|
142
|
|
|
'STAND' => 'Standard', |
|
143
|
|
|
'STAT' => 'Statute', |
|
144
|
|
|
'THES' => 'Thesis', |
|
145
|
|
|
'UNBILL' => 'Unenacted Bill', |
|
146
|
|
|
'UNPD' => 'Unpublished Work', |
|
147
|
|
|
'VIDEO' => 'Video Recording', |
|
148
|
|
|
'ELEC' => 'Web Page', |
|
149
|
|
|
]; |
|
150
|
|
|
|
|
151
|
|
|
/** |
|
152
|
|
|
* @param string $tag |
|
153
|
|
|
* @return bool |
|
154
|
|
|
*/ |
|
155
|
|
|
public function hasField(string $tag): bool |
|
156
|
|
|
{ |
|
157
|
|
|
return array_key_exists($tag, self::$fields); |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @return array |
|
162
|
|
|
*/ |
|
163
|
|
|
public function getFields(): array |
|
164
|
|
|
{ |
|
165
|
|
|
return array_keys(self::$fields); |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @param string $tag |
|
170
|
|
|
* @return mixed |
|
171
|
|
|
*/ |
|
172
|
|
|
public function getFieldDefinition(string $tag) |
|
173
|
|
|
{ |
|
174
|
|
|
if (!array_key_exists($tag, self::$fields)) { |
|
175
|
|
|
throw new \InvalidArgumentException('Field Tag not found.'); |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
return self::$fields[$tag]; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @param string $tag |
|
183
|
|
|
* @return bool |
|
184
|
|
|
*/ |
|
185
|
|
|
public function hasType(string $tag): bool |
|
186
|
|
|
{ |
|
187
|
|
|
return array_key_exists($tag, self::$types); |
|
188
|
|
|
} |
|
189
|
|
|
|
|
190
|
|
|
/** |
|
191
|
|
|
* @return array |
|
192
|
|
|
*/ |
|
193
|
|
|
public function getTypes(): array |
|
194
|
|
|
{ |
|
195
|
|
|
return array_keys(self::$types); |
|
196
|
|
|
} |
|
197
|
|
|
|
|
198
|
|
|
/** |
|
199
|
|
|
* @param string $tag |
|
200
|
|
|
* @return mixed |
|
201
|
|
|
*/ |
|
202
|
|
|
public function getTypeDefinition(string $tag) |
|
203
|
|
|
{ |
|
204
|
|
|
if (!array_key_exists($tag, self::$types)) { |
|
205
|
|
|
throw new \InvalidArgumentException('Type Tag not found.'); |
|
206
|
|
|
} |
|
207
|
|
|
|
|
208
|
|
|
return self::$types[$tag]; |
|
209
|
|
|
} |
|
210
|
|
|
} |
|
211
|
|
|
|