diff options
2 files changed, 16 insertions, 6 deletions
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/metadata/MetadataCreator.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/metadata/MetadataCreator.java index b6a2cdf0..cc262129 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/metadata/MetadataCreator.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/metadata/MetadataCreator.java | |||
@@ -46,27 +46,36 @@ public class MetadataCreator { | |||
46 | relationScope = scopeProvider.getScope(problem, ProblemPackage.Literals.ASSERTION__RELATION); | 46 | relationScope = scopeProvider.getScope(problem, ProblemPackage.Literals.ASSERTION__RELATION); |
47 | } | 47 | } |
48 | 48 | ||
49 | public static String unnamedNode(int nodeId) { | ||
50 | return "::" + nodeId; | ||
51 | } | ||
52 | |||
49 | public List<NodeMetadata> getNodesMetadata() { | 53 | public List<NodeMetadata> getNodesMetadata() { |
50 | return getNodesMetadata(initializer.getNodeCount()); | 54 | return getNodesMetadata(initializer.getNodeCount(), true); |
51 | } | 55 | } |
52 | 56 | ||
53 | public List<NodeMetadata> getNodesMetadata(int nodeCount) { | 57 | public List<NodeMetadata> getNodesMetadata(int nodeCount, boolean preserveNewNodes) { |
54 | var nodes = new NodeMetadata[Math.max(initializer.getNodeCount(), nodeCount)]; | 58 | var nodes = new NodeMetadata[Math.max(initializer.getNodeCount(), nodeCount)]; |
55 | for (var entry : initializer.getNodeTrace().keyValuesView()) { | 59 | for (var entry : initializer.getNodeTrace().keyValuesView()) { |
56 | var node = entry.getOne(); | 60 | var node = entry.getOne(); |
57 | var id = entry.getTwo(); | 61 | var id = entry.getTwo(); |
58 | nodes[id] = getNodeMetadata(node); | 62 | nodes[id] = getNodeMetadata(id, node, preserveNewNodes); |
59 | } | 63 | } |
60 | for (int i = 0; i < nodes.length; i++) { | 64 | for (int i = 0; i < nodes.length; i++) { |
61 | if (nodes[i] == null) { | 65 | if (nodes[i] == null) { |
62 | var nodeName = "::" + i; | 66 | var nodeName = unnamedNode(i); |
63 | nodes[i] = new NodeMetadata(nodeName, nodeName, NodeKind.IMPLICIT); | 67 | nodes[i] = new NodeMetadata(nodeName, nodeName, NodeKind.IMPLICIT); |
64 | } | 68 | } |
65 | } | 69 | } |
66 | return List.of(nodes); | 70 | return List.of(nodes); |
67 | } | 71 | } |
68 | 72 | ||
69 | private NodeMetadata getNodeMetadata(Node node) { | 73 | private NodeMetadata getNodeMetadata(int nodeId, Node node, boolean preserveNewNodes) { |
74 | var kind = getNodeKind(node); | ||
75 | if (!preserveNewNodes && kind == NodeKind.NEW) { | ||
76 | var nodeName = unnamedNode(nodeId); | ||
77 | return new NodeMetadata(nodeName, nodeName, NodeKind.IMPLICIT); | ||
78 | } | ||
70 | var qualifiedName = getQualifiedName(node); | 79 | var qualifiedName = getQualifiedName(node); |
71 | var simpleName = getSimpleName(node, qualifiedName, nodeScope); | 80 | var simpleName = getSimpleName(node, qualifiedName, nodeScope); |
72 | return new NodeMetadata(qualifiedNameConverter.toString(qualifiedName), | 81 | return new NodeMetadata(qualifiedNameConverter.toString(qualifiedName), |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/generator/ModelGenerationWorker.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/generator/ModelGenerationWorker.java index 1f430da6..e14982a7 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/generator/ModelGenerationWorker.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/generator/ModelGenerationWorker.java | |||
@@ -197,7 +197,8 @@ public class ModelGenerationWorker implements Runnable { | |||
197 | model.restore(solutionStore.getSolutions().get(0).version()); | 197 | model.restore(solutionStore.getSolutions().get(0).version()); |
198 | cancellationToken.checkCancelled(); | 198 | cancellationToken.checkCancelled(); |
199 | metadataCreator.setInitializer(initializer); | 199 | metadataCreator.setInitializer(initializer); |
200 | var nodesMetadata = metadataCreator.getNodesMetadata(model.getAdapter(ReasoningAdapter.class).getNodeCount()); | 200 | var nodesMetadata = metadataCreator.getNodesMetadata(model.getAdapter(ReasoningAdapter.class).getNodeCount(), |
201 | false); | ||
201 | cancellationToken.checkCancelled(); | 202 | cancellationToken.checkCancelled(); |
202 | var relationsMetadata = metadataCreator.getRelationsMetadata(); | 203 | var relationsMetadata = metadataCreator.getRelationsMetadata(); |
203 | cancellationToken.checkCancelled(); | 204 | cancellationToken.checkCancelled(); |