UNPKG

graphdb-workbench

Version:
2 lines 6.88 kB
export const __webpack_id__=39448;export const __webpack_ids__=[39448];export const __webpack_modules__={39448:()=>{const e="#query-editor",t="view.sparql-editor.title";PluginRegistry.add("guide.step",[{guideBlockName:"sparql-results-visual-button",getSteps:(e,r)=>{const n=r.GuideUtils;return[{guideBlockName:"clickable-element",options:{content:"guide.step_plugin.execute-sparql-query.visual-sparql-results.content",...e.mainAction?{}:{title:t},url:"sparql",elementSelector:n.CSS_SELECTORS.SPARQL_VISUAL_BUTTON_SELECTOR,class:"visual-sparql-results-button",scrollToHandler:n.scrollToTop,onNextClick:()=>n.clickOnElement(n.CSS_SELECTORS.SPARQL_VISUAL_BUTTON_SELECTOR)(),...e}}]}},{guideBlockName:"sparql-editor-run-button",getSteps:(r,n)=>{const o=n.GuideUtils,i=n.YasguiComponentDirectiveUtil;return[{guideBlockName:"clickable-element",options:{...r.mainAction?{}:{title:t},content:"guide.step_plugin.execute-sparql-query.run-sparql-query.content",url:"sparql",elementSelector:o.CSS_SELECTORS.SPARQL_RUN_BUTTON_SELECTOR,class:"yasgui-run-button",onNextClick:t=>i.getOntotextYasguiElementAsync(e).then(e=>{e.query(),t.next()}),scrollToHandler:o.scrollToTop,...r}}]}},{guideBlockName:"sparql-explain-editor",getSteps:(r,n)=>{const o=n.GuideUtils,i=n.YasguiComponentDirectiveUtil;return[{guideBlockName:"input-element",options:{...r.mainAction?{}:{title:t},url:"sparql",elementSelector:o.CSS_SELECTORS.SPARQL_EDITOR_SELECTOR,class:"sparql-explain-editor",beforeShowPromise:()=>i.getOntotextYasguiElementAsync(e).then(()=>o.waitFor(o.CSS_SELECTORS.SPARQL_EDITOR_SELECTOR,3)).then(()=>o.deferredShow(500)()).catch(e=>{throw n.toastr.error(n.$translate.instant("guide.unexpected.error.message")),e}),scrollToHandler:o.scrollToTop,extraContent:r.extraContent,...r}}]}},{guideBlockName:"sparql-editor",getSteps:(r,n)=>{const o=n.$translate,i=n.GuideUtils,s=n.YasguiComponentDirectiveUtil,l=document.createElement("code"),u=document.createElement("button"),a="guide-copy-to-editor-query-button";u.className=`btn btn-sm btn-secondary ${a}`,u.innerText=o.instant("guide.step_plugin.execute-sparql-query.copy-to-editor.button");const c=r.query,p=((e,t,r)=>n=>{n.preventDefault(),e.setQuery(t,r).then(()=>{})})(s,e,c);let S;return l.innerText=c,[{guideBlockName:"input-element",options:{...r.mainAction?{}:{title:t},content:"guide.step_plugin.execute-sparql-query.query-editor.content",url:"sparql",elementSelector:i.CSS_SELECTORS.SPARQL_EDITOR_SELECTOR,class:"yasgui-query-editor",queryAsHtmlCodeElement:'<div class="shepherd-code">'+l.outerHTML+u.outerHTML+"</div>",beforeShowPromise:()=>s.getOntotextYasguiElementAsync(e).then(()=>i.waitFor(i.CSS_SELECTORS.SPARQL_EDITOR_SELECTOR,3)).then(()=>i.deferredShow(500)()).catch(e=>{throw n.toastr.error(n.$translate.instant("guide.unexpected.error.message")),e}),onNextValidate:()=>s.getOntotextYasguiElementAsync(e).then(e=>e.getQuery().then(t=>({yasgui:e,queryFromEditor:t}))).then(({yasgui:e,queryFromEditor:t})=>(e.setQuery(c),!0)),scrollToHandler:i.scrollToTop,extraContent:r.queryExtraContent,show:e=>()=>{S=e.currentStep.el.querySelector(`.${a}`),S.addEventListener("click",p)},hide:()=>()=>{S&&S.removeEventListener("click",p)},...r}}]}},{guideBlockName:"sparql-results-explain",getSteps:(e,r)=>{const n=r.GuideUtils;return[{guideBlockName:"read-only-element",options:{...e.mainAction?{}:{title:t},content:"guide.step_plugin.sparql-results-explain.content",url:"sparql",placement:"top",elementSelector:n.CSS_SELECTORS.SPARQL_RESULTS_SELECTOR,class:"yasgui-query-results",fileName:e.fileName,scrollToHandler:n.scrollToTop,extraContent:e.resultExtraContent,canBePaused:!1,...e}}]}},{guideBlockName:"execute-sparql-query",getSteps:(t,r)=>{const n=r.GuideUtils,o=r.YasguiComponentDirectiveUtil,i=r.toastr,s=r.$translate,l=r.$interpolate,u=r.RoutingUtil;t.mainAction="execute-sparql-query";const a=[{guideBlockName:"click-main-menu",options:{menu:"sparql",showIntro:!0,...t}}],c={"-1":'PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nselect * where { \n\t?s ?p ?o .\n?o rdf:type ""\n} limit 100 '};let p=!1;return t.queries.forEach((S,d)=>{const m=S.query;c[d]=m,a.push({guideBlockName:"sparql-editor",options:{query:m,queryExtraContent:S.queryExtraContent,beforeShowPromise:()=>o.getOntotextYasguiElementAsync(e).then(()=>n.waitFor(n.CSS_SELECTORS.SPARQL_EDITOR_SELECTOR,3)).then(()=>n.deferredShow(500)()).catch(e=>{throw r.toastr.error(r.$translate.instant("guide.unexpected.error.message")),e}),onNextValidate:()=>o.getOntotextYasguiElementAsync(e).then(e=>e.getQuery().then(t=>({yasgui:e,queryFromEditor:t}))).then(({yasgui:e,queryFromEditor:r})=>{const o=n.removeWhiteSpaces(r);if(o!==n.removeWhiteSpaces(m)){if("select*where{?s?p?o.}limit100"!==o&&!p)return n.noNextErrorToast(i,s,l,"guide.step_plugin.execute-sparql-query.query-not-same.error",t),!1;e.setQuery(m)}return p=!0,!0}),initPreviousStep:()=>0===d?o.setQuery(e,"select * where { \n\t?s ?p ?o .\n} limit 100 \n"):("sparql"!==u.getCurrentRoute()&&u.navigate("/sparql"),n.waitFor(n.CSS_SELECTORS.SPARQL_EDITOR_SELECTOR).then(()=>o.executeSparqlQuery("#query-editor",m))),...t}}),a.push({guideBlockName:"sparql-editor-run-button",options:{initPreviousStep:(e,t)=>{const r=e.ShepherdService.getPreviousStepFromHistory(t);return r.options.initPreviousStep(e,r.options.id).then(()=>e.ShepherdService.getCurrentStepId()===t?Promise.resolve():o.executeSparqlQuery("#query-editor",m))},...t}}),a.push({guideBlockName:"sparql-results-explain",options:{extraContent:S.resultExtraContent,initPreviousStep:(t,r)=>{if("sparql"!==u.getCurrentRoute())return u.navigate("/sparql"),n.waitFor(n.CSS_SELECTORS.SPARQL_EDITOR_SELECTOR).then(()=>n.deferredShow(500)()).then(()=>o.executeSparqlQuery("#query-editor",m));const i=t.ShepherdService.getPreviousStepFromHistory(r);return i.options.initPreviousStep(t,i.options.id).then(()=>o.setQuery(e,m))},...t}})}),a}},{guideBlockName:"sparql-results-click-on-iri",getSteps:(e,r)=>{const n=r.GuideUtils;return[{guideBlockName:"clickable-element",options:{content:"guide.step_plugin.sparql-results-click-on-iri.content",placement:"top",...e.mainAction?{}:{title:t},...e,scrollToHandler:n.scrollToTop,elementSelector:n.getSparqlResultsSelectorForIri(e.iri),class:"table-graph-instance",url:"/sparql",onNextClick:(e,t)=>{n.waitFor(t.elementSelector,3).then(()=>$(t.elementSelector).trigger("click")).then(()=>e.next())}}}]}},{guideBlockName:"visualise-sparql-query",getSteps:e=>{const t=[];return e.useMainMenuNavigation&&t.push({guideBlockName:"click-main-menu",options:{menu:"sparql",mainAction:"execute-sparql-query",showIntro:!0,...e}}),t.push({guideBlockName:"sparql-editor",options:{query:e.query,queryExtraContent:e.queryExtraContent,...e}},{guideBlockName:"sparql-editor-run-button",options:{...e}},{guideBlockName:"sparql-results-visual-button",options:{...e}}),t}}])}}; //# sourceMappingURL=39448.a13651bf5e3b6385605b.bundle.js.map