@@ -283,8 +283,8 @@ export async function queryESCODataByName (filter: string, theClass:NamedNode, q
283
283
. replace ( '$(targetClass)' , theClass . toNT ( ) )
284
284
debug . log ( 'Querying ESCO data - uri: ' + queryURI )
285
285
286
- const response = await kb . fetcher . webOperation ( 'GET' , queryURI , fetcherOptionsJsonPublicData )
287
- const text = response . responseText || ''
286
+ const response = await kb . fetcher ? .webOperation ( 'GET' , queryURI , fetcherOptionsJsonPublicData )
287
+ const text = response ? .responseText || ''
288
288
debug . log ( ' Query result text' + text . slice ( 0 , 500 ) + '...' )
289
289
if ( text . length === 0 ) throw new Error ( 'Wot no text back from ESCO query ' + queryURI )
290
290
const json = JSON . parse ( text )
@@ -336,7 +336,7 @@ export async function queryPublicDataByName (
336
336
const queryURI = substituteStrings ( queryTarget . searchByNameURI )
337
337
let response
338
338
try {
339
- response = await kb . fetcher . webOperation ( 'GET' , queryURI , fetcherOptionsJsonPublicData )
339
+ response = await kb . fetcher ? .webOperation ( 'GET' , queryURI , fetcherOptionsJsonPublicData )
340
340
} catch ( err ) {
341
341
throw new Error ( `Exception when trying to fetch ${ queryURI } \n ${ err } ` )
342
342
}
@@ -377,9 +377,9 @@ export async function queryPublicDataSelect (sparql: string, queryTarget: QueryP
377
377
headers : headers
378
378
}
379
379
380
- const response = await kb . fetcher . webOperation ( 'GET' , queryURI , options )
380
+ const response = await kb . fetcher ? .webOperation ( 'GET' , queryURI , options )
381
381
382
- const text = response . responseText || ''
382
+ const text = response ? .responseText || ''
383
383
if ( text . length === 0 ) throw new Error ( 'No text back from query ' + queryURI )
384
384
const text2 = fixWikidataJSON ( text )
385
385
const json = JSON . parse ( text2 )
@@ -403,8 +403,8 @@ export async function queryPublicDataConstruct (sparql: string, pubicId: NamedNo
403
403
credentials : 'omit' as 'include' | 'omit' | undefined , // CORS // @tsc pain
404
404
headers : headers // ({ Accept: 'text/turtle' } as Headers)
405
405
}
406
- const response = await kb . fetcher . webOperation ( 'GET' , queryURI , options )
407
- const text = response . responseText || 'No response text?'
406
+ const response = await kb . fetcher ? .webOperation ( 'GET' , queryURI , options )
407
+ const text = response ? .responseText || 'No response text?'
408
408
const report = text . length > 500 ? text . slice ( 0 , 200 ) + ' ... ' + text . slice ( - 200 ) : text
409
409
debug . log ( ' queryPublicDataConstruct result text:' + report )
410
410
if ( text . length === 0 ) throw new Error ( 'queryPublicDataConstruct: No text back from construct query:' + queryURI )
0 commit comments