Skip to content

Commit 9b302ad

Browse files
authored
Merge pull request #72 from simleo/sw_req
Convert SoftwareRequirement
2 parents 72d6f21 + fdea0ab commit 9b302ad

31 files changed

+2336
-2279
lines changed

cwl/grepucase/greptool.cwl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
class: CommandLineTool
22
cwlVersion: v1.0
33

4+
hints:
5+
SoftwareRequirement:
6+
packages:
7+
grep:
8+
specs: ["https://www.gnu.org/software/grep/"]
9+
version: ["3.8"]
10+
411
baseCommand: ["bash", "-c"]
512

613
inputs:

src/runcrate/convert.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,13 +396,31 @@ def add_tool(self, crate, workflow, cwl_tool):
396396
ramMin = req.ramMin
397397
if ramMin:
398398
properties["memoryRequirements"] = f"{int(ramMin)} MiB"
399+
deps = []
399400
if hasattr(cwl_tool, "hints") and cwl_tool.hints:
400401
for req in cwl_tool.hints:
401402
if hasattr(req, "class_") and req.class_ == "ResourceRequirement":
402403
ramMin = req.ramMin
403404
if ramMin:
404405
properties["memoryRequirements"] = f"{int(ramMin)} MiB"
406+
if hasattr(req, "class_") and req.class_ == "SoftwareRequirement":
407+
for p in req.packages:
408+
if hasattr(p, "specs") and p.specs:
409+
dep_id = p.specs[0]
410+
dep_properties = {
411+
"@type": "SoftwareApplication",
412+
"name": p.package
413+
}
414+
if p.version:
415+
dep_properties["softwareVersion"] = p.version
416+
deps.append(
417+
crate.add(ContextEntity(crate, dep_id, properties=dep_properties))
418+
)
405419
tool = crate.add(ContextEntity(crate, tool_id, properties=properties))
420+
if deps:
421+
tool["softwareRequirements"] = deps
422+
if len(deps) == 1:
423+
tool["mainEntity"] = deps[0]
406424
tool["input"] = self.add_params(crate, cwl_tool.inputs)
407425
tool["output"] = self.add_params(crate, cwl_tool.outputs)
408426
workflow.append_to("hasPart", tool)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Bag-Software-Agent: cwltool 3.1.20230213100550
1+
Bag-Software-Agent: cwltool 3.1.20231020140205
22
BagIt-Profile-Identifier: https://w3id.org/ro/bagit/profile
3-
Bagging-Date: 2023-02-17
3+
Bagging-Date: 2023-11-22
44
External-Description: Research Object of CWL workflow run
5-
External-Identifier: arcp://uuid,422fecc5-1e57-45bc-a653-1513a7a6fe70/
5+
External-Identifier: arcp://uuid,03322031-8508-4afe-94a8-0198cc6b81f0/
66
Payload-Oxum: 151.7
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
8d84ef91f0aba379f5edc3836b4b5f6727920f22 data/8d/8d84ef91f0aba379f5edc3836b4b5f6727920f22
21
d60dd58346cf7e533252f35399cd510b1b1467f7 data/d6/d60dd58346cf7e533252f35399cd510b1b1467f7
2+
8d84ef91f0aba379f5edc3836b4b5f6727920f22 data/8d/8d84ef91f0aba379f5edc3836b4b5f6727920f22
33
1078cf414b2625a240b16392085d66580bb66f4d data/10/1078cf414b2625a240b16392085d66580bb66f4d
4-
8545949f96b96cb721485066bafad9b768bc4e52 data/85/8545949f96b96cb721485066bafad9b768bc4e52
54
5aa9aa3b336778cf2a7db648fc530892c3b3dabb data/5a/5aa9aa3b336778cf2a7db648fc530892c3b3dabb
6-
3ccdc7533084b641e6c941cc6dbb091d2e5f8a41 data/3c/3ccdc7533084b641e6c941cc6dbb091d2e5f8a41
5+
8545949f96b96cb721485066bafad9b768bc4e52 data/85/8545949f96b96cb721485066bafad9b768bc4e52
76
ec0270052a78321508502ed915815c4daf75fe46 data/ec/ec0270052a78321508502ed915815c4daf75fe46
7+
3ccdc7533084b641e6c941cc6dbb091d2e5f8a41 data/3c/3ccdc7533084b641e6c941cc6dbb091d2e5f8a41
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@prefix id: <urn:uuid:> .
2+
@prefix ore: <http://www.openarchives.org/ore/terms/> .
3+
@prefix prov: <http://www.w3.org/ns/prov#> .
4+
@prefix ro: <http://purl.org/wf4ever/ro#> .
5+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
6+
7+
id:be8d4460-90f6-43c5-8287-ceab31972de2 a ro:FolderEntry,
8+
ore:Proxy,
9+
prov:Entity ;
10+
ro:entryName "bar.out"^^xsd:string ;
11+
ore:proxyFor id:a9ab8653-e354-4b7c-9bf8-0ae63766739b ;
12+
ore:proxyIn id:107dd13d-3630-4e81-bd71-026b638facbc .
13+
14+
id:f2ecfe9a-f8cc-4a93-be80-f432fe07c9fc a ro:FolderEntry,
15+
ore:Proxy,
16+
prov:Entity ;
17+
ro:entryName "foo.out"^^xsd:string ;
18+
ore:proxyFor id:79a136c8-0972-4775-a580-7bbcc534560e ;
19+
ore:proxyIn id:107dd13d-3630-4e81-bd71-026b638facbc .
20+
21+
id:107dd13d-3630-4e81-bd71-026b638facbc a ro:Folder,
22+
ore:Aggregation,
23+
prov:Entity ;
24+
ore:aggregates id:be8d4460-90f6-43c5-8287-ceab31972de2,
25+
id:f2ecfe9a-f8cc-4a93-be80-f432fe07c9fc .
26+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@prefix id: <urn:uuid:> .
2+
@prefix ore: <http://www.openarchives.org/ore/terms/> .
3+
@prefix prov: <http://www.w3.org/ns/prov#> .
4+
@prefix ro: <http://purl.org/wf4ever/ro#> .
5+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
6+
7+
id:2075729e-b057-4fdc-9c86-09311d9c0ecc a ro:FolderEntry,
8+
ore:Proxy,
9+
prov:Entity ;
10+
ro:entryName "foo.out"^^xsd:string ;
11+
ore:proxyFor id:ddf09a83-68c1-43e9-b94f-014037afe00c ;
12+
ore:proxyIn id:4ed2e115-3819-4223-b391-50c40fa8e7df .
13+
14+
id:7470117c-b551-42be-8b7a-8185375db7e7 a ro:FolderEntry,
15+
ore:Proxy,
16+
prov:Entity ;
17+
ro:entryName "bar.out"^^xsd:string ;
18+
ore:proxyFor id:6e4a760b-51e7-472a-b732-fd31c1acf858 ;
19+
ore:proxyIn id:4ed2e115-3819-4223-b391-50c40fa8e7df .
20+
21+
id:4ed2e115-3819-4223-b391-50c40fa8e7df a ro:Folder,
22+
ore:Aggregation,
23+
prov:Entity ;
24+
ore:aggregates id:2075729e-b057-4fdc-9c86-09311d9c0ecc,
25+
id:7470117c-b551-42be-8b7a-8185375db7e7 .
26+

tests/data/grepucase-run-1/metadata/directory-5b25d2eb-2e89-4d62-8145-2ea3656ba173.ttl

Lines changed: 0 additions & 26 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@prefix id: <urn:uuid:> .
2+
@prefix ore: <http://www.openarchives.org/ore/terms/> .
3+
@prefix prov: <http://www.w3.org/ns/prov#> .
4+
@prefix ro: <http://purl.org/wf4ever/ro#> .
5+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
6+
7+
id:95b7c437-983d-496b-9f5d-76920586668e a ro:FolderEntry,
8+
ore:Proxy,
9+
prov:Entity ;
10+
ro:entryName "foo"^^xsd:string ;
11+
ore:proxyFor id:fb8bdb45-b85e-4fa3-b385-26bb40577340 ;
12+
ore:proxyIn id:66dbb40f-d6d1-42db-8220-8b51ad4dd5ba .
13+
14+
id:caf7defd-a8f4-4bb7-9961-02ff95d40c76 a ro:FolderEntry,
15+
ore:Proxy,
16+
prov:Entity ;
17+
ro:entryName "bar"^^xsd:string ;
18+
ore:proxyFor id:92d8ca48-5172-458e-901e-5763cf093663 ;
19+
ore:proxyIn id:66dbb40f-d6d1-42db-8220-8b51ad4dd5ba .
20+
21+
id:66dbb40f-d6d1-42db-8220-8b51ad4dd5ba a ro:Folder,
22+
ore:Aggregation,
23+
prov:Entity ;
24+
ore:aggregates id:95b7c437-983d-496b-9f5d-76920586668e,
25+
id:caf7defd-a8f4-4bb7-9961-02ff95d40c76 .
26+

tests/data/grepucase-run-1/metadata/directory-bea1dc23-0537-4874-82ce-454f48c08d0a.ttl renamed to tests/data/grepucase-run-1/metadata/directory-79a136c8-0972-4775-a580-7bbcc534560e.ttl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
@prefix ro: <http://purl.org/wf4ever/ro#> .
55
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
66

7-
id:7329bf41-05c0-4881-8bd3-1203a530f736 a ro:FolderEntry,
8-
ore:Proxy,
7+
id:79a136c8-0972-4775-a580-7bbcc534560e a ro:Folder,
8+
ore:Aggregation,
99
prov:Entity ;
10-
ro:entryName "foo.out.out"^^xsd:string ;
11-
ore:proxyFor id:cb12bf67-5541-4f8c-b897-47a87e11a242 ;
12-
ore:proxyIn id:bea1dc23-0537-4874-82ce-454f48c08d0a .
10+
ore:aggregates id:d72a309c-26f9-422c-a812-74127256c8a2 .
1311

14-
id:bea1dc23-0537-4874-82ce-454f48c08d0a a ro:Folder,
15-
ore:Aggregation,
12+
id:d72a309c-26f9-422c-a812-74127256c8a2 a ro:FolderEntry,
13+
ore:Proxy,
1614
prov:Entity ;
17-
ore:aggregates id:7329bf41-05c0-4881-8bd3-1203a530f736 .
15+
ro:entryName "foo.out.out"^^xsd:string ;
16+
ore:proxyFor id:b604cd9a-7a66-4bf2-83fc-b61b515b06bb ;
17+
ore:proxyIn id:79a136c8-0972-4775-a580-7bbcc534560e .
1818

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@prefix id: <urn:uuid:> .
2+
@prefix ore: <http://www.openarchives.org/ore/terms/> .
3+
@prefix prov: <http://www.w3.org/ns/prov#> .
4+
@prefix ro: <http://purl.org/wf4ever/ro#> .
5+
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
6+
7+
id:4e117ee5-4bcb-41be-a18a-98163d76839f a ro:FolderEntry,
8+
ore:Proxy,
9+
prov:Entity ;
10+
ro:entryName "foo"^^xsd:string ;
11+
ore:proxyFor id:cb8da8f0-ac68-4ee4-96be-e7251eee8743 ;
12+
ore:proxyIn id:99571210-dcea-4991-bc3d-64b28f87a0d7 .
13+
14+
id:e4231925-b712-419b-89c9-feb7468faf0d a ro:FolderEntry,
15+
ore:Proxy,
16+
prov:Entity ;
17+
ro:entryName "bar"^^xsd:string ;
18+
ore:proxyFor id:608f6a9a-4d1f-4255-9424-328b4f68a291 ;
19+
ore:proxyIn id:99571210-dcea-4991-bc3d-64b28f87a0d7 .
20+
21+
id:99571210-dcea-4991-bc3d-64b28f87a0d7 a ro:Folder,
22+
ore:Aggregation,
23+
prov:Entity ;
24+
ore:aggregates id:4e117ee5-4bcb-41be-a18a-98163d76839f,
25+
id:e4231925-b712-419b-89c9-feb7468faf0d .
26+

0 commit comments

Comments
 (0)