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