aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/graph
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-09-03 17:57:38 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-09-03 17:57:38 +0200
commitcd96a9a4f54d45cda3ddf5df474946445d557090 (patch)
tree7a96a177236888ede9a51ffdd51940a672cfd070 /subprojects/frontend/src/graph
parentbuild: runtimeOnly Eclipse Collections if posible (diff)
downloadrefinery-cd96a9a4f54d45cda3ddf5df474946445d557090.tar.gz
refinery-cd96a9a4f54d45cda3ddf5df474946445d557090.tar.zst
refinery-cd96a9a4f54d45cda3ddf5df474946445d557090.zip
feat: scope propagator in language
Diffstat (limited to 'subprojects/frontend/src/graph')
-rw-r--r--subprojects/frontend/src/graph/dotSource.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/subprojects/frontend/src/graph/dotSource.ts b/subprojects/frontend/src/graph/dotSource.ts
index 963a9663..b24bca2f 100644
--- a/subprojects/frontend/src/graph/dotSource.ts
+++ b/subprojects/frontend/src/graph/dotSource.ts
@@ -20,8 +20,6 @@ function nodeName(graph: GraphStore, metadata: NodeMetadata): string {
20 switch (metadata.kind) { 20 switch (metadata.kind) {
21 case 'INDIVIDUAL': 21 case 'INDIVIDUAL':
22 return `<b>${name}</b>`; 22 return `<b>${name}</b>`;
23 case 'NEW':
24 return `<i>${name}</i>`;
25 default: 23 default:
26 return name; 24 return name;
27 } 25 }
@@ -44,6 +42,7 @@ interface NodeData {
44 exists: string; 42 exists: string;
45 equalsSelf: string; 43 equalsSelf: string;
46 unaryPredicates: Map<RelationMetadata, string>; 44 unaryPredicates: Map<RelationMetadata, string>;
45 count: string;
47} 46}
48 47
49function computeNodeData(graph: GraphStore): NodeData[] { 48function computeNodeData(graph: GraphStore): NodeData[] {
@@ -56,6 +55,7 @@ function computeNodeData(graph: GraphStore): NodeData[] {
56 exists: 'FALSE', 55 exists: 'FALSE',
57 equalsSelf: 'FALSE', 56 equalsSelf: 'FALSE',
58 unaryPredicates: new Map(), 57 unaryPredicates: new Map(),
58 count: '[0]',
59 })); 59 }));
60 60
61 relations.forEach((relation) => { 61 relations.forEach((relation) => {
@@ -107,6 +107,15 @@ function computeNodeData(graph: GraphStore): NodeData[] {
107 } 107 }
108 }); 108 });
109 109
110 partialInterpretation['builtin::count']?.forEach(([index, value]) => {
111 if (typeof index === 'number' && typeof value === 'string') {
112 const data = nodeData[index];
113 if (data !== undefined) {
114 data.count = value;
115 }
116 }
117 });
118
110 return nodeData; 119 return nodeData;
111} 120}
112 121
@@ -132,9 +141,10 @@ function createNodes(graph: GraphStore, lines: string[]): void {
132 const classes = classList.join(' '); 141 const classes = classList.join(' ');
133 const name = nodeName(graph, node); 142 const name = nodeName(graph, node);
134 const border = node.kind === 'INDIVIDUAL' ? 2 : 1; 143 const border = node.kind === 'INDIVIDUAL' ? 2 : 1;
144 const count = data.equalsSelf !== 'TRUE' ? ` ${data.count}` : '';
135 lines.push(`n${i} [id="${node.name}", class="${classes}", label=< 145 lines.push(`n${i} [id="${node.name}", class="${classes}", label=<
136 <table border="${border}" cellborder="0" cellspacing="0" style="rounded" bgcolor="white"> 146 <table border="${border}" cellborder="0" cellspacing="0" style="rounded" bgcolor="white">
137 <tr><td cellpadding="4.5" width="32" bgcolor="green">${name}</td></tr>`); 147 <tr><td cellpadding="4.5" width="32" bgcolor="green">${name}${count}</td></tr>`);
138 if (data.unaryPredicates.size > 0) { 148 if (data.unaryPredicates.size > 0) {
139 lines.push( 149 lines.push(
140 '<hr/><tr><td cellpadding="4.5"><table fixedsize="TRUE" align="left" border="0" cellborder="0" cellspacing="0" cellpadding="1.5">', 150 '<hr/><tr><td cellpadding="4.5"><table fixedsize="TRUE" align="left" border="0" cellborder="0" cellspacing="0" cellpadding="1.5">',