@@ -59,6 +59,7 @@ export class SparqlEditor extends HTMLElement {
5959 examplesRepoAddUrl : string | undefined ;
6060 addLimit : number | undefined ;
6161 dialogElOpen : HTMLDialogElement | undefined ;
62+ queryToGetExamples : string | undefined ;
6263 // TODO: make exampleQueries a dict with the query IRI as key, so if the window.location matches a key, it will load the query?
6364
6465 constructor ( ) {
@@ -121,7 +122,11 @@ export class SparqlEditor extends HTMLElement {
121122 this . meta [ endpoint ] . classes ,
122123 this . meta [ endpoint ] . predicates ,
123124 ] ,
124- ] = await Promise . all ( [ getExampleQueries ( endpoint ) , getPrefixes ( endpoint ) , getVoidDescription ( endpoint ) ] ) ;
125+ ] = await Promise . all ( [
126+ getExampleQueries ( endpoint , this . queryToGetExamples ) ,
127+ getPrefixes ( endpoint ) ,
128+ getVoidDescription ( endpoint ) ,
129+ ] ) ;
125130 this . meta [ endpoint ] . retrievedAt = new Date ( ) . toISOString ( ) ;
126131
127132 if ( Object . keys ( this . meta [ endpoint ] . prefixes ) . length === 0 ) {
@@ -201,6 +206,8 @@ export class SparqlEditor extends HTMLElement {
201206 this . endpoints = ( this . getAttribute ( "endpoint" ) || "" ) . split ( "," ) . map ( e => e . trim ( ) ) ;
202207 this . meta = this . loadMetaFromLocalStorage ( ) ;
203208
209+ this . queryToGetExamples = this . getAttribute ( "query-to-get-examples" ) || undefined ;
210+
204211 // NOTE: will need to be removed at some point I guess
205212 // Check if examples contain the index field, if not reset cache
206213 if ( this . currentEndpoint ( ) && this . currentEndpoint ( ) . examples ?. some ( example => example . iri === undefined ) ) {
0 commit comments