Skip to content

Commit 7c8ac4b

Browse files
committed
printrdf: also include the input values
1 parent f166143 commit 7c8ac4b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

cwltool/cwlrdf.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,23 @@
1111
from .process import Process
1212

1313

14-
def gather(tool: Process, ctx: ContextType) -> Graph:
14+
def gather(tool: Process, inputs: Any, ctx: ContextType) -> Graph:
1515
g = Graph()
1616

1717
def visitor(t: CommentedMap) -> None:
1818
makerdf(t["id"], t, ctx, graph=g)
1919

20+
for inp_name in inputs:
21+
for inp in tool.tool["inputs"]:
22+
if inp["id"].endswith(f"#{inp_name}"):
23+
inp["rdf:value"] = inputs[inp_name]
2024
tool.visit(visitor)
2125
return g
2226

2327

24-
def printrdf(wflow: Process, ctx: ContextType, style: str) -> str:
28+
def printrdf(wflow: Process, inputs: Any, ctx: ContextType, style: str) -> str:
2529
"""Serialize the CWL document into a string, ready for printing."""
26-
rdf = gather(wflow, ctx).serialize(format=style, encoding="utf-8")
30+
rdf = gather(wflow, inputs, ctx).serialize(format=style, encoding="utf-8")
2731
if not rdf:
2832
return ""
2933
return str(rdf, "utf-8")

cwltool/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,9 @@ def main(
11491149

11501150
if args.print_rdf:
11511151
print(
1152-
printrdf(tool, loadingContext.loader.ctx, args.rdf_serializer),
1152+
printrdf(
1153+
tool, job_order_object, loadingContext.loader.ctx, args.rdf_serializer
1154+
),
11531155
file=stdout,
11541156
)
11551157
return 0

0 commit comments

Comments
 (0)