Skip to content

Commit cd44f2f

Browse files
committed
Fix resolution of relative URIs
1 parent c8346bb commit cd44f2f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/main/java/org/commonwl/view/cwl/CWLService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public Workflow parseWorkflowWithCwltool(GitDetails gitDetails,
185185
File workflowFile,
186186
String packedWorkflowID) throws CWLValidationException {
187187

188-
// Get RDF representation from cwltool
188+
// Get paths to workflow
189189
String url = gitDetails.getUrl().replace("https://", "");
190190
String localPath = workflowFile.toPath().toAbsolutePath().toString();
191191
String gitPath = gitDetails.getPath();
@@ -200,6 +200,7 @@ public Workflow parseWorkflowWithCwltool(GitDetails gitDetails,
200200
gitPath += packedWorkflowID;
201201
}
202202

203+
// Get RDF representation from cwltool
203204
if (!rdfService.graphExists(url)) {
204205
String rdf = cwlTool.getRDF(localPath);
205206

@@ -368,7 +369,7 @@ public Workflow parseWorkflowWithCwltool(GitDetails gitDetails,
368369
// Add new step
369370
CWLStep wfStep = new CWLStep();
370371

371-
Path workflowPath = Paths.get(FilenameUtils.getPath(url));
372+
Path workflowPath = Paths.get(step.get("wf").toString()).getParent();
372373
Path runPath = Paths.get(step.get("run").toString());
373374
wfStep.setRun(workflowPath.relativize(runPath).toString());
374375
wfStep.setRunType(rdfService.strToRuntype(step.get("runtype").toString()));

src/main/java/org/commonwl/view/cwl/RDFService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public ResultSet getOutputs(String path, String workflowURI) {
204204
public ResultSet getSteps(String path, String workflowURI) {
205205
ParameterizedSparqlString stepQuery = new ParameterizedSparqlString();
206206
stepQuery.setCommandText(queryCtx +
207-
"SELECT ?step ?run ?runtype ?label ?doc ?stepinput ?default ?src\n" +
207+
"SELECT ?wf ?step ?run ?runtype ?label ?doc ?stepinput ?default ?src\n" +
208208
"WHERE {\n" +
209209
" GRAPH ?graphName {" +
210210
" ?wf Workflow:steps ?step .\n" +
@@ -232,7 +232,7 @@ public ResultSet getSteps(String path, String workflowURI) {
232232
public ResultSet getStepLinks(String path, String workflowURI) {
233233
ParameterizedSparqlString linkQuery = new ParameterizedSparqlString();
234234
linkQuery.setCommandText(queryCtx +
235-
"SELECT ?src ?dest ?default\n" +
235+
"SELECT ?wf ?src ?dest ?default\n" +
236236
"WHERE {\n" +
237237
" GRAPH ?graphName {" +
238238
" ?wf Workflow:steps ?step .\n" +

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
package org.commonwl.view.graphviz;
2121

22-
import org.apache.commons.io.FilenameUtils;
2322
import org.apache.jena.query.QuerySolution;
2423
import org.apache.jena.query.ResultSet;
2524
import org.commonwl.view.cwl.CWLProcess;
@@ -175,7 +174,7 @@ private void writeStepLinks(String workflowUri) throws IOException {
175174
if (stepLink.get("default").isLiteral()) {
176175
label = rdfService.formatDefault(stepLink.get("default").toString());
177176
} else if (stepLink.get("default").isURIResource()) {
178-
Path workflowPath = Paths.get(FilenameUtils.getPath(workflowUri));
177+
Path workflowPath = Paths.get(stepLink.get("wf").toString()).getParent();
179178
Path resourcePath = Paths.get(stepLink.get("default").toString());
180179
label = workflowPath.relativize(resourcePath).toString();
181180
} else {

0 commit comments

Comments
 (0)