UNPKG

graphdb-workbench

Version:
2 lines 6.45 kB
export const __webpack_id__=85759;export const __webpack_ids__=[9952,85759];export const __webpack_modules__={9952:()=>{angular.module("graphdb.framework.rest.graphexplore.data.service",[]).factory("GraphDataRestService",a),a.$inject=["$http"];const e="rest/class-hierarchy",t="rest/domain-range",n="rest/dependencies",r="rest/explore-graph";function a(a){return{getClassHierarchyData:function(t){return a.get(e,{params:{graphURI:t}})},reloadClassHierarchy:function(t){return a.get(e,{params:{doReload:!0,graphURI:t}})},getClassInstances:function(t){return a.get(`${e}/class-instances`,{params:{targetUri:t}})},getDomainRangeData:function(e,n){return a.get(t,{params:{targetUri:e,collapsed:n}})},checkDomainRangeData:function(e){return a.head(t,{params:{targetUri:e}})},getRelationshipsData:function(e,t,r){return a.get(`${n}/matrix`,{params:{mode:t,classes:_.map(e,function(e){return e.name}),graphURI:r}})},getRelationshipsClasses:function(e,t){return a.get(`${n}/classes`,{params:{mode:e,graphURI:t}})},getRelationshipsStatus:function(e){return a.get(`${n}/status`,{params:{graphURI:e}})},calculateRelationships:function(e){return a.get(`${n}/update`,{params:{graphURI:e}})},getPredicates:function(e,t,r){return a.get(`${n}/predicates`,{params:{from:e,to:t,mode:"all",graphURI:r}})},getInstanceNode:function(e){return a.get(`${r}/node`,{params:e})},getInstanceNodeLinks:function(e){return a.get(`${r}/links`,{params:e})},getProperties:function(e){return a.get(`${r}/properties`,{params:e})},updateGraph:function(e){let t={headers:{"Content-Type":"application/json"}};return t=Object.assign(t,e),a.post(`${r}/graph`,t)},getRdfsLabelAndComment:function(e,t,n){const r=n||{};return a({url:"rest/explore/details",method:"GET",params:_.extend(r,{uri:e,languages:t}),headers:{Accept:"application/json"}})}}}},62979:(e,t,n)=>{var r,a;r=[n(93462)],void 0===(a=function(e){function t(e,t){return e.each(function(){var e=t.apply(this,arguments),n=select(this);for(var r in e)n.attr(r,e[r])})}function r(e,t){for(var n in t)e.attr(n,t[n]);return e}return void 0===e&&(e=n(93462)),e.selection.prototype.attrs=function(e){return("function"==typeof e?t:r)(this,e)},e.selection.prototype.moveToFront=function(){return this.each(function(){e.select(this.parentNode.appendChild(this))})},e.selection.prototype.moveToBack=function(){return this.each(function(){const e=this.parentNode.firstChild;e&&this.parentNode.insertBefore(this,e)})},e}.apply(t,r))||(e.exports=a)},85759:(e,t,n)=>{n.r(t);var r=n(88141),a=(n(9952),n(93462));function s(e,t){return{restrict:"A",template:'<div id="dependencies-chord"></div>',scope:{dependenciesData:"="},link:function(n){n.$watch("dependenciesData",function(){if(n.dependenciesData){const s=n.dependenciesData;!function(s,o){if(function(){let e=!0;for(const t of s)if(t.some(e=>0!==e)){e=!1;break}return e}())return;const i=a.scaleOrdinal(a.schemeCategory10),c=a.select("body").append("div").attr("class","tooltip").style("opacity",0);a.select("body").on("click",function(){c.style("opacity",0)});const l=Math.min(800,800)/2.8,p=l-24,d=a.arc().innerRadius(p).outerRadius(l),u=a.chord().padAngle(.04).sortSubgroups(a.descending).sortChords(a.ascending),g=a.ribbon().radius(p),f=a.select("#dependencies-chord").append("svg").attr("viewBox","0 0 800 800").attr("preserveAspectRatio","xMidYMid meet").style("font","10px sans-serif").append("g").attr("id","circle").attr("transform","translate(400,400)");f.append("circle").attr("r",l).style("fill","none");const h=u(s),m=f.selectAll(".group").data(h.groups).enter().append("g").attr("class","group").on("mouseover",function(){const e=m.nodes().indexOf(this);v.classed("fade",function(t){return t.source.index!==e&&t.target.index!==e})});m.append("title").text(function(e,t){return o[t]}),m.append("path").attr("id",function(e,t){return"group"+t}).attr("d",d).style("fill",function(e,t){return i(t)}),m.append("text").each(function(e){e.angle=(e.startAngle+e.endAngle)/2}).attr("dy",".35em").attr("transform",function(e){return"rotate("+(180*e.angle/Math.PI-90)+")translate("+(p+26)+")"+(e.angle>Math.PI?"rotate(180)":"")}).style("text-anchor",function(e){return e.angle>Math.PI?"end":null}).text(function(e){return o[e.index]});const v=f.selectAll(".chord").data(h).enter().append("path").attr("class","chord").style("fill",function(e){return i(e.target.index)}).style("fill-opacity",".67").style("stroke","#000").style("stroke-width",".25px").style("cursor","pointer").attr("d",g);v.on("mouseover",function(){a.select(this).style("fill-opacity","1")}),v.on("mouseout",function(){a.select(this).style("fill-opacity",".67")}),v.on("click",function(e,r){const a=o[r.source.index],s=o[r.target.index],i=e.pageX,l=e.pageY;t.getPredicates(a,s,n.selectedGraph&&n.selectedGraph.contextID.uri).success(function(e){let t="<div class='dependencies-tooltip'><div class='row'>"+a+" <i class='fa fa-exchange'></i> "+s+"</div>"+_.map(e.slice(0,10),function(e){const t=" <i class='fa fa-long-arrow-"+("out"===e.direction?"right":"left")+"'></i>";return"<div class='row'>"+e.predicate+" : "+e.weight+t+" </div>"}).join("");e.length>10?t=t+"<div class='pull-right'>And "+(e.length-10).toString()+" more...</div></div>":t+="</div>",c.html(t).style("left",i+"px").style("top",l+"px")}),c.transition().duration(200).style("opacity",1)}),a.select("#circle").on("mouseleave",function(){f.selectAll(".chord").classed("fade",!1)}),a.select("#download-svg").on("mouseover",function(){const t=r.A.Export.generateBase64ImageSource(".dependencies-chord svg");a.select(this).attrs({href:t,download:"dependencies-"+e.getActiveRepository()+".svg"})})}(s.matrix,s.nodes,s.direction)}})}}}angular.module("graphdb.framework.graphexplore.directives.dependencies",["graphdb.framework.graphexplore.controllers.dependencies","graphdb.framework.rest.graphexplore.data.service"]).directive("dependenciesChord",s),s.$inject=["$repositories","GraphDataRestService"]},88141:(e,t,n)=>{n.d(t,{A:()=>s}),n(62979);const r={selectAll:n(93462).selectAll};var a=a||{};a.Export={getCSSRules:function(e){const t=$('link[href="'+e+'"]')[0].sheet.rules;let n="";return _.each(t,function(e){n+=e.cssText}),n},generateBase64ImageSource:function(e){e||(e="svg");const t=r.selectAll(e).attr("version","1.1").attr("xmlns","http://www.w3.org/2000/svg").node().parentNode.innerHTML;return"data:image/svg+xml;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(t)))}};const s=a}}; //# sourceMappingURL=85759.73826a48695f541c860b.bundle.js.map