Skip to content

Commit c3af261

Browse files
committed
Linking to ontology for file format fields if they exist
1 parent 9888b29 commit c3af261

File tree

5 files changed

+39
-8
lines changed

5 files changed

+39
-8
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class CWLElement {
3333
private String label;
3434
private String doc;
3535
private String type;
36+
private String format;
3637
private List<String> sourceID;
3738
private String defaultVal;
3839

@@ -64,6 +65,22 @@ public void setType(String type) {
6465
this.type = type;
6566
}
6667

68+
public String getFormat() {
69+
return format;
70+
}
71+
72+
public void setFormat(String format) {
73+
this.format = format;
74+
}
75+
76+
public List<String> getSourceID() {
77+
return sourceID;
78+
}
79+
80+
public void setSourceID(List<String> sourceID) {
81+
this.sourceID = sourceID;
82+
}
83+
6784
public List<String> getSourceIDs() {
6885
return sourceID;
6986
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ public Workflow parseWorkflowWithCwltool(GithubDetails githubInfo,
268268
}
269269
}
270270

271+
if (input.contains("format")) {
272+
wfInput.setFormat(input.get("format").toString());
273+
}
271274
if (input.contains("label")) {
272275
wfInput.setLabel(input.get("label").toString());
273276
}
@@ -326,6 +329,9 @@ public Workflow parseWorkflowWithCwltool(GithubDetails githubInfo,
326329
wfOutput.addSourceID(rdfService.stepNameFromURI(url,
327330
output.get("src").toString()));
328331
}
332+
if (output.contains("format")) {
333+
wfOutput.setFormat(output.get("format").toString());
334+
}
329335
if (output.contains("label")) {
330336
wfOutput.setLabel(output.get("label").toString());
331337
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ public ResultSet getLabelAndDoc(String graphName, String workflowURI) {
105105
public ResultSet getInputs(String graphName, String workflowURI) {
106106
ParameterizedSparqlString inputsQuery = new ParameterizedSparqlString();
107107
inputsQuery.setCommandText(queryCtx +
108-
"SELECT ?name ?type ?label ?doc\n" +
108+
"SELECT ?name ?type ?format ?label ?doc\n" +
109109
"WHERE {\n" +
110110
" GRAPH ?graphName {" +
111111
" ?wf rdf:type cwl:Workflow .\n" +
112112
" ?wf cwl:inputs ?name .\n" +
113113
" OPTIONAL { ?name sld:type ?type }\n" +
114+
" OPTIONAL { ?name cwl:format ?format }\n" +
114115
" OPTIONAL { ?name sld:label|rdfs:label ?label }\n" +
115116
" OPTIONAL { ?name sld:doc|rdfs:comment ?doc }\n" +
116117
" }" +
@@ -129,12 +130,13 @@ public ResultSet getInputs(String graphName, String workflowURI) {
129130
public ResultSet getOutputs(String graphName, String workflowURI) {
130131
ParameterizedSparqlString outputsQuery = new ParameterizedSparqlString();
131132
outputsQuery.setCommandText(queryCtx +
132-
"SELECT ?name ?type ?label ?doc\n" +
133+
"SELECT ?name ?type ?format ?label ?doc\n" +
133134
"WHERE {\n" +
134135
" GRAPH ?graphName {" +
135136
" ?wf rdf:type cwl:Workflow .\n" +
136137
" ?wf cwl:outputs ?name .\n" +
137138
" OPTIONAL { ?name sld:type ?type }\n" +
139+
" OPTIONAL { ?name cwl:format ?format }\n" +
138140
" OPTIONAL { ?name sld:label|rdfs:label ?label }\n" +
139141
" OPTIONAL { ?name sld:doc|rdfs:comment ?doc }\n" +
140142
" }" +

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,12 @@ private void writeSteps(Workflow workflow) throws IOException {
144144
// Workaround to force outputs to lowest ranking, see #104
145145
writeLine("");
146146
writeLine(" // Invisible links to force outputs to be at lowest rank");
147-
for (Map.Entry<String, CWLStep> step : workflow.getSteps().entrySet()) {
148-
writeLine(" \"" + step.getKey() + "\" -> \"" +
149-
workflow.getOutputs().keySet().iterator().next() +
150-
"\" [style=invis];");
147+
if (workflow.getOutputs().size() > 0) {
148+
for (Map.Entry<String, CWLStep> step : workflow.getSteps().entrySet()) {
149+
writeLine(" \"" + step.getKey() + "\" -> \"" +
150+
workflow.getOutputs().keySet().iterator().next() +
151+
"\" [style=invis];");
152+
}
151153
}
152154

153155
}

src/main/resources/templates/workflow.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ <h2>Inputs</h2>
198198
<tbody>
199199
<tr th:each="input : ${workflow.inputs}">
200200
<td th:text="${input.key}">ID</td>
201-
<td th:text="${input.value.type}">Type</td>
201+
<td>
202+
<a th:href="@{${input.value.format}}" th:text="${input.value.type}">Type</a>
203+
</td>
202204
<td th:text="${input.value.label}">Label</td>
203205
<td>
204206
<p th:if="${input.value.doc != null}" th:utext="${#strings.replace( #strings.escapeXml(input.value.doc),T(java.lang.System).getProperty('line.separator')+T(java.lang.System).getProperty('line.separator'),'&lt;br /&gt;&lt;br /&gt;')}">Description</p>
@@ -255,7 +257,9 @@ <h2>Outputs</h2>
255257
<tbody>
256258
<tr th:each="output : ${workflow.outputs}">
257259
<td th:text="${output.key}">ID</td>
258-
<td th:text="${output.value.type}">Type</td>
260+
<td>
261+
<a th:href="@{${output.value.format}}" th:text="${output.value.type}" target="_blank" rel="noopener">Type</a>
262+
</td>
259263
<td th:text="${output.value.label}">Label</td>
260264
<td>
261265
<p th:if="${output.value.doc != null}" th:utext="${#strings.replace(#strings.escapeXml(output.value.doc),T(java.lang.System).getProperty('line.separator')+T(java.lang.System).getProperty('line.separator'),'&lt;br /&gt;&lt;br /&gt;')}">Description</p>

0 commit comments

Comments
 (0)