Skip to content

Commit df13e2f

Browse files
committed
remove unused code
1 parent 0a97ccd commit df13e2f

File tree

1 file changed

+1
-171
lines changed

1 file changed

+1
-171
lines changed

cwltool/cwlrdf.py

Lines changed: 1 addition & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
import urllib
2-
from codecs import StreamWriter
3-
from collections.abc import Iterator
4-
from typing import IO, Any, Optional, TextIO, Union, cast
1+
from typing import IO, Any
52

63
from rdflib import Graph
7-
from rdflib.query import ResultRow
84
from ruamel.yaml.comments import CommentedMap
95
from schema_salad.jsonld_context import makerdf
106
from schema_salad.utils import ContextType
@@ -38,172 +34,6 @@ def lastpart(uri: Any) -> str:
3834
return uri2
3935

4036

41-
def dot_with_parameters(g: Graph, stdout: Union[TextIO, StreamWriter]) -> None:
42-
qres = cast(
43-
Iterator[ResultRow],
44-
g.query(
45-
"""SELECT ?step ?run ?runtype
46-
WHERE {
47-
?step cwl:run ?run .
48-
?run rdf:type ?runtype .
49-
}"""
50-
),
51-
) # ResultRow because the query is of type SELECT
52-
53-
for step, run, _ in qres:
54-
stdout.write(
55-
'"{}" [label="{}"]\n'.format(lastpart(step), f"{lastpart(step)} ({lastpart(run)})")
56-
)
57-
58-
qres = cast(
59-
Iterator[ResultRow],
60-
g.query(
61-
"""SELECT ?step ?inp ?source
62-
WHERE {
63-
?wf Workflow:steps ?step .
64-
?step cwl:inputs ?inp .
65-
?inp cwl:source ?source .
66-
}"""
67-
),
68-
) # ResultRow because the query is of type SELECT
69-
70-
for step, inp, source in qres:
71-
stdout.write('"%s" [shape=box]\n' % (lastpart(inp)))
72-
stdout.write('"{}" -> "{}" [label="{}"]\n'.format(lastpart(source), lastpart(inp), ""))
73-
stdout.write('"{}" -> "{}" [label="{}"]\n'.format(lastpart(inp), lastpart(step), ""))
74-
75-
qres = cast(
76-
Iterator[ResultRow],
77-
g.query(
78-
"""SELECT ?step ?out
79-
WHERE {
80-
?wf Workflow:steps ?step .
81-
?step cwl:outputs ?out .
82-
}"""
83-
),
84-
) # ResultRow because the query is of type SELECT
85-
86-
for step, out in qres:
87-
stdout.write('"%s" [shape=box]\n' % (lastpart(out)))
88-
stdout.write('"{}" -> "{}" [label="{}"]\n'.format(lastpart(step), lastpart(out), ""))
89-
90-
qres = cast(
91-
Iterator[ResultRow],
92-
g.query(
93-
"""SELECT ?out ?source
94-
WHERE {
95-
?wf cwl:outputs ?out .
96-
?out cwl:source ?source .
97-
}"""
98-
),
99-
) # ResultRow because the query is of type SELECT
100-
101-
for out, source in qres:
102-
stdout.write('"%s" [shape=octagon]\n' % (lastpart(out)))
103-
stdout.write('"{}" -> "{}" [label="{}"]\n'.format(lastpart(source), lastpart(out), ""))
104-
105-
qres = cast(
106-
Iterator[ResultRow],
107-
g.query(
108-
"""SELECT ?inp
109-
WHERE {
110-
?wf rdf:type cwl:Workflow .
111-
?wf cwl:inputs ?inp .
112-
}"""
113-
),
114-
) # ResultRow because the query is of type SELECT
115-
116-
for (inp,) in qres:
117-
stdout.write('"%s" [shape=octagon]\n' % (lastpart(inp)))
118-
119-
120-
def dot_without_parameters(g: Graph, stdout: Union[TextIO, StreamWriter]) -> None:
121-
dotname: dict[str, str] = {}
122-
clusternode = {}
123-
124-
stdout.write("compound=true\n")
125-
126-
subworkflows = set()
127-
qres = cast(
128-
Iterator[ResultRow],
129-
g.query(
130-
"""SELECT ?run
131-
WHERE {
132-
?wf rdf:type cwl:Workflow .
133-
?wf Workflow:steps ?step .
134-
?step cwl:run ?run .
135-
?run rdf:type cwl:Workflow .
136-
} ORDER BY ?wf"""
137-
),
138-
) # ResultRow because the query is of type SELECT
139-
for (run,) in qres:
140-
subworkflows.add(run)
141-
142-
qres = cast(
143-
Iterator[ResultRow],
144-
g.query(
145-
"""SELECT ?wf ?step ?run ?runtype
146-
WHERE {
147-
?wf rdf:type cwl:Workflow .
148-
?wf Workflow:steps ?step .
149-
?step cwl:run ?run .
150-
?run rdf:type ?runtype .
151-
} ORDER BY ?wf"""
152-
),
153-
) # ResultRow because the query is of type SELECT
154-
155-
currentwf: Optional[str] = None
156-
for wf, step, _run, runtype in qres:
157-
if step not in dotname:
158-
dotname[step] = lastpart(step)
159-
160-
if wf != currentwf:
161-
if currentwf is not None:
162-
stdout.write("}\n")
163-
if wf in subworkflows:
164-
if wf not in dotname:
165-
dotname[wf] = "cluster_" + lastpart(wf)
166-
stdout.write(f'subgraph "{dotname[wf]}" {{ label="{lastpart(wf)}"\n') # noqa: B907
167-
currentwf = wf
168-
clusternode[wf] = step
169-
else:
170-
currentwf = None
171-
172-
if str(runtype) != "https://w3id.org/cwl/cwl#Workflow":
173-
stdout.write(
174-
f'"{dotname[step]}" [label="{urllib.parse.urldefrag(str(step))[1]}"]\n' # noqa: B907
175-
)
176-
177-
if currentwf is not None:
178-
stdout.write("}\n")
179-
180-
qres = cast(
181-
Iterator[ResultRow],
182-
g.query(
183-
"""SELECT DISTINCT ?src ?sink ?srcrun ?sinkrun
184-
WHERE {
185-
?wf1 Workflow:steps ?src .
186-
?wf2 Workflow:steps ?sink .
187-
?src cwl:out ?out .
188-
?inp cwl:source ?out .
189-
?sink cwl:in ?inp .
190-
?src cwl:run ?srcrun .
191-
?sink cwl:run ?sinkrun .
192-
}"""
193-
),
194-
) # ResultRow because the query is of type SELECT
195-
196-
for src, sink, srcrun, sinkrun in qres:
197-
attr = ""
198-
if srcrun in clusternode:
199-
attr += 'ltail="%s"' % dotname[srcrun]
200-
src = clusternode[srcrun]
201-
if sinkrun in clusternode:
202-
attr += ' lhead="%s"' % dotname[sinkrun]
203-
sink = clusternode[sinkrun]
204-
stdout.write(f'"{dotname[src]}" -> "{dotname[sink]}" [{attr}]\n') # noqa: B907
205-
206-
20737
def printdot(
20838
wf: Process,
20939
ctx: ContextType,

0 commit comments

Comments
 (0)