-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathall_items.js
216 lines (149 loc) · 6.07 KB
/
all_items.js
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
#!/usr/bin/env node
var fs = require('fs');
var allItems = [];
//a little function to help us read the file since we have three of them
var readItems = function(filename,callback){
console.log("Loading ",filename)
fs.readFile(filename, function (err, data) {
//split the file by line breaks and parse each line as a json object and insert it into our big array
data.toString().split("\n").forEach(function(line){
if (line.length>0)
allItems.push(JSON.parse(line));
});
callback();
});
}
readItems('../../../items/pd_items_1.ndjson',function(){
readItems('../../../items/pd_items_2.ndjson',function(){
readItems('../../../items/pd_items_3.ndjson',function(){
readItems('../../../items/pd_items_4.ndjson',function(){
allItems.forEach(function(item){
//lets print everything possible in the item!
//the title of the item, there can only be one title
console.log(item['title']);
// //the uuid is the unique identifier for the item
// console.log(item['UUID']);
// //the databaseID is another identifier for the item use in our database
// console.log(item['databaseID']);
// //there can be multiple 0 or more alternative titles
// for (var altTitle in item['alternativeTitle']){
// console.log(altTitle);
// }
// //contributor is a dictonary with these possible keys
// item['contributor'].forEach(function(contributor){
// //the name
// console.log(contributor['contributorName']);
// //the type, person, corporation, etc
// console.log(contributor['contributorType']);
// //the role they had in this item, such as author,Printmaker, Illustrator etc.
// contributor['contributorRole'].forEach(function(role){
// console.log(role);
// });
// //Their URI, a linked data identifier
// console.log(contributor['contributorURI']);
// });
// //the dates associated with this item
// item['date'].forEach(function(date){
// console.log(date);
// });
// //the "start" year of this item
// console.log(item['dateStart']);
// //the "end" year of this item
// console.log(item['dateEnd']);
// //the languages for this item
// item['language'].forEach(function(language){
// console.log(language);
// });
// //the description for this item
// item['description'].forEach(function(description){
// console.log(description);
// });
// //the notes can have:
// item['note'].forEach(function(note){
// //the type of the note
// console.log(note['type']);
// //and the text of the note
// console.log(note['text']);
// });
// //the subject headings of the item can have:
// item['subjectTopical'].forEach(function(subjectTopical){
// //the text of the subject
// console.log(subjectTopical['text']);
// //and the URI, or linked data identifier
// console.log(subjectTopical['URI']);
// });
// item['subjectName'].forEach(function(subjectName){
// console.log(subjectName['text']);
// console.log(subjectName['URI']);
// });
// item['subjectGeographic'].forEach(function(subjectGeographic){
// console.log(subjectGeographic['text']);
// console.log(subjectGeographic['URI']);
// });
// item['subjectTemporal'].forEach(function(subjectTemporal){
// console.log(subjectTemporal['text']);
// console.log(subjectTemporal['URI']);
// });
// item['subjectTitle'].forEach(function(subjectTitle){
// console.log(subjectTitle['text']);
// console.log(subjectTitle['URI']);
// });
// //the resource types for the item
// item['resourceType'].forEach(function(resourceType){
// console.log(resourceType);
// });
// //the genres for the item
// item['genre'].forEach(function(genre){
// console.log(genre['text']);
// console.log(genre['URI']);
// });
// //bNumber, our catalog number (catalog.nypl.org/record=b########)
// console.log(item['identifierBNumber']);
// //other identfiers
// console.log(item['identifierAccessionNumber']);
// console.log(item['identifierCallNumber']);
// console.log(item['identifierISBN']);
// console.log(item['identifierISSN']);
// console.log(item['identifierInterviewID']);
// console.log(item['identifierPostcardID']);
// console.log(item['identifierLCCN']);
// console.log(item['identifierOCLCRLIN']);
// //the extents for the item
// item['physicalDescriptionExtent'].forEach(function(physicalDescriptionExtent){
// console.log(physicalDescriptionExtent);
// });
// //the form for the item
// item['physicalDescriptionForm'].forEach(function(physicalDescriptionForm){
// console.log(physicalDescriptionForm);
// });
// //the publishers for the item
// item['publisher'].forEach(function(publisher){
// console.log(publisher);
// });
// //the publisher locations for the item
// item['placeOfPublication'].forEach(function(placeOfPublication){
// console.log(placeOfPublication);
// });
// //the collection UUID, which has its data in the collections.json
// console.log(item['collectionUUID']);
// //the container UUID, which is a sub-collection grouping of items
// console.log(item['containerUUID']);
// //the collection title
// console.log(item['collectionTitle']);
// //the container title
// console.log(item['containerTitle']);
// //The hierarchy of where this item is found in the collection, collection followed by containers seperated with "/""
// console.log(item['parentHierarchy']);
// //the count of the nubmer of images or captures for this item
// console.log(item['numberOfCaptures']);
// //the the URLs for each capture
// item['captures'].forEach(function(capture){
// console.log(capture);
// })
// //the the URLs for this item on the NYPL website
// console.log(item['digitalCollectionsURL']);
})
})
})
})
})