@@ -283,8 +283,8 @@ export async function queryESCODataByName (filter: string, theClass:NamedNode, q
283283 . replace ( '$(targetClass)' , theClass . toNT ( ) )
284284 debug . log ( 'Querying ESCO data - uri: ' + queryURI )
285285
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 || ''
288288 debug . log ( ' Query result text' + text . slice ( 0 , 500 ) + '...' )
289289 if ( text . length === 0 ) throw new Error ( 'Wot no text back from ESCO query ' + queryURI )
290290 const json = JSON . parse ( text )
@@ -336,7 +336,7 @@ export async function queryPublicDataByName (
336336 const queryURI = substituteStrings ( queryTarget . searchByNameURI )
337337 let response
338338 try {
339- response = await kb . fetcher . webOperation ( 'GET' , queryURI , fetcherOptionsJsonPublicData )
339+ response = await kb . fetcher ? .webOperation ( 'GET' , queryURI , fetcherOptionsJsonPublicData )
340340 } catch ( err ) {
341341 throw new Error ( `Exception when trying to fetch ${ queryURI } \n ${ err } ` )
342342 }
@@ -377,9 +377,9 @@ export async function queryPublicDataSelect (sparql: string, queryTarget: QueryP
377377 headers : headers
378378 }
379379
380- const response = await kb . fetcher . webOperation ( 'GET' , queryURI , options )
380+ const response = await kb . fetcher ? .webOperation ( 'GET' , queryURI , options )
381381
382- const text = response . responseText || ''
382+ const text = response ? .responseText || ''
383383 if ( text . length === 0 ) throw new Error ( 'No text back from query ' + queryURI )
384384 const text2 = fixWikidataJSON ( text )
385385 const json = JSON . parse ( text2 )
@@ -403,8 +403,8 @@ export async function queryPublicDataConstruct (sparql: string, pubicId: NamedNo
403403 credentials : 'omit' as 'include' | 'omit' | undefined , // CORS // @tsc pain
404404 headers : headers // ({ Accept: 'text/turtle' } as Headers)
405405 }
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?'
408408 const report = text . length > 500 ? text . slice ( 0 , 200 ) + ' ... ' + text . slice ( - 200 ) : text
409409 debug . log ( ' queryPublicDataConstruct result text:' + report )
410410 if ( text . length === 0 ) throw new Error ( 'queryPublicDataConstruct: No text back from construct query:' + queryURI )
0 commit comments