UNPKG

graphdb-workbench

Version:
2 lines 7.9 kB
(window.webpackJsonp=window.webpackJsonp||[]).push([[58],{54:function(e,r,t){"use strict";t.r(r);t(4);const s=400,n=50,o=1500,a=25;function i(e,r,t,i,c,l,u,d,f,h,p,g,m,C,y){e.classHierarchyData={},e.instancesObj={},e.instancesQueryObj={},e.instancesObj.items=[],e.instancesNotFiltered=[],e.isWarningShowed=!1,e.onopen=e.onclose=()=>angular.noop(),e.currentBrowserLimit=2e3,g.firefox?e.currentBrowserLimit=n:(g.safari||g.msie||g.msedge)&&(e.currentBrowserLimit=s);const S={};let w=0,R=0;r.key="",S.get=function(r,t,s){return d.initLazyList(r,t,s,w,e.instancesObj.items)};let b=allGraphs;const E=function(){if(e.getActiveRepository())return y.resolveGraphs().success((function(r){e.graphsInRepo=r.results.bindings,v()})).error((function(r){e.repositoryError=getError(r),l.error(getError(r),"Error getting graphs")}))},v=function(){const r=m.get(`classHierarchy-selectedGraph-${i.getActiveRepository()}`);null!==r&&e.graphsInRepo.some(e=>e.contextID.uri===r.contextID.uri)?b=r:m.set(`classHierarchy-selectedGraph-${i.getActiveRepository()}`,b)};function A(r,t,s){e.classCountSlider.options&&e.classCountSlider.options.ceil!==t&&(e.classCountSlider={});var n;e.classCountSlider.value||(e.showExternalElements=!0,e.classCountSlider={value:t,options:{floor:1,ceil:t,vertical:!0,showSelectionBar:!0,onChange:function(){h(I,100,!0)}}},null===m.get(C.CLASS_HIERARCHY_CURRENT_SLIDER_VALUE)&&t>e.currentBrowserLimit&&(n=e.currentBrowserLimit,g.chrome?l.warning("Disabling animations for more than "+n+" classes.","Reducing visual effects"):l.warning(g.name+" performs poorly with more than "+n+" classes. Please consider using Chrome for more optimal performance.","Reducing visual effects")));const i=m.get(C.CLASS_HIERARCHY_SWITCH_PREFIXES);null!=i&&"true"!==i&&(e.showExternalElements=!0),s?e.classCountSlider.value=s:t>=o&&(e.classCountSlider.value=o,l.warning("Class count is reduced to "+o+" for faster initial load. Use the slider to see all classes.","Reducing class count")),t>=a&&!window.ActiveXObject&&"ActiveXObject"in window&&!e.isWarningShowed&&(e.classCountSlider.value=a,e.isWarningShowed=!0,l.warning("Class count is reduced to "+a+" for faster load in IE. If you want better performance please switch to different browser.","Reducing class count")),h((function(){e.$broadcast("reCalcViewDimensions")}),200),I();let c=0;$("rzslider").on("wheel",(function(r){r.preventDefault(),r.stopPropagation();const t=(new Date).getTime();if(!(t-c>100))return;c=t,r=r.originalEvent;let s=e.classCountSlider.value;r.deltaY<=-1?s+=1:r.deltaY>=1&&(s-=1),s!==e.classCountSlider.value&&s>=e.classCountSlider.options.floor&&s<=e.classCountSlider.options.ceil&&e.$apply((function(){e.classCountSlider.value=s,h(I,100,!0)}))}))}function I(){e.currentSliderValue=e.classCountSlider.value}function H(e){const r=e.fullName,s=e.name;u.checkDomainRangeData(r).success((function(e,n){204===n?l.warning("No domain-range data available for '"+s+"'"):(m.set(C.CLASS_HIERARCHY_LAST_SELECTED_CLASS,t.hash()),t.hash("").path("domain-range-graph").search("uri",r).search("name",s))})).error((function(){l.error("Request for "+s+" failed!")}))}function D(){t.replace().hash("1"),e.instancesObj.items=[],e.showExternalElements=!1,e.showClassInfoPanel=!1,m.clearClassHieararchyState(),e.hidePrefixes="true"===m.get(C.CLASS_HIERARCHY_HIDE_PREFIXES),e.currentSliderValue=void 0,e.classHierarchyData={},r.$broadcast("angucomplete-alt:clearInput")}function L(){e.hasClassHierarchy()&&h((function(){$("#toolbar").removeClass("ng-hide")}),0)}r.$watch((function(){return r.key}),(function(){w=0,_.each(e.instancesObj.items,(function(e){r.key>e&&w++})),R++})),S.revision=function(){return R},e.adapterContainer={adapter:{remain:!0}},e.$on("goToDomainRangeGraphView",(function(e,r){H(r)})),e.$on("classCount",A),e.$on("repositoryIsSet",(function(){if(O===i.getActiveRepository())return;O=i.getActiveRepository();if(e.repositoryError=null,!O)return;b=allGraphs,E().then(j)})),e.datasource=S,e.goToDomainRangeGraphView=H,e.toggleClassInfoSidePanel=function(){e.showClassInfoPanel=!e.showClassInfoPanel,r.$broadcast("sidePanelClosed")},e.getActiveRepositoryNoError=function(){if(!e.repositoryError)return i.getActiveRepository()},e.isSystemRepository=function(){return i.isSystemRepository()},e.confirmReloadClassHierarchy=function(){p.openSimpleModal({title:"Confirm operation",message:"Calculating class hierarchy data may take some time. Are you sure?",warning:!0}).result.then((function(){D(),e.loader=!0,e.hierarchyError=!1,u.reloadClassHierarchy(b.contextID.uri).success((function(r){e.loader=!1,e.classHierarchyData=r,L(),A()})).error((function(r){e.loader=!1,e.hierarchyError=getError(r),l.error(getError(r),"Request for RDF Class Hierarchy failed!")}))}))},e.focusOnRoot=function(){e.$broadcast("rootFocus")},e.copyToClipboard=function(e){p.openCopyToClipboardModal(e)},e.searchedClassCallback=function(e){if(e){const t={name:e.title};r.$broadcast("searchedClass",t)}},e.instancesQueryObj.query="",e.instancesFilterFunc=function(r){return r.resolvedUri.toLowerCase().indexOf(e.instancesQueryObj.query.toLowerCase())>=0},E(),e.$watch("instancesObj.items",(function(){e.instancesObj.items.length>0&&h((function(){e.adapterContainer.adapter.reload()}),30)})),e.$watch("selectedClass",(function(){e.showClassInfoPanel&&function(r){const t=r.fullName;let s=r.name;if(s===t){const e=s.lastIndexOf("#");s=s.substring(e+1)}e.encodedUri=encodeURIComponent(t);const n=encodeURIComponent("prefix onto:<http://www.ontotext.com/> select ?s from onto:disable-sameAs { ?s a <"+t+"> . }");e.viewInstancesUri="sparql?name="+s+"&infer=true&sameAs=false&query="+n+"&execute=true",u.getRdfsLabelAndComment(t).success((function(r){e.rdfsLabel=r.label,e.rdfsComment=r.comment,e.expanded=!1})).error((function(){l.error("Error getting rdfs:label and rdfs:comment")})),e.instancesQueryObj.query="",e.instancesLoader=!0,u.getClassInstances(t).success((function(r){e.instancesObj.items=[],_.each(r,(function(r,t){const s={};s.type=r.startsWith("<<")&&r.endsWith(">>")?"triple":"uri",s.absUri=encodeURIComponent(r),s.absUriNonEncoded=r,s.resolvedUri=t,e.instancesObj.items.push(s)})),e.instancesLoader=!1,e.instancesSearchPlaceholder=e.instancesObj.items.length<1e3?"Search class instances":"Search first 1000 class instances",e.instancesNotFiltered=e.instancesObj.items})).error((function(){l.error("Request for class instances for failed!")}))}(e.selectedClass)})),$(document).ready((function(){$(".prefix-toggle").click((function(){$(".tooltip").hide()}))}));let O=i.getActiveRepository();function j(){D(),e.isSystemRepository()||(e.hierarchyError=!1,e.loader=!0,u.getClassHierarchyData(b.contextID.uri).success((function(r,t){e.showExternalElements=!0,e.loader=!1,e.classHierarchyData=r,207===t&&l.warning("You can update the diagram by pressing the reload button.","Repository data has changed"),L()})).error((function(r){e.loader=!1,e.hierarchyError=getError(r),l.error(getError(r),"Request for RDF Class Hierarchy failed!")})))}e.hasClassHierarchy=function(){return e.classHierarchyData.classCount&&e.getActiveRepositoryNoError()&&!e.isSystemRepository()},e.chosenGraph=function(e){b=e,j(),m.set(`classHierarchy-selectedGraph-${i.getActiveRepository()}`,b)},e.getSelGraphValue=function(){return b.contextID.value},e.isAllGraphsSelected=function(){return"All graphs"===e.getSelGraphValue()}}angular.module("graphdb.framework.graphexplore.controllers.class",["pageslide-directive","ngAnimate","ui.scroll.jqlite","ui.scroll","angucomplete-alt","rzSlider","toastr","graphdb.framework.utils.localstorageadapter"]).controller("RdfClassHierarchyCtlr",i),i.$inject=["$scope","$rootScope","$location","$repositories","$window","toastr","GraphDataRestService","UiScrollService","RdfsLabelCommentService","$timeout","ModalService","bowser","LocalStorageAdapter","LSKeys","RDF4JRepositoriesRestService"]}}]); //# sourceMappingURL=58.033fd1c1d542dd0cd8d8.bundle.js.map