@@ -66,7 +66,7 @@ public void addToOntologies(Model model) {
66
66
*/
67
67
public void storeModel (String graphName , Model model ) {
68
68
DatasetAccessor accessor = DatasetAccessorFactory .createHTTP (rdfService );
69
- accessor .putModel (graphName , model );
69
+ accessor .putModel (rdfService + graphName , model );
70
70
}
71
71
72
72
/**
@@ -106,17 +106,19 @@ public boolean ontPropertyExists(String ontUri) {
106
106
* @param workflowURI The URI of the workflow
107
107
* @return Result set with label and doc strings
108
108
*/
109
- public ResultSet getLabelAndDoc (String workflowURI ) {
109
+ public ResultSet getLabelAndDoc (String path , String workflowURI ) {
110
110
ParameterizedSparqlString labelQuery = new ParameterizedSparqlString ();
111
111
labelQuery .setCommandText (queryCtx +
112
112
"SELECT ?label ?doc\n " +
113
113
"WHERE {\n " +
114
- " GRAPH ?wf {" +
114
+ " GRAPH ?graphName {" +
115
115
" OPTIONAL { ?wf sld:label|rdfs:label ?label }\n " +
116
116
" OPTIONAL { ?wf sld:doc|rdfs:comment ?doc }\n " +
117
+ " FILTER(regex(str(?wf), ?wfFilter, \" i\" ))" +
117
118
" }" +
118
119
"}" );
119
- labelQuery .setIri ("wf" , workflowURI );
120
+ labelQuery .setLiteral ("wfFilter" , path + "$" );
121
+ labelQuery .setIri ("graphName" , rdfService + workflowURI );
120
122
return runQuery (labelQuery );
121
123
}
122
124
@@ -149,21 +151,23 @@ public String getOntLabel(String ontologyURI) {
149
151
* @param workflowURI URI of the workflow
150
152
* @return The result set of inputs
151
153
*/
152
- public ResultSet getInputs (String workflowURI ) {
154
+ public ResultSet getInputs (String path , String workflowURI ) {
153
155
ParameterizedSparqlString inputsQuery = new ParameterizedSparqlString ();
154
156
inputsQuery .setCommandText (queryCtx +
155
157
"SELECT ?name ?type ?format ?label ?doc\n " +
156
158
"WHERE {\n " +
157
- " GRAPH ?wf {" +
159
+ " GRAPH ?graphName {" +
158
160
" ?wf rdf:type cwl:Workflow .\n " +
159
161
" ?wf cwl:inputs ?name .\n " +
160
162
" OPTIONAL { ?name sld:type ?type }\n " +
161
163
" OPTIONAL { ?name cwl:format ?format }\n " +
162
164
" OPTIONAL { ?name sld:label|rdfs:label ?label }\n " +
163
165
" OPTIONAL { ?name sld:doc|rdfs:comment ?doc }\n " +
166
+ " FILTER(regex(str(?wf), ?wfFilter, \" i\" ))" +
164
167
" }" +
165
168
"}" );
166
- inputsQuery .setIri ("wf" , workflowURI );
169
+ inputsQuery .setLiteral ("wfFilter" , path + "$" );
170
+ inputsQuery .setIri ("graphName" , rdfService + workflowURI );
167
171
return runQuery (inputsQuery );
168
172
}
169
173
@@ -172,21 +176,23 @@ public ResultSet getInputs(String workflowURI) {
172
176
* @param workflowURI URI of the workflow
173
177
* @return The result set of outputs
174
178
*/
175
- public ResultSet getOutputs (String workflowURI ) {
179
+ public ResultSet getOutputs (String path , String workflowURI ) {
176
180
ParameterizedSparqlString outputsQuery = new ParameterizedSparqlString ();
177
181
outputsQuery .setCommandText (queryCtx +
178
182
"SELECT ?name ?type ?format ?label ?doc\n " +
179
183
"WHERE {\n " +
180
- " GRAPH ?wf {" +
184
+ " GRAPH ?graphName {" +
181
185
" ?wf rdf:type cwl:Workflow .\n " +
182
186
" ?wf cwl:outputs ?name .\n " +
183
187
" OPTIONAL { ?name sld:type ?type }\n " +
184
188
" OPTIONAL { ?name cwl:format ?format }\n " +
185
189
" OPTIONAL { ?name sld:label|rdfs:label ?label }\n " +
186
190
" OPTIONAL { ?name sld:doc|rdfs:comment ?doc }\n " +
191
+ " FILTER(regex(str(?wf), ?wfFilter, \" i\" ))" +
187
192
" }" +
188
193
"}" );
189
- outputsQuery .setIri ("wf" , workflowURI );
194
+ outputsQuery .setLiteral ("wfFilter" , path + "$" );
195
+ outputsQuery .setIri ("graphName" , rdfService + workflowURI );
190
196
return runQuery (outputsQuery );
191
197
}
192
198
@@ -195,7 +201,7 @@ public ResultSet getOutputs(String workflowURI) {
195
201
* @param workflowURI URI of the workflow
196
202
* @return The result set of steps
197
203
*/
198
- public ResultSet getSteps (String workflowURI ) {
204
+ public ResultSet getSteps (String path , String workflowURI ) {
199
205
ParameterizedSparqlString stepQuery = new ParameterizedSparqlString ();
200
206
stepQuery .setCommandText (queryCtx +
201
207
"SELECT ?step ?run ?runtype ?label ?doc ?stepinput ?default ?src\n " +
@@ -210,9 +216,11 @@ public ResultSet getSteps(String workflowURI) {
210
216
" }\n " +
211
217
" OPTIONAL { ?run sld:label|rdfs:label ?label }\n " +
212
218
" OPTIONAL { ?run sld:doc|rdfs:comment ?doc }\n " +
219
+ " FILTER(regex(str(?wf), ?wfFilter, \" i\" ))" +
213
220
" }" +
214
221
"}" );
215
- stepQuery .setIri ("wf" , workflowURI );
222
+ stepQuery .setLiteral ("wfFilter" , path + "$" );
223
+ stepQuery .setIri ("graphName" , rdfService + workflowURI );
216
224
return runQuery (stepQuery );
217
225
}
218
226
@@ -221,18 +229,20 @@ public ResultSet getSteps(String workflowURI) {
221
229
* @param workflowURI URI of the workflow
222
230
* @return The result set of step links
223
231
*/
224
- public ResultSet getStepLinks (String workflowURI ) {
232
+ public ResultSet getStepLinks (String path , String workflowURI ) {
225
233
ParameterizedSparqlString linkQuery = new ParameterizedSparqlString ();
226
234
linkQuery .setCommandText (queryCtx +
227
235
"SELECT ?src ?dest ?default\n " +
228
236
"WHERE {\n " +
229
- " GRAPH ?wf {" +
237
+ " GRAPH ?graphName {" +
230
238
" ?wf Workflow:steps ?step .\n " +
231
239
" ?step cwl:in ?dest .\n " +
232
240
" { ?dest cwl:source ?src } UNION { ?dest cwl:default ?default }\n " +
241
+ " FILTER(regex(str(?wf), ?wfFilter, \" i\" ))" +
233
242
" }" +
234
243
"}" );
235
- linkQuery .setIri ("wf" , workflowURI );
244
+ linkQuery .setLiteral ("wfFilter" , path + "$" );
245
+ linkQuery .setIri ("graphName" , rdfService + workflowURI );
236
246
return runQuery (linkQuery );
237
247
}
238
248
@@ -241,18 +251,20 @@ public ResultSet getStepLinks(String workflowURI) {
241
251
* @param workflowURI URI of the workflow
242
252
* @return The result set of steps
243
253
*/
244
- public ResultSet getOutputLinks (String workflowURI ) {
254
+ public ResultSet getOutputLinks (String path , String workflowURI ) {
245
255
ParameterizedSparqlString linkQuery = new ParameterizedSparqlString ();
246
256
linkQuery .setCommandText (queryCtx +
247
257
"SELECT ?src ?dest\n " +
248
258
"WHERE {\n " +
249
- " GRAPH ?wf {" +
259
+ " GRAPH ?graphName {" +
250
260
" ?wf rdf:type cwl:Workflow .\n " +
251
261
" ?wf cwl:outputs ?dest .\n " +
252
262
" ?dest cwl:outputSource ?src\n " +
263
+ " FILTER(regex(str(?wf), ?wfFilter, \" i\" ))" +
253
264
" }" +
254
265
"}" );
255
- linkQuery .setIri ("wf" , workflowURI );
266
+ linkQuery .setLiteral ("wfFilter" , path + "$" );
267
+ linkQuery .setIri ("graphName" , rdfService + workflowURI );
256
268
return runQuery (linkQuery );
257
269
}
258
270
@@ -261,19 +273,21 @@ public ResultSet getOutputLinks(String workflowURI) {
261
273
* @param workflowURI URI of the workflow
262
274
* @return Result set of docker hint and pull link
263
275
*/
264
- public ResultSet getDockerLink (String workflowURI ) {
276
+ public ResultSet getDockerLink (String path , String workflowURI ) {
265
277
ParameterizedSparqlString dockerQuery = new ParameterizedSparqlString ();
266
278
dockerQuery .setCommandText (queryCtx +
267
279
"SELECT ?docker ?pull\n " +
268
280
"WHERE {\n " +
269
- " GRAPH ?wf {" +
281
+ " GRAPH ?graphName {" +
270
282
" ?wf rdf:type cwl:Workflow .\n " +
271
283
" { ?wf cwl:requirements ?docker } UNION { ?wf cwl:hints ?docker} .\n " +
272
284
" ?docker rdf:type cwl:DockerRequirement\n " +
273
285
" OPTIONAL { ?docker DockerRequirement:dockerPull ?pull }\n " +
286
+ " FILTER(regex(str(?wf), ?wfFilter, \" i\" ))" +
274
287
" }" +
275
288
"}" );
276
- dockerQuery .setIri ("wf" , workflowURI );
289
+ dockerQuery .setLiteral ("wfFilter" , path + "$" );
290
+ dockerQuery .setIri ("graphName" , rdfService + workflowURI );
277
291
return runQuery (dockerQuery );
278
292
}
279
293
@@ -284,6 +298,7 @@ public ResultSet getDockerLink(String workflowURI) {
284
298
* @return The step ID
285
299
*/
286
300
public String stepNameFromURI (String baseUrl , String uri ) {
301
+ uri = uri .substring (uri .indexOf (baseUrl ));
287
302
uri = uri .replace (baseUrl , "" );
288
303
uri = uri .replace ("#" , "/" );
289
304
uri = uri .substring (1 );
0 commit comments