From cd96a9a4f54d45cda3ddf5df474946445d557090 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Sun, 3 Sep 2023 17:57:38 +0200 Subject: feat: scope propagator in language --- subprojects/frontend/src/editor/EditorTheme.ts | 2 +- subprojects/frontend/src/graph/dotSource.ts | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'subprojects/frontend/src') diff --git a/subprojects/frontend/src/editor/EditorTheme.ts b/subprojects/frontend/src/editor/EditorTheme.ts index 308d5be0..055b62e2 100644 --- a/subprojects/frontend/src/editor/EditorTheme.ts +++ b/subprojects/frontend/src/editor/EditorTheme.ts @@ -105,7 +105,7 @@ export default styled('div', { color: theme.palette.text.primary, }, }, - '.tok-problem-abstract, .tok-problem-new': { + '.tok-problem-abstract': { fontStyle: 'italic', }, '.tok-problem-containment': { 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 { switch (metadata.kind) { case 'INDIVIDUAL': return `${name}`; - case 'NEW': - return `${name}`; default: return name; } @@ -44,6 +42,7 @@ interface NodeData { exists: string; equalsSelf: string; unaryPredicates: Map; + count: string; } function computeNodeData(graph: GraphStore): NodeData[] { @@ -56,6 +55,7 @@ function computeNodeData(graph: GraphStore): NodeData[] { exists: 'FALSE', equalsSelf: 'FALSE', unaryPredicates: new Map(), + count: '[0]', })); relations.forEach((relation) => { @@ -107,6 +107,15 @@ function computeNodeData(graph: GraphStore): NodeData[] { } }); + partialInterpretation['builtin::count']?.forEach(([index, value]) => { + if (typeof index === 'number' && typeof value === 'string') { + const data = nodeData[index]; + if (data !== undefined) { + data.count = value; + } + } + }); + return nodeData; } @@ -132,9 +141,10 @@ function createNodes(graph: GraphStore, lines: string[]): void { const classes = classList.join(' '); const name = nodeName(graph, node); const border = node.kind === 'INDIVIDUAL' ? 2 : 1; + const count = data.equalsSelf !== 'TRUE' ? ` ${data.count}` : ''; lines.push(`n${i} [id="${node.name}", class="${classes}", label=< - `); + `); if (data.unaryPredicates.size > 0) { lines.push( '
${name}
${name}${count}
', -- cgit v1.2.3-54-g00ecf