@igea/oac_backend 1.0.92 → 1.0.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/controllers/fuseki.js +32 -2
package/package.json
CHANGED
|
@@ -200,6 +200,25 @@ router.post('/upload/vocabularies', upload.array('files'), (req, res) => {
|
|
|
200
200
|
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
+
|
|
204
|
+
const key = req.params.key;
|
|
205
|
+
const cache = CacheVocabularies.check(key);
|
|
206
|
+
|
|
207
|
+
if (cache.exists) {
|
|
208
|
+
//res.setHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
209
|
+
//res.sendFile(path.resolve(cache.path));
|
|
210
|
+
res.type('text/turtle');
|
|
211
|
+
console.log("nuova versione "+filePath);
|
|
212
|
+
fs.createReadStream(filePath)
|
|
213
|
+
.on('error', err => {
|
|
214
|
+
console.error('STREAM ERROR:', err.code);
|
|
215
|
+
if (!res.headersSent) {
|
|
216
|
+
res.status(404).send('Cache missing');
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
.pipe(res);
|
|
220
|
+
|
|
221
|
+
|
|
203
222
|
//---------------------------------------------------------------
|
|
204
223
|
router.get('/get-vocabolary-terms/:key', (req, res) => {
|
|
205
224
|
const key = req.params.key;
|
|
@@ -211,8 +230,19 @@ router.get('/get-vocabolary-terms/:key', (req, res) => {
|
|
|
211
230
|
'Surrogate-Control': 'no-store'
|
|
212
231
|
});
|
|
213
232
|
if(cache.exists){
|
|
214
|
-
res.setHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
215
|
-
res.sendFile(path.resolve(cache.path));
|
|
233
|
+
//res.setHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
234
|
+
//res.sendFile(path.resolve(cache.path));
|
|
235
|
+
const filePath = cache.path;
|
|
236
|
+
res.type('text/turtle');
|
|
237
|
+
//console.log("nuova versione "+filePath);
|
|
238
|
+
fs.createReadStream(filePath)
|
|
239
|
+
.on('error', err => {
|
|
240
|
+
console.error('STREAM ERROR:', err.code);
|
|
241
|
+
if (!res.headersSent) {
|
|
242
|
+
res.status(404).send('Cache missing');
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
.pipe(res);
|
|
216
246
|
}else{
|
|
217
247
|
const rootIRI = `<http://diagnostica/vocabularies/${key}>`;
|
|
218
248
|
let _query = `PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/>
|