Skip to content

Commit 1384ce2

Browse files
committed
Remove unused code for subworkflow visualisation
1 parent 564dbf3 commit 1384ce2

File tree

1 file changed

+12
-48
lines changed

1 file changed

+12
-48
lines changed

src/main/java/org/commonwl/view/graphviz/RDFDotWriter.java

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,17 @@
2828
import java.io.Writer;
2929
import java.nio.file.Path;
3030
import java.nio.file.Paths;
31-
import java.util.*;
31+
import java.util.ArrayList;
32+
import java.util.HashSet;
33+
import java.util.List;
34+
import java.util.Set;
3235

3336
/**
3437
* Writes GraphViz DOT files from a workflow RDF model
3538
*/
3639
public class RDFDotWriter extends DotWriter {
3740

3841
private RDFService rdfService;
39-
private Map<String, String> subworkflows = new HashMap<>();
4042
private String gitPath;
4143

4244
public RDFDotWriter(Writer writer, RDFService rdfService, String gitPath) {
@@ -133,14 +135,8 @@ private void writeSteps(String workflowUri, boolean subworkflow) throws IOExcept
133135
// Distinguish nested workflows
134136
CWLProcess runType = rdfService.strToRuntype(step.get("runtype").toString());
135137
if (runType == CWLProcess.WORKFLOW) {
136-
//if (subworkflow) {
137-
writeLine(" \"" + stepName + "\" [label=\"" + label +
138-
"\", fillcolor=\"#F3CEA1\"];");
139-
/*} else {
140-
String runFile = step.get("run").toString();
141-
subworkflows.put(stepName, FilenameUtils.getName(runFile));
142-
writeSubworkflow(stepName, runFile);
143-
}*/
138+
writeLine(" \"" + stepName + "\" [label=\"" + label +
139+
"\", fillcolor=\"#F3CEA1\"];");
144140
} else {
145141
writeLine(" \"" + stepName + "\" [label=\"" + label + "\"];");
146142
}
@@ -163,9 +159,9 @@ private void writeStepLinks(String workflowUri) throws IOException {
163159
QuerySolution stepLink = stepLinks.nextSolution();
164160
if (stepLink.contains("src")) {
165161
// Normal link from step
166-
String sourceID = nodeIDFromUri(workflowUri, stepLink.get("src").toString());
162+
String sourceID = nodeIDFromUri(stepLink.get("src").toString());
167163
String dest = stepLink.get("dest").toString();
168-
String destID = nodeIDFromUri(workflowUri, dest);
164+
String destID = nodeIDFromUri(dest);
169165
String destInput = dest.substring(dest.replaceAll("#", "/").lastIndexOf("/") + 1);
170166
writeLine(" \"" + sourceID + "\" -> \"" + destID + "\" [label=\"" + destInput + "\"];");
171167
} else if (stepLink.contains("default")) {
@@ -197,51 +193,19 @@ private void writeStepLinks(String workflowUri) throws IOException {
197193
ResultSet outputLinks = rdfService.getOutputLinks(gitPath, workflowUri);
198194
while (outputLinks.hasNext()) {
199195
QuerySolution outputLink = outputLinks.nextSolution();
200-
String sourceID = nodeIDFromUri(workflowUri, outputLink.get("src").toString());
201-
String destID = nodeIDFromUri(workflowUri, outputLink.get("dest").toString());
196+
String sourceID = nodeIDFromUri(outputLink.get("src").toString());
197+
String destID = nodeIDFromUri(outputLink.get("dest").toString());
202198
writeLine(" \"" + sourceID + "\" -> \"" + destID + "\";");
203199
}
204200
}
205201

206202
/**
207203
* Get a node ID from a URI, with ID handling for subworkflows
208-
* @param workflowUri The URI of the workflow in the model
209204
* @param uri The URI of the step
210205
* @return A string in the format filename#stepID
211206
*/
212-
private String nodeIDFromUri(String workflowUri, String uri) {
213-
214-
String nodeID = rdfService.stepNameFromURI(gitPath, uri);
215-
if (subworkflows.containsKey(nodeID)) {
216-
int slashAfterHashIndex = uri.indexOf('/', uri.lastIndexOf('#'));
217-
if (slashAfterHashIndex != -1) {
218-
String subworkflowStepID = uri.substring(slashAfterHashIndex + 1);
219-
nodeID = subworkflows.get(nodeID) + "#" + subworkflowStepID;
220-
}
221-
}
222-
return nodeID;
223-
}
224-
225-
/**
226-
* Writes a subworkflow as a cluster on the graph
227-
* @param name The name of the step the subworkflow is running in
228-
* @param subWorkflowUri The URI of the subworkflow in the model
229-
*/
230-
private void writeSubworkflow(String name, String subWorkflowUri) throws IOException {
231-
232-
// Start of subgraph with styling
233-
writeLine(" subgraph \"cluster_" + name + "\" {");
234-
writeLine(" rank = \"same\";");
235-
writeLine(" style=\"filled,dotted\";");
236-
writeLine(" color=\"black\";");
237-
writeLine(" fillcolor=\"#F9DBB7\";");
238-
writeLine(" label = \"" + rdfService.labelFromName(name) + "\";");
239-
240-
writeInputs(subWorkflowUri);
241-
writeSteps(subWorkflowUri, true);
242-
writeOutputs(subWorkflowUri);
243-
244-
writeLine(" }");
207+
private String nodeIDFromUri(String uri) {
208+
return rdfService.stepNameFromURI(gitPath, uri);
245209
}
246210

247211
/**

0 commit comments

Comments
 (0)