Skip to content

Commit 9c1b525

Browse files
authored
cwlprov: add directory basename to the provenance metadata (#1798)
1 parent 68fd957 commit 9c1b525

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

cwltool/provenance_profile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,10 @@ def declare_directory(self, value: CWLObjectType) -> ProvEntity:
386386
(PROV_TYPE, RO["Folder"]),
387387
],
388388
)
389+
390+
if "basename" in value:
391+
coll.add_attributes({CWLPROV["basename"]: cast(str, value["basename"])})
392+
389393
# ORE description of ro:Folder, saved separately
390394
coll_b = dir_bundle.entity(
391395
dir_id,

tests/test_provenance.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ def check_prov(
539539
assert (d, RDF.type, PROV.Dictionary) in g
540540
assert (d, RDF.type, PROV.Collection) in g
541541
assert (d, RDF.type, PROV.Entity) in g
542+
assert len(list(g.objects(d, CWLPROV.basename))) == 1
542543

543544
files = set()
544545
for entry in g.objects(d, PROV.hadDictionaryMember):

0 commit comments

Comments
 (0)