graphdb-workbench
Version:
The web application for GraphDB APIs
2 lines • 13.6 kB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[31,104,105],{30:function(e,u){let F;angular.module("graphdb.framework.utils.uriutils",[]).factory("UriUtils",(function(){return{isValidIri:function(e){return void 0!==e&&!!e.match(F)},validateRdfUri:function(e){const u=e.indexOf("<")>=0&&e.indexOf(">")>=0,F=-1===e.indexOf("<")&&-1===e.lastIndexOf(">"),t=/^<?(http|urn).*>?/.test(e)&&(u||F);let r=!1;if(t)if(e.indexOf("http")>=0){const u=e.indexOf("//");r=u>4&&e.substring(u+2).length>0}else e.indexOf("urn")>=0&&(r=e.substring(4).length>0);return t&&r}}}));try{F=new RegExp("^[a-z](?:[-a-z0-9\\+\\.])*:(?:\\/\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:])*@)?(?:\\[(?:(?:(?:[0-9a-f]{1,4}:){6}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|::(?:[0-9a-f]{1,4}:){5}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-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,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+[-a-z0-9\\._~!\\$&'\\(\\)\\*\\+,;=:]+)\\]|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}|(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=@])*)(?::[0-9]*)?(?:\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))*)*|\\/(?:(?:(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))+)(?:\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))*)*)?|(?:(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))+)(?:\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))*)*|(?!(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@])))(?:\\?(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@])|[\\u{E000}-\\u{F8FF}\\u{F0000}-\\u{FFFFD}\\u{100000}-\\u{10FFFD}\\/\\?])*)?(?:#(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@])|[\\/\\?])*)?$","ui")}catch(e){F=new RegExp("^[a-z](?:[-a-z0-9\\+\\.])*:","i")}},31:function(e,u){function F(e){return{showToastMessageWithDelay:function(u){return new Promise(F=>{e.success(u),setTimeout(F,200)})}}}angular.module("graphdb.framework.utils.notifications",[]).factory("Notifications",F),F.$inject=["toastr"]},80:function(e,u,F){"use strict";F.r(u);F(2),F(8),F(11),F(31),F(30);function t(e,u,F,t,r){e.pluginName="sparql-template",e.setPluginIsActive=function(u){e.pluginIsActive=u},e.getSparqlTemplates=function(){!u.getActiveRepository()||u.isActiveRepoOntopType()||u.isActiveRepoFedXType()?e.sparqlTemplateIds=[]:F.getSparqlTemplates().success((function(u){e.sparqlTemplateIds=u})).error((function(e){const u=getError(e);t.error(u,"Could not get SPARQL templates")}))},e.$watch((function(){return u.getActiveRepository()}),(function(){e.getSparqlTemplates()})),e.deleteTemplate=function(u){r.openSimpleModal({title:"Warning",message:"Are you sure you want to delete the SPARQL template '"+u+"'?",warning:!0}).result.then((function(){F.deleteSparqlTemplate(u).success((function(){t.success(u,"Deleted successfully SPARQL template"),e.getSparqlTemplates()})).error((function(e){t.error(getError(e),`Could not delete ${u} template`)}))}))}}function r(e,u,F,t,r,n,a,o,i,s,D){const c=u.hash()||"";e.templateID=(u.search().templateID||"")+(c?`#${c}`:""),e.title=(e.templateID?"Edit":"Create")+" SPARQL Template",e.getNamespaces=function(){y(!0,"Refreshing namespaces","Normally this is a fast operation but it may take longer if a bigger repository needs to be initialised first."),o.getRepositoryNamespaces().success((function(u){const F={};u.results.bindings.forEach((function(e){F[e.prefix.value]=e.namespace.value})),e.namespaces=F})).error((function(u){e.repositoryError=getError(u)})).finally((function(){y(!1),w()}))},e.setLoader=y,e.addKnownPrefixes=E,e.noPadding={paddingRight:0,paddingLeft:0},e.currentTabConfig={},e.orientationViewMode=!0,e.currentQuery={};let l=!1;e.$watch((function(){return t.getActiveRepository()}),(function(e,F){e!==F&&u.path("/sparql-templates")}));let f=null;e.goBack=function(){f=n((function(){r.history.back()}),1e3)};const p=e.$on("$locationChangeStart",(function(u){!function(u){e.currentQuery.isPristine||(confirm("You have unsaved changes. Are you sure that you want to exit?")?(window.removeEventListener("beforeunload",d),p(),n.cancel(f)):u.preventDefault())}(u)}));function d(u){e.currentQuery.isPristine||(u.returnValue=!0)}window.addEventListener("beforeunload",d),e.$on("$destroy",(function(e){window.removeEventListener("beforeunload",d),p(),n.cancel(f)}));const m={templateID:"",query:"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX ex: <http://example.com#>\nDELETE {\n ?subject ex:myPredicate ?oldValue .\n} INSERT {\n ?subject ex:myPredicate ?newValue .\n} WHERE {\n ?id rdf:type ex:MyType .\n ?subject ex:isRelatedTo ?id .\n}\n",inference:!0,sameAs:!0,isNewTemplate:!0,isPristine:!0};var g;function y(u,F,t){const r=angular.element(document.getElementById("yasr-inner"));e.queryIsRunning=u,u?(e.queryStartTime=Date.now(),e.countTimeouted=!1,e.progressMessage=F,e.extraMessage=t,r.addClass("hide")):(e.progressMessage="",e.extraMessage="",r.removeClass("hide")),null===e.$$phase&&e.$apply()}function w(){e.tabsData=[e.currentQuery];const u=e.currentQuery;e.currentQuery.query?window.editor.setValue(e.currentQuery.query):window.editor.setValue(" "),n((function(){e.currentTabConfig={},e.currentTabConfig.queryType=u.queryType,e.currentTabConfig.resultsCount=u.resultsCount,e.currentTabConfig.offset=u.offset,e.currentTabConfig.allResultsCount=u.allResultsCount,e.currentTabConfig.page=u.page,e.currentTabConfig.pageSize=u.pageSize,e.currentTabConfig.timeFinished=u.timeFinished,e.currentTabConfig.timeTook=u.timeTook,e.currentTabConfig.sizeDelta=u.sizeDelta,e.$apply()}),0),e.canWriteActiveRepo()||(window.editor.options.readOnly=!0)}function C(){e.tabsData=e.tabs=[m],e.currentQuery=angular.copy(m),window.editor&&(e.setQuery(e.currentQuery.query),w()),e.$watch((function(){return e.currentQuery.query}),(function(u,F){u!==F&&e.setDirty()}))}function E(){i.addKnownPrefixes(JSON.stringify(window.editor.getValue())).success((function(e){angular.isDefined(window.editor)&&angular.isDefined(e)&&e!==window.editor.getValue()&&window.editor.setValue(e)})).error((function(e){const u=getError(e);return F.error(u,"Error! Could not add known prefixes"),!0}))}function T(){a.createSparqlTemplate(e.currentQuery).success((function(){e.currentQuery.isPristine=!0,e.currentQuery.isNewTemplate=!1,F.success(e.currentQuery.templateID,"Saved SPARQL template"),e.goBack()})).error((function(u){const t=getError(u);F.error(t,`Could not save ${e.currentQuery.templateID} template`)}))}e.saveTab=function(){},e.setQuery=function(e){window.editor.setValue(e||" ")},e.templateID?(g=e.templateID,a.getSparqlTemplate(g).success((function(e){m.query=e,m.templateID=g,m.isNewTemplate=!g,C()})).error((function(u){const t=getError(u);F.error(t,`Could not get ${e.currentQuery.templateID} template`),e.repositoryError=t}))):C(),e.saveTemplate=function(){(function(){if(!window.editor||"update"!==window.editor.getQueryMode())return F.error("The template query must be an UPDATE query","Invalid query"),!1;return!0})()&&(e.currentQuery.templateID?(e.isInvalidTemplateId=!s.isValidIri(e.currentQuery.templateID),e.isInvalidTemplateId||(e.currentQuery.isNewTemplate?a.getSparqlTemplates().success((function(u){l=u.find(u=>u===e.currentQuery.templateID)})).error((function(e){const u=getError(e);F.error(u,"Could not get SPARQL templates")})).then(()=>{if(l){const u=`<div>SPARQL Template <strong>${e.currentQuery.templateID}</strong> already exists.</div><br>\n <div><span class="icon-2x icon-warning" style="color: #d54a33"/> Do you want to override the template query?</div>`;D.openSimpleModal({title:"Confirm save",message:u,warning:!0}).result.then((function(){T()}))}else T()}):e.currentQuery.isPristine?e.goBack():a.updateSparqlTemplate(e.currentQuery).success((function(){e.currentQuery.isPristine=!0,e.currentQuery.isNewTemplate=!1,F.success(e.currentQuery.templateID,"Updated SPARQL template"),e.goBack()})).error((function(u){const t=getError(u);F.error(t,`Could not save ${e.currentQuery.templateID} template`)})))):F.error("SPARQL template IRI is required"))},$("textarea").on("paste",(function(){n((function(){E()}),0)})),e.setDirty=function(){e.currentQuery.isPristine=!1}}angular.module("graphdb.framework.sparql-template.controllers",["ui.bootstrap","graphdb.framework.core.services.repositories","graphdb.framework.rest.monitoring.service","toastr"],["graphdb.framework.utils.notifications"]).controller("SparqlTemplatesCtrl",t).controller("SparqlTemplateCreateCtrl",r),t.$inject=["$scope","$repositories","SparqlTemplatesRestService","toastr","ModalService"],r.$inject=["$scope","$location","toastr","$repositories","$window","$timeout","SparqlTemplatesRestService","RDF4JRepositoriesRestService","SparqlRestService","UriUtils","ModalService"]}}]);
//# sourceMappingURL=31.24f3ae9dcb27508b5a20.bundle.js.map